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.

TMS320F280049C: Lin Commander not send data while trasmitting header

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE

Tool/software:

hi expert's, need help

i am working on lin protocol while transmitting teh data with the header (break+sync+id+data+checksum) the data going to ignore just the header received. for your reference i upload teh code and the oscilloscope ouput for the same. also notice that after LIN_isTxReady check goin in while loop due to flag issue in the code function

static inline bool
LIN_isTxReady(uint32_t base)
{
    //
    // Check the arguments.
    //
    ASSERT(LIN_isBaseValid(base));

    //
    // Read Tx Buffer flag and return status
    //
    return((HWREGH(base + LIN_O_SCIFLR) & LIN_SCIFLR_TXRDY) ==
           LIN_SCIFLR_TXRDY);
}





please guide me.


code

#include "driverlib.h"
#include "device.h"
#include "lin.h"

uint16_t txData[3] = {0x11, 0x22, 0x33};

void main(void)
{
    Device_init();
    Device_initGPIO();

    /* pinmux for LIN A */
    GPIO_setPinConfig(DEVICE_GPIO_CFG_LINTXA);
    GPIO_setPinConfig(DEVICE_GPIO_CFG_LINRXA);

    SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_LINA);

    /* Initialize LIN module and set commander mode */
    LIN_initModule(LINA_BASE);
    LIN_setLINMode(LINA_BASE, LIN_MODE_LIN_COMMANDER);

    /* (Optional) enable parity if you want parity bits checked on the bus */
    LIN_enableParity(LINA_BASE);

    /* build ID with parity bits */
    uint16_t id = LIN_generateParityID(0x12);    // 0x12 is your 6-bit ID

    /* Frame length = 3 bytes */
    LIN_setFrameLength(LINA_BASE, 3U);

    while(1)
    {
        /* Set the ID byte (writing it initiates the header transmit in commander mode) */
        LIN_setIDByte(LINA_BASE, id);

        /* Send data block (sends the response field after the header) */
        LIN_sendData(LINA_BASE, txData);

        /* Wait for TX buffer to be ready before next transaction */
        while(!LIN_isTxReady(LINA_BASE)) { /* spin */ }

        DEVICE_DELAY_US(1000000); // 1 s between frames
    }
}
image only have break+sync+id not data
  • Hello,

    To confirm, you are sending a new header as wakeup signal, but this header is ignored? Please note that the SCIFLR.TXRDY is used to indicate when the transmit buffer is ready for the next transmission. This flag needs to be properly cleared and managed during transmission.

    • It looks like for data transmission sequence, your current code sequence is:
      • LIN_setIDByte(LINA_BASE, id);
        LIN_sendData(LINA_BASE, txData);
        while(!LIN_isTxReady(LINA_BASE)) { /* spin */ }
    • The recommended code is:
      • // First place data into transmit buffer
        LIN_sendData(LINA_BASE, txData);

        // Then set the ID to initiate header transmission
        LIN_setIDByte(LINA_BASE, id);

        // Wait for transmission to complete using TXRDY flag
        while(!LIN_isTxReady(LINA_BASE)) {
        // Optional: Add timeout mechanism
        }

    Have you already tried the above sequence and issue remained?

    Best Regards,

    Allison

  • hi Allison, Thank you for response 

    I tried both the way. your recommendation is metioned in example and I tried that also in that case i am observing pid(header) but no data is observed in bus.


    is response require from responder while sending header and then sendData works? i guess there is no any procedure ..!


    i also connect same board as respoder and check RxMatch its work but getData return empty to the RxData because data is not comming in bus only header trasmited and acknowledged.

  • Allison i am getting error while use ccs tool debugger, its regsister mapping problem?



    i selected right board you can see in ccs image of syscfg

    i have configured the 58 59 pin as my lin rx tx

  • Hello,

    What is the CCS and C2000Ware version you are using? Is this the case with other registers beyond LIN? Do the registers populate when you add them into the expression window?

    Best Regards,

    Allison

  • CCS Version : 20.3

    C2000Wave : 6.0

    othere registers like core(PC, ACCUMULATOR) all working fine just lin registers are not getting .


    is there is a problem of .gel? shown in the discussion. 


    after changing it from 3 to 1 i can get the access of the registers.



    one problem i see i am sending {0x11, 0x22, 0x33} as mentioned in code but reflaced 0x33 only in location TD0 and TD2 not got any other data 

    as in sendData is function use 3U for the location of TD registers but in my case going wrong 

  • Hello,

    Just to verify, are you able to run the F28004x loopback example successfully without modification? What are your LIN initialization configurations?

    Best Regards,

    Allison

  • the demo code for intrrnal loopback works i  tried by disabling it and conect externally rx tx pin (sorting) that also works. 

    below is the project which i am trying my linA is active in commander mode with pin 58 59 and the baudrate is 9600. i applied internal pulled up to rx and external pullup to lin data of the converter ic TLIN1021A-Q1

    lin_commander.zip

  • Hello,

    Good to know that the example works for you. I would recommend comparing your own project to the reference code in terms of init and flow. Please allow another 1-2 days for me to take a brief look over your project as well.

    Best Regards,

    Allison

  • Hi Allison any updates 

  • Hi Umang, 

    Thanks for you patience. I am still taking time to review your project and will follow up tomorrow. Please let me know if there is any change or update based on your analysis as well.

    Best Regards,

    Allison

  • Allison i see in the datasheet one register call SCIGCR1 configure the lin protocol in f280049c i debuged it with ccs i found that in the register the bit of TXENA and RXENA not going to 1 while lin_init runs. i manually set it 1 but still i cant send the extended frame (header+data) just header transmit. Take your time and please help me to fix it. 

  • Hello,

    I have yet to find an issue with your current code implementation. Can you please describe your hardware connections? Are you looping back the header that is being transmitted from f280049c? The question has actually come up previously, but it was resolved with proper LIN hardware connection - see the resolution answer in this previous E2E  LAUNCHXL-F280039C: lin_ex7_external_loopback .

    Best Regards,

    Allison

  • Hi allison, my problem was resolved with that solution (by putting LIN_enableExtLoopback(LINA_BASE, LIN_LOOPBACK_ANALOG, LIN_ANALOG_LOOP_TX)).

    Thank you for your help.

    Best Regards,

    Umang Gajjar