调试28335的MCBSP通讯碰到一个问题,在自测模式下,MCBSP通讯可以正常通讯可以接受到数据,但是将自测模式关闭后(只令DLB=0),进行两个板子的通讯,接受的板子可以进接受中断,但是接受寄存器一直都是0,检查了引脚连接没问题,用示波器看发送的引脚,时钟,帧同步信号,数据都有,就是接收不到,不知道是什么问题。
user5762425:void InitMcbspa(void)
{
// McBSP-A register settings
McbspaRegs.SPCR2.all=0x0000;// Reset FS generator, sample rate generator & transmitterMcbspaRegs.SPCR1.all=0x0000;// Reset Receiver, Right justify wordMcbspaRegs.SPCR1.bit.DLB = 1;// Enable loopback mode for test. Comment out for normal McBSP transfer mode.
McbspaRegs.MFFINT.all=0x0;// Disable all interruptsMcbspaRegs.RCR1.all=0x0;McbspaRegs.RCR2.all=0x05;//McbspaRegs.RCR1.all=0x0;// Single-phase frame, 1 word/frame, No companding (Receive)//McbspaRegs.RCR1.bit.RFRLEN1=4;
McbspaRegs.XCR1.all=0x0;McbspaRegs.XCR2.all=0x05;
// Single-phase frame, 1 word/frame, No companding (Transmit)//McbspaRegs.XCR1.bit.XFRLEN1=4;
McbspaRegs.PCR.bit.FSXM = 1;// FSX generated internally, FSR derived from an external sourceMcbspaRegs.PCR.bit.CLKXM = 1;// CLKX generated internally, CLKR derived from an external sourceMcbspaRegs.SRGR1.all = 0xff04;//McbspaRegs.SRGR2.all = 0xA000;// //McbspaRegs.SRGR2.bit.CLKSM = 1;// CLKSM=1 (If SCLKME=0, i/p clock to SRG is LSPCLK)//McbspaRegs.SRGR2.bit.FPER = 31;// FPER = 32 CLKG periods
//McbspaRegs.SRGR1.bit.FWID = 0;// Frame Width = 1 CLKG period// McbspaRegs.SRGR1.bit.CLKGDV = CLKGDV_VAL;// CLKG frequency = LSPCLK/(CLKGDV+1)McbspaRegs.MFFINT.bit.RINT = 1;
delay_loop();// Wait at least 2 SRG clock cycles
McbspaRegs.SPCR2.bit.GRST=1;McbspaRegs.SPCR1.bit.RINTM=0;//中断由RRDY产生// Enable the sample rate generatorclkg_delay_loop();// Wait at least 2 CLKG cyclesMcbspaRegs.SPCR2.bit.XRST=1; // Release TX from ResetMcbspaRegs.SPCR1.bit.RRST=1; // Release RX from ResetMcbspaRegs.SPCR2.bit.FRST=1; // Frame Sync Generator reset
}
调试28335的MCBSP通讯碰到一个问题,在自测模式下,MCBSP通讯可以正常通讯可以接受到数据,但是将自测模式关闭后(只令DLB=0),进行两个板子的通讯,接受的板子可以进接受中断,但是接受寄存器一直都是0,检查了引脚连接没问题,用示波器看发送的引脚,时钟,帧同步信号,数据都有,就是接收不到,不知道是什么问题。
Green Deng:检查一下你的接收管脚的gpio muxing配置正确吗?
当接收到一个中断时,状态标志位(像spcr1中的那些)处于什么状态?它们与回环模式运行时有什么不同吗?
调试28335的MCBSP通讯碰到一个问题,在自测模式下,MCBSP通讯可以正常通讯可以接受到数据,但是将自测模式关闭后(只令DLB=0),进行两个板子的通讯,接受的板子可以进接受中断,但是接受寄存器一直都是0,检查了引脚连接没问题,用示波器看发送的引脚,时钟,帧同步信号,数据都有,就是接收不到,不知道是什么问题。
user5762425:
回复 Green Deng:
相同的配置,我在MCBSP-B上测试时可以接收到数据了,MCBSP-A上就是回环测试可以,板间测试不行
调试28335的MCBSP通讯碰到一个问题,在自测模式下,MCBSP通讯可以正常通讯可以接受到数据,但是将自测模式关闭后(只令DLB=0),进行两个板子的通讯,接受的板子可以进接受中断,但是接受寄存器一直都是0,检查了引脚连接没问题,用示波器看发送的引脚,时钟,帧同步信号,数据都有,就是接收不到,不知道是什么问题。
Annie Liu:
回复 user5762425:
您的问题在E2E英文论坛已有工程师跟进,请继续关注。https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/818684
调试28335的MCBSP通讯碰到一个问题,在自测模式下,MCBSP通讯可以正常通讯可以接受到数据,但是将自测模式关闭后(只令DLB=0),进行两个板子的通讯,接受的板子可以进接受中断,但是接受寄存器一直都是0,检查了引脚连接没问题,用示波器看发送的引脚,时钟,帧同步信号,数据都有,就是接收不到,不知道是什么问题。
user5762425:
回复 Green Deng:
管脚配置是按照例程来的
void InitMcbspaGpio(void){ EALLOW;
/* Configure McBSP-A pins using GPIO regs*/// This specifies which of the possible GPIO pins will be McBSP functional pins.// Comment out other unwanted lines.
GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 2; // GPIO20 is MDXA pin GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 2; // GPIO21 is MDRA pin GpioCtrlRegs.GPAMUX2.bit.GPIO22 = 2; // GPIO22 is MCLKXA pin GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 2; // GPIO7 is MCLKRA pin (Comment as needed) //GpioCtrlRegs.GPBMUX2.bit.GPIO58 = 1; // GPIO58 is MCLKRA pin (Comment as needed) GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 2; // GPIO23 is MFSXA pin GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 2; // GPIO5 is MFSRA pin (Comment as needed) //GpioCtrlRegs.GPBMUX2.bit.GPIO59 = 1; // GPIO59 is MFSRA pin (Comment as needed)
/* Enable internal pull-up for the selected pins */// Pull-ups can be enabled or disabled by the user.// This will enable the pullups for the specified pins.// Comment out other unwanted lines.
GpioCtrlRegs.GPAPUD.bit.GPIO20 = 0; // Enable pull-up on GPIO20 (MDXA) GpioCtrlRegs.GPAPUD.bit.GPIO21 = 0; // Enable pull-up on GPIO21 (MDRA) GpioCtrlRegs.GPAPUD.bit.GPIO22 = 0; // Enable pull-up on GPIO22 (MCLKXA) GpioCtrlRegs.GPAPUD.bit.GPIO7 = 0; // Enable pull-up on GPIO7 (MCLKRA) (Comment as needed) //GpioCtrlRegs.GPBPUD.bit.GPIO58 = 0; // Enable pull-up on GPIO58 (MCLKRA) (Comment as needed) GpioCtrlRegs.GPAPUD.bit.GPIO23 = 0; // Enable pull-up on GPIO23 (MFSXA) GpioCtrlRegs.GPAPUD.bit.GPIO5 = 0; // Enable pull-up on GPIO5 (MFSRA) (Comment as needed) //GpioCtrlRegs.GPBPUD.bit.GPIO59 = 0; // Enable pull-up on GPIO59 (MFSRA) (Comment as needed)