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.

TMS570LS1224: LIN protocol between two MCUs - ID read, but no data send in response

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN, TPIC1021

Hi,

I'm trying to communicate between two MCUs using LIN. The first controller (tms570ls1224 - master) sends the header to the second controller (tms570ls043 - slave).

The ID is received correctly by the slave. After receiving the ID, the slave should send data to the master. Unfortunately, the master does not receive any RX flags.

I set drivers in halcogen. LIN_ID_INT interrupts on the slave side and LIN_RX_INT on the master side. The frame has the same number of bits configured, the same speed in both cases.

Below I attach a simple code that I use for communication.

Any tip welcome.

// MASTER 

int main(void)
{
/* USER CODE BEGIN (3) */
    _enable_IRQ();

    gioInit();

    linSetLength(linREG, 8);

    linInit();

    while((!(linIsTxReady(linREG))) || (linREG->FLR & 0x8U == 0x8U));

    linSendHeader(linREG, 0x3D);

    while(1);

/* USER CODE END */
}


void linNotification(linBASE_t *lin, uint32 flags)      
{
/* USER CODE BEGIN (23) */
    linGetData(linREG, getData_ptr);

/* USER CODE END */
}

// SLAVE

int main(void)
{
/* USER CODE BEGIN (3) */
    _enable_IRQ();

    linSetLength(linREG, 8);

    linInit();

    while(1);

/* USER CODE END */
}


void linNotification(linBASE_t *lin, uint32 flags)      
{
/*  enter user code between the USER CODE BEGIN and USER CODE END. */
/* USER CODE BEGIN (23) */

    linSend(linREG, send_example_ptr);
    get_id = linGetIdentifier(linREG); //is used to validate the ID

/* USER CODE END */
}

  • Hello,

    Did you check the data on LIN bus? I's like to know if the slave transmitted the data successfully.

  • I checked the bus line. The master sends the header and the slave receives it correctly. 
    When the ID flag appears, an interrupt occurs and the slave should send data. (The application comes into interruption, I can see it using a breakpoint.)
    Unfortunately, no data sent from the slave appears on the bus line. I checked alco directly LIN_TX pin and nothing appears there.

    I also tried to send frames from the master in a loop. The first header and data are sent, but the others are not. The program hangs because there is no flag indicating that data can be sent (TX flag). 
    This is probably one reason why data from the slave is also not sent. Given that the header is sent correctly it is probably a matter of setting one of the registers and not the hardware. 

    Should I set some registry to keep the line low while waiting for data? If so, where? 
    Maybe it's a matter of something else in code/register. 
    Waiting for your help.

    Paulina

  • I use TPIC1021 as a lin transceiver. I have 2 devices (one as slave and the other as master).
    I noticed that the PBE flag appears when sending the header from the master (on master device). I wonder why because the slave receives the ID correctly. 

    Is it possible that the header is received correctly when this flag appears, but the rest of the data is not?

    Paulina 

  • Hello Paulina,

    I am sorry I don't have LIN network setup at this moment. I did test before the master can send header and data periodically.

    The PBE flags means there is LIN bus error. The LIN network won't work as expected.

    Please check if there is any shortage to Vbat or GND.

    Note: The PBE will only be flagged, if no Synch Break can be generated (for example, because of a bus shortage to VBAT) or if no Synch Break Delimiter can be generated (for example, because of a bus shortage to GND).

  • Thanks for your answer.

    To check if the problem is in hardware I removed the diode and resistor from between Vsup and LIN bus. 
    Theoretically I have 2 the same systems. At the first connection I received a header on the msu slave side and PBE on the mcu master side. Then I switched TPICs and did not receive the header anymore. 

    According to datasheet TPIC, the diode and resistor between Vsup i LINBUS are optional, so can the circuits be identical to work properly? 

  • Hello Paulina,

    According to the LIN specification, the master node requires an external pull-up resistor and diode. The typical pull-up resistor value is 1 kΩ in series with a diode – for reverse-polarity protection – connected to the battery voltage.

    The typical pull-up value of the LIN slave is 30 kΩ, and in all modern LIN transceivers, this is integrated within the IC, so no external pull-up is necessary in the slave configuration. 

  • The device comes with an integrated 30-kΩ pullup resistor and series diode for slave applications, and for master
    applications an external 1-kΩ pullup with series blocking diode can be used. ---> It just says it can bu used, not must. (page 13 of datasheet)
    But at the first page says that diode and resisotr are required, somewhat contradictory information. 

    In the recessive state the LIN bus is pulled high by the TPIC1021’s internal pull-up resistor (30 kΩ) and series diode, so no external pullup components are required for slave applications. (page 1)
    In summary, I should use the diode and the resistor only the case of the master circuit, the slave has them built in, right? 

    Can you tell what a properly connected system should look like? 

    At the moment I have connection like below for both slave and master (plus D2 i R5 only for master mode).
    No D1 and D3 in both configuration. 

    Paulina

  • Hello Paulina,

    Yes, you should use external Resistor+Diode for master. 

  • you need to scratch the line between lin RX and the debugger in the development kit 

  • Hello Paulina,

    Have you tried Ahmad's suggestion? 

  • Hi, 

    What do you mean by scratching?
    Should I cut off the connection between LIN_RX and the debugger completely?

    Paulina

  • I do not unterstand why I would cross this line.
    When choosing the LIN module instead of SCILIN, the appropriate configuration should be generated in HalCoGen that takes into account the correct connection? 

    Paulina

  • Hello Paulina,

    I am not sure if SCI of TM4C129 on Launchpad impacts the LIN communication. I remember Mr. B.M. tested his LIN code on Launchpad, so I suggested you to try his recommendation. I assume you have solved the issue.