This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

synchronizing the MsBSP ports

I’m using a dsk6711 to implement a delta sigma modulator. I need to write to both McBSP0 and McBSP1 synchronously. What is the easiest way to implement this?

I am useing the following routine to initialize the McBSP ports but it seems that usually McBSP0 starts one clock cycle sooner than McBSP1 (I mean the FSX0 is one bit ahead of FSX1). However it seems it is random and as I reset the CPU and reload it again, the situation might change and the ports might become synchronized.

 

Thanks,

Mohammad

 

void McBSPInit(void)

{

Uint32 Temp=0,Data=0;

   

    MCBSP_enableSrgr(hMcbsp1);     // Enable the sample rate generator  

    MCBSP_enableSrgr(hMcbsp0);     // Enable the sample rate generator

   

    for (Temp=0;Temp<150;Temp++) //Should have a two clock cycle delay here

        Data++;

 

   init_HWI();      // Enabling Interrupts

   

    MCBSP_enableXmt(hMcbsp0);     // Enable the transmitter0  

    MCBSP_enableRcv(hMcbsp0);   // Enable the receiver0

 

    MCBSP_enableXmt(hMcbsp1);     // Enable the transmitter1  

    MCBSP_enableRcv(hMcbsp1);      // Enable the receiver1

 

    MCBSP_enableFsync(hMcbsp0);   // Enable the frame sync generator0  

    MCBSP_enableFsync(hMcbsp1);   // Enable the frame sync generator1 

 

 

    MCBSP_write(hMcbsp0, 0xF0F0);

    MCBSP_write(hMcbsp1, 0xF0F0);

 

}

 

MCBSP_Config mcbspCfg = {

    0x02000080,        /*  Serial Port Control Reg. (SPCR)   */

    0x00000040,        /*  Receiver Control Reg. (RCR)   */

    0x00040040,        /*  Transmitter Control Reg. (XCR)   */

    0x500F0000,        /*  Sample-Rate Generator Reg. (SRGR)   */

    0x00000000,        /*  Multichannel Control Reg. (MCR)   */

    0x00000000,        /*  Receiver Channel Enable(RCER)   */

    0x00000000,        /*  Transmitter Channel Enable(XCER)   */

    0x00000F03         /*  Pin Control Reg. (PCR)   */

};

  • These peripherals are independent from each other. There are not internal synchronization signals designed into the device. You cannot guarantee them both being synchronized without finding some trick that I do not know about.

    However, the peripherals are designed to work either synchronously to their own generated timing signals or to an externally generated set of signals. So you can use McBSP0 to generate the clock and FSX for its channel and connect those directly to McBSP1's clock and FSX pins. Then configure McBSP1 to use externally generated signals, which in this case would be those from McBSP0.

    We often do this to communicate with an intelligent Codec or with another DSP.