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.

TMS320F280023: Issue with DMA byte transfer from LIN in SCI mode

Part Number: TMS320F280023
Other Parts Discussed in Thread: C2000WARE

I am trying to use a LIN module configured to SCI mode with single buffer along with a DMA module to transfer the received data to memory after each byte is received.  Starting with the C2000WARE example program "lin_ex3_sci_dma", I modified the LIN configuration to disable multi buffer mode and reconfigured the DMAs to transfer a single byte per burst.  While the modified program appears to successfully load and transmit the data via the transmit DMA, the receive DAM will not transfer the data from the Rx buffer.  Through experimentation I was able to make it work by adding an initial force trigger of the receive DMA engine to get it started.  What I can't figure out is why the receive DMA ignores RX DMA Request until after I issue a force trigger?

Modified source file is attached with all changes identified with "//modified".

4278.lin_ex3_sci_dma.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//#############################################################################
//
// FILE: lin_ex3_sci_dma.c
//
// TITLE: LIN SCI MODE Internal Loopback with DMA
//
//! \addtogroup driver_example_list
//! <h1> LIN SCI MODE Internal Loopback with DMA </h1>
//!
//! This example configures the LIN module in SCI mode for internal loopback
//! with the use of the DMA. The LIN module performs as SCI with a set
//! character and frame length in multi-buffer mode. When the transmit buffers
//! in the LINTD0 and LINTD1 registers have enough space, the DMA will transfer
//! data from global variable sData into those transmit registers. Once the
//! received buffers in the LINRD0 and LINRD1 registers contain data,the DMA
//! will transfer the data into the global variable rdata.
//!
//! When all data has been placed into rData, a check of the validity of the
//! data will be performed in one of the DMA channels' ISRs.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Don,

    let me route this to our LIN expert!

    Will get back to you today!

    Nima

  • Hi Don,

    It's possible that the data has arrived before the trigger was enabled. Can you see if the data is already in the buffer before the "DMA_startChannel" occurs? I believe that would cause this.

    Regards,

    Vince

  • Hi Vince,

    Thanks for the suggestion.  However, I don't believe that is the issue as the Receive DMA is enabled before any data is sent.  I have also verified that before the first byte is sent that the LIN RXRDY flag is cleared as well as the Receive DMA TRANSFERSTS and PERINTFLG flags indicating that no data has been received by the LIN and no trigger has been received by the Receive DNA.   

  • Hi Don,

    For the LIN-SCI side of things, if you're not in multi-buffer mode, then you need to check these things that are needed :

    1. Are there any receive errors in the LIN/SCI module? Check all error registers, and if any error is set, then DMA request will not occur.

    2. Is there actually data in the buffer when you're expecting it? Particularly in RD7. If there is nothing on the first receive, then the DMA request will not be sent.

    3. Are the SET RX DMA bits set? If not, DMA request will not be sent.

    4. Is the "SET RX DMA ALL" bit set and you are in multiprocessor mode? If in multiprocessor mode, and the DMA ALL bit is set incorrectly, then DMA request will not be sent for either data frames or address frames (depending on how you have it set). This is specific to multiprocessor mode.

    5. Is the SLEEP bit set? If it is set, then the DMA request will not be sent.

    If you have ensured all of the above are set/cleared correctly, then this could potentially be a DMA configuration issue. I will contact the DMA expert at that time to verify this.

    Regards,

    Vince

  • Thanks Vince,

    The issue was with “SET RX DMA ALL”.  I did not have it set as I am not using multiprocessor mode.  It appears however that the first byte received in single byte mode does not trigger the DMA unless this is bit set regardless of if you are using multiprocessor mode or not.  All works as expected after setting the bit.  Please let me know if my understanding is incorrect.

    Thanks,

    Don