一、接收的配置流程
1. Global behavior:
设置管脚和工作模式
Set the receiver pins to operate as McBSP pins
Enable/disable the digital loopback mode 回环模式
Enable/disable the clock stop mode 时钟停止模式
Enable/disable the receive multichannel selection mode 多通道
2. Data behavior:
Choose one or two phases for the receive frame 接受帧单段还是双段
Set the receive word length(s) 接收字长
Set the receive frame length
Enable/disable the receive frame-sync ignore function
Set the receive companding mode
Set the receive data delay
Set the receive sign-extension and justification mode 数据符号扩展和校验
Set the receive interrupt mode
3. Frame-sync behavior:
Set the receive frame-sync mode
Set the receive frame-sync polarity
Set the SRG frame-sync period and pulse width
4. Clock behavior:
Set the receive clock mode
Set the receive clock polarity
Set the SRG clock divide-down value
Set the SRG clock synchronization mode
Set the SRG clock mode [choose an input clock]
Set the SRG input clock polarity
二、寄存器配置
接收时需要配置的寄存器: SPCR1, SPCR2, PCR, RCR1, RCR2SRGR1, SRGR2 ,其他的可以设为default
下面是一个我的调试配置参数,所有时钟和帧同步都由外部提供
注意的几点:
1. 在configure是 RRST 和 XRST 一定要设置为Disable,才可以正确的配置他的各个寄存器
2. 5502 不支持 CLKG的同步 SRGR2中的 GSYNC bit 始终写为 0
使用时如下步骤:
IRQ_globalDisable();
hMcbsp = MCBSP_open(MCBSP_PORT1, MCBSP_OPEN_RESET);
rcvEventID = MCBSP_getRcvEventId(hMcbsp);
IRQ_setVecs((Uint32)(&VECSTART));
IRQ_clear(rcvEventID);
IRQ_plug(rcvEventID, &readISR);
MCBSP_config(hMcbsp, &MCBSP_READONLY_Config_ _test);
IRQ_enable(rcvEventID);
/* Start Sample Rate Generator and Frame Sync */
MCBSP_start(hMcbsp,MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC,0x300); //如果需要
/* Enable MCBSP transmit and receive */
MCBSP_start(hMcbsp, MCBSP_RCV_START , 0);
IRQ_globalEnable();
三、测试例程
下面是我的一个测试程序,可以正确接受数据: