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.

TMS570LC4357: LIN master mode

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi,

I am trying to use the LIN in master mode. I have a microcontroller as a slave which I can send a message to with "linSendHeader(linREG1, 0x28)". However, when I send the response to the master, the (linREG1->FLR & LIN_RX_INT) == LIN_RX_INT) does not hold. However, when I send the response as a [break, sync, ID, data] sequence, it is detected and the data bytes are set in the RDx register.

I have two questions:

1) Do I need a special tranceiver to use the TMS570LC4357 board as master?

2) Shouldn't the master be able to detect the response just as data (i.e. there should be no need for break, sync, ID sequence), however, it seems to be so, or else it is acting as a slave...

Thanks

SA

  • Hello SA,

    The LIN cluster consists of a single master device and one or more slave devices. The master device contains both a master task and a slave task. Each slave device contains only a slave task. Communication over the LIN bus is controlled entirely by the master task in the mask device. The LIN transfer frame is divided into header and response. The header (break-sync-ID) is always transmitted by the master mode. The response which is transmitted by a slave task consists of a data payload and a checksum only, doesn't include no break-sync-ID.

    The LIN transceiver is required to interface the LIN controller and the LIN physical bus.
  • Hi QJ,

    Does this mean when I set LIN1 in TMS570LC4357 as master, it can also receive frames as slaves (i.e. detect the break, sync, ID ... sequence)? If so and I want to use it as master, how can I receive payload+checksum using the Halcogen's generated API? I see there is a function linGetData(linREG1, data), but this only worked when I sent the whole frame (including header).

    Can all this be because I am not using a transceiver connected to the Hercules board?

    I have a http://skpang.co.uk/catalog/linbus-breakout-board-p-1417.html 

    If I connect this as master to my Hercules LIN1 pins, will I be able to receive payload+checksum response, after I have sent a header to a slave node?

  • Hello SA,

    Any slave, including the slave task in the master control unit, can respond with a data frame. Only one slave can respond to each identifier.

    The master can transfer data to any number of slaves through its slave task. i.e. the master’s slave task responds to a header (sent by the master task of master) and transmits data on to the bus. All other slaves can simultaneously receive the data frame.

    Yes, linGetData(linREG1, data) can be used to receive data. I am not sure if the LIN module can get the correct data without the LIN transceiver.

  • Hi QJ,

    Thanks for the response, it gives some insight on how to design master node. However this did not answer my question. I had trouble receiving data+checksum on master because I was not using the transceiver in master mode.

    Best,

    SA

  • Hello SA,

    The LIN transceiver is required for LIN module (in MCU) to interface the external LIN bus.

    The LIN message header is sent by the master task, and used for synchronization. The message response is sent by a slave task, and the message response contains the data and the checksum. The payload is 1 to 8 bytes. Your issue might be caused by the lack of the LIN transceiver in your LIN network.

  • Hi QJ,

    Yes that was my problem as I already explained. I have another issue now. When I use the linSend() function from HL_lin.c, does this cause sending the checksum as well? I can see in the documentation that the transmit and receive buffers (SCITXSHF, SCIRXSHF)have checksum calculator. Does this mean the checksum gets sent after 1 to 8 data byte automatically and I do not need to calculate and send the checksum to the LIN bus?

    SA

  • Hello SA,

    The the checksum is automatically embedded each time the send checksum bit SC is set. You don't need to calculate the checksum and send the checksum separately.
  • Hi QJ,

    I have another question now. When I try the linsend() function I can see the same data on both RDx and TDx. Why and how does RDx get the data I am sending out? My node is configured as master (this only happens when I have a connection to RX pin on the board, i.e. a wire going out from RX pin to LIN transceiver).

    Also there is no possibility to enable the TX interrupt on HALcogen. Does this mean I do not need to implement the ISR for TX?

    Best,

    Sahar

  • Hello Sahar,

    The LIN mode has a feature of monitoring the bit transmitted. The bit monitor ensures that the transmitted bit in LINTX is the correct value on the LIN bus by reading back on the LINRX pin.

    In LIN mode, 15 interrupts are supported. A transmit interrupt (TX interrupt) occurs after transmitting a response. You need set the 8th bit to enable the TX interrupt of SCISETINT (offset=0x0C) manually.
  • HI QJ,

    OK, how can I disable this reading back the TX? If I am not sending anything to the RX pin, I would like the buffer to be empty.

    Best,

    SA

  • Hi SA,

    BTW, all the slave nodes on the LIN cluster will read the bus data into their buffer to decode it. As a master, it consists of a master task and a slave task, the transmitted data (master task) will be written to RX buffer (slave task) from the LIN bus. I don't think we can enable and disable it.
  • HI QJ,

    Yes I figured it out after playing with different flags, since master node should also support slave mode, it always gets the data on the bus, even if it is sent by itself!

    Best,

    Sahar

  • Hello SA,

    The LIN message on LIN bus will shift into the RX buffer automatically. We are not able to disable it.