infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 2 of 2

Thread: LIN on xmc4800

  1. #1
    Beginner Beginner j_aug is on a distinguished road
    Join Date
    Feb 2018
    Posts
    3
    Points
    60

    LIN on xmc4800

    Hi, I am trying to do some modifications for uart drivers for xmc4800 (on relax kit xmc 4800) and extending them to LIN drivers.
    When I followed the documentation of Infineon reference manual for LIN support, in page 18-72 under
    18.3.5 Hardware LIN Support gave some explaination as follows:


    A complete LIN frame contains the following symbols:
    • Synchronization break:
    The master sends a synchronization break to signal the beginning of a new frame. It
    contains at least 13 consecutive bit times at 0 level, followed by at least one bit time
    at 1 level (corresponding to 1 stop bit). Therefore, TBUF11 if the transmit buffer is
    used, (or IN11 if the FIFO buffer is used) has to be written with 0 (leading to a frame
    with SOF followed by 12 data bits at 0 level).
    A slave device shall detect 11 consecutive bit times at 0 level, which done by the
    synchronization break detection. Bit PSR.SBD is set if such an event is detected and
    a protocol interrupt can be generated. Additionally, the received data value of 0
    appears in the receive buffer and a format error is signaled.

    Following that I have made changes in the following lines of code.


    Code:
    if ( !(USIC_CH_TCSR_TDV_Msk & tmp_pChannel->TCSR) )
        {
          tmp_pChannel->TBUF[0] = ((arg_ByteToSend << USIC_CH_TBUF_TDATA_Pos) & USIC_CH_TBUF_TDATA_Msk);
        }
    into following lines of code


    Code:
    int j =0;
            		      while(j<12)
            		      {
            		    	//tmp_pChannel->TBUF[j] &= ~(1 << tmp_pChannel->TBUF[j]);
            		    	tmp_pChannel->TBUF[j]=0;
            		    	j++;
            		      }
    Code:
    if ( !(USIC_CH_TCSR_TDV_Msk & tmp_pChannel->TCSR) )
        {
          tmp_pChannel->TBUF[12] = ((arg_ByteToSend << USIC_CH_TBUF_TDATA_Pos) & USIC_CH_TBUF_TDATA_Msk);
        }

    But I am unable to generate break field for LIN following the documentation. Can anyone help in this.

  2. #2
    Advanced Advanced
    Infineon Employee
    Infineon Employee
    DRubeša will become famous soon enough
    Join Date
    Jul 2016
    Location
    München
    Posts
    151
    Points
    2042.5
    Hi,

    this TBUF11 you need to undestand quite directly so, the idea is not to fill TBUF from 0 to 11 with 0, but to write TBUF11 with 0 and that should be it. How does this work? Ever TBUF or IN buffer if you use FIFO encodes also the TCI based on the address on a buffer. Search for "18.2.5.3 Transmit Control Information" chapter for more details, but in short; TBUF0 has TCI of 0b00000, TBUF1 has TCI of 0b00001, and finally TBUF31 has TCI of 0b11111. This TCI information contains some additional configuration settings that can be used dynamically. Which setting are effect by TCI you can find in the mentioned chapter but what is important for you is FLE. That is data frame length. To be able to use this feature, you should enable bit TCSR.FLEMD. This is exactly the first sentence of the "Hardware LIN support" chapter that you also quoted:

    In order to support the LIN protocol, bit TCSR.FLEMD = 1 should be set for the master.
    Now that bit TCSR.FLEMD is enabled, data frame length will be dynamically set and the value which will be set is the value that TCI contains...in this case it is 11 so that means "please write to the bus 11 consecutive bit times at 0 level". And as you already noticed this is exactly what the LIN slave expects.

    Best regards,
    Deni
    Last edited by DRubeša; Feb 13th, 2018 at 06:48 AM.
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

+ Reply to Thread
Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.