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.

TMS320F28335: How to know when McBSP data has been "Completely" transmitted

Guru 20035 points
Other Parts Discussed in Thread: TMS320F28335

Hello,

I am using the McBSP port for several external devices, with the TMS320F28335 providing a separate GPIO for each slave select.

I haven't been able to find a McBsp flag that indicates when all bits have been transmitted.  Am I overlooking something?

Is there a way to know when all the bits have been transmitted?

One of the devices has a Slave out line that's fed back to the McBSP MISO.  For that device, I can use the RRDY or RFULL flag.   But what about the other devices?

Stephen

  • Stephen,

    The XEMPTY bit in SPCR2 will be cleared when the transmitter is empty and there is no new data to transmit.

    You may also use the XRDY bit in the same register. This bit will be set when DXR[1:2] is ready to accept new data.

    These bits are described in Table 11-3 on page 122 of http://www.ti.com/lit/ug/sprufb7b/sprufb7b.

    I hope this helps!

    Mark

  • Hello Mark,

    Thanks for the quick reply.

    My test shows that XEMPTY only indicates data has been transferred to the shift register (DXR1 --> XSR1), which is the same as the XRDY flag.  Also, I already know that XEMPTY has negative polarity (0 means empty and 1 means not empty).

    My test code that waits for the port to be empty looks something like this:

    while(McbspaRegs.SPCR2.bit.XEMPTY){}

    Can you please verify what I am seeing is correct.

    Thanks,

    Stephen

  • Hello Mark,

    I just tested it again and got the same results.

    A snippet of my code is shown below.  No data gets transmitted If I put a breakpoint at the while(1).  Without the breakpoint all of the data gets transmitted.

    Stephen

     MCBSPA_Init(mcbspaConfig);

     MCBSPA_WriteU32(configurationSetting);

     while (McbspaRegs.SPCR2.bit.XEMPTY)  {  };

     while(1){};

  • Hello Mark,

    Could you give me some time frame on when you will be able to test this issue.

    Thanks,

    Stephen

  • Hello Mark,

    Could you please give a status on your progress.

    Thanks,

    Stephen

  • Stephen,

    Sorry for the delay. I am looking into this a little bit more and will get back to you. In the meantime, could you tell me if you are running in SPI mode? 

    -Mark

  • Hello Mark,

    I am running the McBSP in SPI mode.

    Thanks,
    Stephen

  • Stephen,

    Since you are in SPI mode, you can still poll the RRDY bit even though the Data that you "receive" into the DRR register is a don't care. This bit will get set when there is a transfer from the RBR1 to DRR. In your situation, it will occur after the data has been clocked out of the DX pin. You can do a dummy read of the DRR register to clear the RRDY Flag for the next transmission. 

    Regards,

    Mark