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.

TMS570LS3137: SCI Rx with DMA - Frame Count

Part Number: TMS570LS3137

Hi,

I want to set up SCI Rx with DMA. However I don't know how many bytes to expect. 

I might receive anything between [17, 270] bytes.

So, Not sure what to set the FRCNT. (One element is 8-bits. Element count is 1.)

If I set the FRCNT to max (270) and the PC App sends a packet of 145 bytes, how would DMA behave? 

How would I know if Rx DMA is done since I can not check the status of Frame Transfer complete Status Flag (since 145 is less than 270). So, not sure how to figure out when SCI Rx is done.

How about checking if DMA is done by: while (dmaREG->DMASTAT & (1 << dmaChannel))

Any guidance? thanks

====

The rough scheme is: The PC app will send a packet whose size vary from 17 to 270 bytes.

firmware will receive and digest this packet and respond back to the PC app.

PC app won't send new bytes till it receives a message from the firmware.

  • Hello,

    The number of bytes should be known before starting DMA transferring. Before configuring DMA channel package, another size of uart should send you a header telling you the data length.

    If the FRCNT is 270, but only 200 bytes data are sent, the DMA keeps waiting. The DMA can be disabled by writing 0 to DMA_EN of GCTRL register.