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.

TMS320F280049: We use the LIN communication function in the TMS320F280049 chip to find data frame loss problem.

Part Number: TMS320F280049


dear team:

We use the TMS320F280049 chip to realize the reception and transmission of LIN multi-ID signals from the main node. It is found that the data is occasionally loss.

Our questions are:

1. The transmission/reception of the slave nodes are multiple IDs. For example, the IDs written by the master node are 0X06 and 0XD8, and the IDs read by the master node are 0X03, 0X85, 0X99, 0X1A. How do I set LIN_setIDSlaveTask? ), LIN_setTxMask() and LIN_setRxMask()? Currently our setup is as shown:

my code:

LIN_setIDSlaveTask(LINA_BASE, 0x01);
LIN_setTxMask(base, 0x9FU);
LIN_setRxMask(base, 0xDEU);

2. The data lengths of different ID transmissions are inconsistent. For example, the data lengths of 0X03, 0X85 and 0X99 are both 8 bytes, and the data length of 0X1A is 4 bytes. How should I set LIN_setFrameLength()? At present, we set it as follows: Will it cause data to be dropped?

my code:   

         switch(RXID.byte2)
         {
             case 0x99:
                 LIN_setFrameLength(LINA_BASE, 7U);
                 CANBUSOFFPARA.OvertimeCntTX_19=0;
                 HVSC_0x19TrmManage();
                 break;
             case 0x1A:
                 LIN_setFrameLength(LINA_BASE, 4U);
                 CANBUSOFFPARA.OvertimeCntTX_1A=0;
                 HVSC_0x1ATrmManage();
                 break;
             case 0x85:
                 LIN_setFrameLength(LINA_BASE, 8U);
                 CANBUSOFFPARA.OvertimeCntTX_05=0;
                 HVSC_0x05TrmManage();
                 break;
             case 0x03:
                 LIN_setFrameLength(LINA_BASE, 8U);
                 CANBUSOFFPARA.OvertimeCntTX_03=0;
                 HVSC_0x03TrmManage();
                 break;
             default: break;
         }

In summary, we believe that the data dropped by the above two points: 1, the filter mailbox settings are unreasonable; 2, frequently set the data frame length.

Please give your suggestions or comments, thank you very much.

Yj

 

  • Hi Yj,

    Couple of suggestions:

    1. Instead of setting "SlaveTaskByte" you need to set "IDBYTE".

    2. Based on valid ID that you mentioned for transmit and receive, the value of identifier should be "0x00" and not "0x01".

    You can change following line in your code and try to see if data gets transmitted or not.

    LIN_setIDSlaveTask(LINA_BASE, 0x01); change this to LIN_setIDByte(LINA_BASE, 0x00);

    Regards,

    Nirav

  • Hi Nirav:

    Based on your suggestion, I modified the code, but there is still a data loss issue.

    My questions are:

    1、According to the test result, I found that the length of the data frame must be set before processing the data received from the ECM.

    E.g:

    LIN_setFrameLength(LINA_BASE,7);
    RXID.byte1=LIN_getRxIdentifier(LINA_BASE);
    switch(RXID.byte1)
    {

    case 1:

    ......

    }

    However, the length of the data sent by the master node corresponding to different IDs is inconsistent. For example, when the ID is 0xD8, the data length is 1; when the ID is 0x06, the data length is 7; I set it according to the following code, and there is still data loss. 

    my code:

    if (LIN_isRxReady(LINA_BASE))

    {

    switch(RXID.byte1)
             {
                 case 0xD8:
                     LIN_setFrameLength(LINA_BASE, 1);
                     CANBUSOFFPARA.OvertimeCntRX_18=0;
                     HVSC_0x18RcvManage();
                     break;
                 case 0x06:
                     LIN_setFrameLength(LINA_BASE, 7);
                     CANBUSOFFPARA.OvertimeCntRX_06=0;
                     HVSC_0x06RcvManage();
                     break;

               default:

    break;

    }

    }

    Excuse me, for this data length is inconsistent, resulting in frequent frame length setting, how to solve the data loss problem?

    Regards,

    Yj

  • Hi Yj,

    Few questions:

    1. What is the LIN standard for communication?

    2. When you say data is loss, are you getting any error?

    3. What is the baud rate?

    4. When the frame length is 1, are you reading RD0 or RD1?

    Regards,

    Nirav

  • Hi Nirav:

         thanks for your answer.

    The first question: we are using  LIN 2.1 standard.

    The second: When the data is losing,it will report frame error.

    The third:  the baud rate is 19.2 kbs

    The last : When the frame length is 1,  you are reading RD0. 

       It is any different for reading RD0 or RD1?

      If we use the single-buffer mode. The RXRDY flag will be set each time we receive one byte data, right or not?

    when we receive 7 bytes data The RXRDY flag will be set seven times. when we receive 1 bytes data The RXRDY flag will be set one time. So we can use RXRDY flag  to solve this problem.

  • Hi Yj,

    RXRDY flag will be set when the received bytes matches the frame length.

    Can you provide the register dump of all LIN registers when it reports frame error?

    Thanks,

    Nirav

  • Hi Nirav:

         thanks for your answer.

     If we need receive different length frames,how should i set the legth,using the function :LIN_setFrameLength(LINA_BASE, length)?

    Regards,

    YJ

  • Hi Yj,

    Yes, you should be able to set the length of the frame using LIN_setFrameLength(LINA_BASE,length);

    Regards,

    Nirav

  • Hi Yj,

    Can you please close this thread, if the issue is resolved?

    Regards,

    Nirav