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.

CCS/TMS570LS1224: TMS570 LIN driver

Expert 1660 points

Part Number: TMS570LS1224

Tool/software: Code Composer Studio

Hello is anybody expert with LIN protocol could give a hand.

i have this LIN packet 

1)write frame : break+syn+PID(0x78) +data1(0x01)+data2(0x02)+checksum

2)delay 1s

3)the response frame (read frame) :break+syn+PID(0x03) which must return 8 data bytes.

#include "lin.h"
#include "sys_core.h
#include "sys_common.h"
#include "system.h"


uint8  TEXT1[2]= {0x01,0x02};
uint8 TEXT2[8]= {0};


void main(void)
{


    /* Enable interrupts. */
    _enable_IRQ();

    linInit();

    /* Checking that Tx is ready and also if the LIN bus is free (Checking BUSY flag) */
    while((!(linIsTxReady(linREG))) || (linREG->FLR & 0x8U == 0x8U));

    /*Send lin header including sync break field, sync field and identifier. */
    linSendHeader(linREG, 0x78);
         linSetLength(linREG,2);
    /*Send data TEXT1 */
     linSend(linREG,&TEXT1[0]); 

    __delay_cycles(80000000); 

//set the length of the response data
   linSetLength(linREG,8);
   linSendHeader(linREG,0x03);

   
}
 /* USER CODE BEGIN (4) */
 void linNotification(linBASE_t *lin, uint32 flags)
 { 
    /*Data is read from RD register and stored in TEXT2. */
     if((linREG->FLR & LIN_RX_INT) == LIN_RX_INT)
     { 
    linGetData(linREG, TEXT2);
     } 
} /* USER CODE END */

 is there any mistake in writing the code.

i have two problems

1)can't see any transmitting data of linSend(); on oscilloscope  .just when enabling the loopback i can monitor the data on oscilloscope 

2)i can't receive any data from slave. 

3)do i need to use setlength before write the header of the response data as i wrote a bove.

or just it used before sendlin function??

these are my lin configurations 

/** - Enable LIN Mode */
linREG->GCR1 = 0x40U;

/** - Setup control register 1
* - Enable transmitter
* - Enable receiver
* - Stop when debug mode is entered
* - Disable Loopback mode
* - Enable HGENCTRL (Mask filtering with ID-Byte)
* - Use enhance checksum
* - Enable multi buffer mode
* - Disable automatic baudrate adjustment
* - Disable sleep mode
* - Set LIN module as master
* - Disable parity
* - Disable data length control in ID4 and ID5
*/

linREG->GCR1 |= 0x03020C40U
| (uint32)((uint32)1U << 12U)
| (uint32)((uint32)0U << 2U)
| (uint32)((uint32)1U << 5U);

and i worked with 10k baud-rate