|
目前想实现的功能是C28346和F28335之间通过McBSP以DMA的方式进行数据传输:C28346发送一个数组给F28335,F28335接收完成后,将数据发还给C28346.校验无误后执行全数组+1操作,然后重复发送。现在遇到的问题是F28335收到数组之后,不能发还C28346。我想请问下,是McBSP的设置问题吗?
下面是两块芯片的McBSP的参数设置:
C28346:
void mcbsp_init_dlb1()
{ McbspaRegs.SPCR2.all=0x0000; // Reset FS generator, sample rate generator & transmitter
McbspaRegs.SPCR1.all=0x0000; // Reset Receiver, Right justify word
// McbspaRegs.SPCR1.bit.DLB = 1; // Enable DLB mode. Comment out for non-DLB mode.
McbspaRegs.MFFINT.all=0x0; // Disable all interrupts
McbspaRegs.RCR2.all=0x0000; // Single-phase frame, 1 word/frame, No companding(Receive)
McbspaRegs.RCR1.all=0x0;
McbspaRegs.XCR2.all=0x0000; // Single-phase frame, 1 word/frame, No companding(Transmit)
McbspaRegs.XCR1.all=0x0;
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 = 3; // CLKG frequency = LSPCLK/(CLKGDV+1)
McbspaRegs.PCR.bit.FSXM = 1; // FSX generated internally, FSR derived from an external source
McbspaRegs.PCR.bit.CLKXM = 1; // CLKX generated internally, CLKR derived from an external source
//*************** Initialize McBSP Data Length
InitMcbspa16bit();
//************* Enable Sample rate generator
McbspaRegs.SPCR2.bit.GRST=1; // Enable the sample rate generator
delay_loop(); // Wait at least 2 SRG clock cycles
McbspaRegs.SPCR2.bit.XRST=1; // Release TX from Reset
McbspaRegs.SPCR1.bit.RRST=1; // Release RX from Reset
McbspaRegs.SPCR2.bit.FRST=1; // Frame Sync Generator reset
}
F28335:
void mcbsp_init_dlb()
{ McbspaRegs.SPCR2.all=0x0000; // Reset FS generator, sample rate generator & transmitter
McbspaRegs.SPCR1.all=0x0000; // Reset Receiver, Right justify word
// McbspaRegs.SPCR1.bit.DLB = 1; //禁止回送模式
McbspaRegs.MFFINT.all=0x0; // Disable all interrupts
McbspaRegs.RCR2.all=0x0000; // Single-phase frame, 1 word/frame, No companding(Receive)
McbspaRegs.RCR1.all=0x0;
McbspaRegs.XCR2.all=0x0000; // Single-phase frame, 1 word/frame, No companding(Transmit)
McbspaRegs.XCR1.all=0x0;
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 = 1; // CLKG frequency = LSPCLK/(CLKGDV+1)
McbspaRegs.PCR.bit.FSXM = 1; // FSX generated internally, FSR derived from an external source
McbspaRegs.PCR.bit.CLKXM = 1; // CLKX generated internally, CLKR derived from an external source
//*************** Initialize McBSP Data Length
InitMcbspa16bit();
//************* Enable Sample rate generator
McbspaRegs.SPCR2.bit.GRST=1; // Enable the sample rate generator
delay_loop(); // Wait at least 2 SRG clock cycles
McbspaRegs.SPCR2.bit.XRST=1; // Release TX from Reset
McbspaRegs.SPCR1.bit.RRST=1; // Release RX from Reset
McbspaRegs.SPCR2.bit.FRST=1; // Frame Sync Generator reset
}
每次DMA发送完后启动接收通道,接收完成后启动发送通道。另外,我想请问下,每次收发,需要初始化DMA的设置吗?
|
|