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.

Timing error on Auto-baud-rate / LIN sync delimiter

Other Parts Discussed in Thread: MSP430G2553

Got a very strange error here, on an MSP430G2553, which is currently being programmed up to support LIN Bus 

Having setup the UART for 19k2 operation with auto-baud rate, transmitting the 0x55 sync byte works, but the timing is way out on the sync delimiter, as shown in the attached picture. For 19k2 operation, bit width is correct at 52uS, the start delimiter is correct at 13 bits width, but the sync delimiter comes in at 16bits width, instead of the 1bit it should be.

Although not strictly a violation of the LIN spec, it's certainly a bit strange considering UCDELIM settings indicate a 1bit period.

Anyone any ideas?

Code is attached (cut and paste to show settings only)

///////////////////////////////////////////////

//UART setup

///////////////////////////////////////////////

UCA0CTL1 |= UCSWRST;

UCA0CTL0 = UCMODE_3;

UCA0CTL1 = UCSSEL_2 + UCSWRST;

UCA0BR0 = 52;

UCA0BR1 = 0;

UCA0MCTL = UCBRS0;

UCA0CTL1 &= ~UCSWRST;

///////////////////////////////////////////////

//Transmit sync byte

///////////////////////////////////////////////

UCA0CTL1 |= UCTXBRK;

UCA0TXBUF = 0x55;

//time delay in here due to state machine

UCA0CTL1 &= ~UCTXBRK;

///////////////////////////////////////////////

  • Hello Matthew,

    i am working on MSP430F2553 microcontroller.

    i have set up the UART to LIN format and transmitting the data efficiently.

    but i need to receive data from slave side in LIN format into UART buffer register (UCA0RXBUF) which is a 8 bit register.

    is there any particular set up need to be done to receive data in LIN format.

    Regards,

    Sanath Rai

  • Sorry, this is so old I can't remember!!

    Mat
  • LIN uses a normal UART. Besides the special events like SYNC or BREAK, which are detected and notified by special control bits, the data transmission is always 8 bit with start and stop bit. Even though the individual LIN data may have more bits, they are broken down into 8 bit at a time, sending upper 8 bits (?) first, then the lower 8 bits. And the receiver needs to assemble them the opposite order: first byte received as upper 8 bits, second byte as lower 8 bits of a 16 bit data etc.

**Attention** This is a public forum