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.

TMS320F2800156-Q1: LIN TXEMPTY bit not set issue

Part Number: TMS320F2800156-Q1

Hi Champ,

Customer do noise injection testing on LIN BUS, and found sometime after noise injection testing , even the LIN BUS become normal(no noise on the BUS) , the TXEMPTY bit will always 0, will never set .

Issue can be reproduce by connect LIN BUS to GND  for several times.

You can refer to below picture for SCIFLR status.

Customer code will judge this bit before send data, if this bit is 0 , then the code will not send data, so the LIN communication failed, but under this situation ,  LIN receive ISR still can enter normally.

Could you advise the root cause or possibility why TXEMPTY not set ?

  • Hello,

    I have a few questions before I can offer any recommendations:

    Are they operating the LIN module in LIN mode or SCI mode?

    If operating in LIN mode, is the F280015x operating as the commander or responder in this case?

    Do they have multibuffering enabled or disabled?

    Best Regards,

    Delaney

  • Delaney,

    customer use LIN mode , F280015x as responder ,and enabled multibuffer.

  • Hi Huihuang,

    Thank you for the clarification. I believe the TXEMPTY flag will only go back high in this case when there is no data left in the LINTD0 and LINTD1 registers. From the screenshot, these registers seem to be full still, so their code is stuck in this state.

    I suggest they poll the TXRDY flag in their code instead. They can optionally use an interrupt-based approach with the TXRDY flag which is also usually a better option as opposed to polling (which wastes CPU cycles).

    Best Regards,

    Delaney

  • Delaney,

    I under TXRDY  flag can be use !

    My question is could you advise the root cause or possibility why TXEMPTY not set ?

    If you thinking due to  data left in the LINTD0 and LINTD1 registers, then why the  data always in  LINTD0 and LINTD1 registers?

    The LIN bus already free!

  • Hi Huihuang,

    I will check with the design team to understand the reasoning behind this.

    Best Regards,

    Delaney

  • Hi Huihang,

    By design, the TXEMPTY flag will be set when all of the contents of the LINTD are moved into the LIN shift register and the shift register is emptied. Since from your screenshot it appears that the LINTD registers still have data leftover, this would be why the flag isn't getting reset. Can you explain more about what kind of noise is being injected on the LIN bus and how the customer is handling this errored case in software?

    Best Regards,

    Delaney

  • Delaney,

    Issue can be reproduce by connect LIN BUS to GND  for several times.

    Customer will clear the error flag.

    You still didn't explain why error bit are 0 , but LINTD registers still have data  leftover.

  • Hi Huihang,

    The data from the TD buffer will be transmitted when the programmed number of bytes are present. From looking at the SCIFORMAT register, the programmed number of bytes should be 8. If the TD buffer is only filled with 7 bytes before the error occurs (which it looks like is the case since the highest byte in the TD0 register isn't filled), then it will need to have the last byte written to the TD buffer before it will transmit the frame. This transmission will then set the TXEMPTY flag.

    Best Regards,

    Delaney

  • Hi Delaney,

    How we know TD buffer is only filled with 7 bytes ?

    Customer will write 8 bytes to TD buffer  every time!

  • Hi Huihuang,

    Looking at the screenshot from your original post, the LINTD1 register is full of the following data: 0xFFFFFFFF and the LINTD0 register only has the least significant 3 bytes full: 0x00C0FFFF. It could be that in their program wasn't finished writing all 8 bytes when the noise was injected, resulting in this state where there are only 7 bytes present. I would suggest they clear the TD registers whenever they detect noise on the bus to keep their program from getting stuck in this errored state.

    Best Regards,

    Delaney

  • Hi Delaney,

    I want to know why the highest bytes 0x00 can indicate just 7 bytes in TD registers?

    Any register can be use to determine  how many bytes data already write to TD registers?

  • Hi Huihuang,

    Both the LINTD0 and LINTD1 registers have 4 bitfields of 8-bits each corresponding to each byte of LIN data to transmit. In the original screenshot, the top byte of the LINTD0 register is empty (TD0), whereas the other bytes in LINTD0 are filled, and all of LINTD1 is filled. This errored case could happen if noise is injected at other amounts full as well, and would cause the same issue. 

    There is a counter that keeps track of how many bytes full the LINTD buffer is, but this is internal to the design and can't be viewed in a register. They could potentially read the LINTD0 and LINTD1 registers in the errored case to see how much data is waiting to be transmitted. I would still suggest clearing the data from the buffer when noise is injected though.

    Best Regards,

    Delaney

  • Delaney,

    I still not understand why TD0 is 0x00 means empty,  0x00 could be the data that customer want to send.

    Another question is how to clear the buffer ? just write 0x00 to LINTD0 and LINTD1?

  • Hi Huihuang,

    Technically yes 0x00 in TD0 could be data, but since the frame is never getting transmitted, it is fair to assume that this byte was instead never written. Once this byte in TD0 is written, all the data will be shifted out of the register and therefore the registers will be cleared by the LIN module. Yes, they can clear the other bytes in LINTD0 and LINTD1 by writing 0x00 in the errored case.

    Best Regards,

    Delaney