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-EP: SCI/Lin Multi-buffer mode not working

Part Number: TMS570LS3137-EP
Other Parts Discussed in Thread: TMS570LS3137

Hi, I'm using the TMS570LS3137 HDK and need to use Multi-buffer for SCI2/Lin port. 

I've attached my project with some simple test code.

If I set MBUF_MODE in scilinREG->GCR1 then no characters are transmitted.

If I don't set MBUF_MODE then characters are transmitted.

scilinREG->GCR1 |= (uint32)((uint32)1U << 10U); // MBUF_MODE, This lines stops things from working

In the project I've added the line, 

    scilinREG->GCR1 |= (uint32)((uint32)1U << 10U);

 to sciInit() in sci.c.

Buffer LENGTH is set to 4 in  sciInit() in sci.c.  scilinREG->FORMAT = 0x00030007; // LENGTH = 4

Here is my test code:

sciInit();

// Wait for IDLE after initialization -- this is required after sciInit() to have things work
while(sciIsIdleDetected(scilinREG));


// Observe characters on CCS Terminal
while(!sciIsTxReady(scilinREG));
scilinREG->TD = (uint32)'a';
while(!sciIsTxReady(scilinREG));
scilinREG->TD = (uint32)'b';
while(!sciIsTxReady(scilinREG));
scilinREG->TD = (uint32)'c';
while(!sciIsTxReady(scilinREG));
scilinREG->TD = (uint32)'d';
while(!sciIsTxReady(scilinREG));
scilinREG->TD = (uint32)'e';

The project is currently set up to transmit the the CCS Terminal, but I've also tried setting the LOOPBACK bit and doing a SCI read, but the results are the same: It works fine if MBUF_MODE=0 and nothing appears to be transmitted if MBUF_MODE=1.

I'm sure I'm missing something simple, but my search in the forum didn't turn up anything.

Your help would be greatly appreciated,

Best regards,

-JoeSCI_MULTIBUFFER.zip

  • Hi Joe,

    I created one example project for SCI multibuffered using DMA. You can find that in below link,

    (+) [FAQ] RM48L952: How to perform 8 Byte transfer in SCI Multi-buffered Mode using DMA - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    Here i also explained one issue with the SCI multibuffered mode, so my request here is first verify above example and try to do modifications accordingly.

    If you are unable to solve your problem, even after referring above thread then i will do necessary debugging from my side.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    Thanks for the example project.  Using it I was able to figure out what I was doing wrong.

    It seems obvious now, but in order to write data to be transmitted in Multi-buffered mode, one must write to the LIN Transmit Buffer Register (LINTD0 and LINTD01), and NOT to the Transmit Data Buffer Register (SCITD), example: linREG->TDx[0] = 'A';

    I've copied the working code below for other readers that writes first in un-buffered mode then writes in buffered mode..

    Note that one must add #include "reg_lin.h" be able to access the LIN Multi-buffer registers.

    Thanks,

    -Joe

    ___________________________________

    #include "sci.h"
    #include "reg_lin.h"

    sciInit();

    while(!sciIsTxReady(scilinREG));
    scilinREG->TD = (uint32)'a';
    while(!sciIsTxReady(scilinREG));
    scilinREG->TD = (uint32)'b';
    while(!sciIsTxReady(scilinREG));
    scilinREG->TD = (uint32)'c';
    while(!sciIsTxReady(scilinREG));
    scilinREG->TD = (uint32)'d';
    while(!sciIsTxReady(scilinREG));
    scilinREG->TD = (uint32)'e';

    // Enable multi-buffer
    scilinREG->GCR1 |= (uint32)((uint32)1U << 10U); // MBUF_MODE, This lines stops things from working
    // Set transmission length
    scilinREG->FORMAT = 0x00070007; // LENGTH=8

    // Write to Multi-buffer registers
    linREG->TDx[0] = 'A'; // Write to Multi-buffer directly
    linREG->TDx[1] = 'B'; // Write to Multi-buffer directly
    linREG->TDx[2] = 'C'; // Write to Multi-buffer directly
    linREG->TDx[3] = 'D'; // Write to Multi-buffer directly
    linREG->TDx[4] = 'E'; // Write to Multi-buffer directly
    linREG->TDx[5] = 'F'; // Write to Multi-buffer directly
    linREG->TDx[6] = 'G'; // Write to Multi-buffer directly
    linREG->TDx[7] = 'H'; // Write to Multi-buffer directly

    ___________________________________________

    Output: