TLIN2029EVM: TLIN2029EVM interfacing with LaunchXL-F28P65X

Part Number: TLIN2029EVM
Other Parts Discussed in Thread: C2000WARE, SYSCONFIG, LAUNCHXL-F28P65X

Tool/software:

Hello TI Team,

I am working to establish LIN communication between the Commander and Responder using the TLIN2029EVM and the LaunchXL F28P65X development board.

Currently, I am utilizing the C2000-Ware example for external loopback (LIN_ex7). The power is supplied externally with VBAT at 12V and a current of approximately 10mA and 5V input VCC on the EVM.

On the hardware setup, I have connected the TVS diode (D3) on  the Commander side. I have also unplugged jumper JMP4 on the Responder side, and the respective configurations for both devices have been implemented.

I would appreciate any suggestions or recommendations to help ensure successful LIN communication.

Below, I have included the example code I am working with:

//
// Included Files
//
#include "driverlib.h"
#include "device.h"

//
// Defines
//
#define FRAME_LENGTH 0x8
#define LIN_PASS 0xABCD
#define LIN_FAIL 0xFFFF

//
// Globals
//
volatile uint32_t level0Count = 0;
volatile uint32_t level1Count = 0;
volatile uint32_t vectorOffset = 0;
uint16_t result;
uint16_t error;
uint16_t txID = 0x1A, rxID = 0x1A;
uint16_t txData[8] = {0x11, 0x34, 0x56, 0x78, 0x9A, 0xAB, 0xCD, 0xEF};
uint16_t rxData[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};


//
// Main
//
void main(void)
{
uint32_t dataIndex;
uint16_t error;

//
// Initialize device clock and peripherals
//
Device_init();

//
// Initialize GPIO and configure GPIO pins for LINTX/LINRX
//
Device_initGPIO();
GPIO_setPinConfig(DEVICE_GPIO_CFG_LINTXA);
GPIO_setPinConfig(DEVICE_GPIO_CFG_LINRXA);
GPIO_setPinConfig(DEVICE_GPIO_CFG_LINTXB);
GPIO_setPinConfig(DEVICE_GPIO_CFG_LINRXB);

GPIO_setDirectionMode(DEVICE_GPIO_PIN_LINRXA, GPIO_DIR_MODE_IN);
GPIO_setPadConfig(DEVICE_GPIO_PIN_LINRXA, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_LINRXA, GPIO_QUAL_ASYNC);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LINRXB, GPIO_DIR_MODE_IN);
GPIO_setPadConfig(DEVICE_GPIO_PIN_LINRXB, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_LINRXB, GPIO_QUAL_ASYNC);

GPIO_setDirectionMode(DEVICE_GPIO_PIN_LINTXA, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(DEVICE_GPIO_PIN_LINTXA, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_LINTXA, GPIO_QUAL_ASYNC);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LINTXB, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(DEVICE_GPIO_PIN_LINTXB, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_LINTXB, GPIO_QUAL_ASYNC);

//
// Initialize the LIN module
//
LIN_initModule(LINA_BASE);
LIN_initModule(LINB_BASE);

//
// Set LIN B to responder Mode, LIN A to Commander Mode
//
LIN_setLINMode(LINB_BASE, LIN_MODE_LIN_RESPONDER);
LIN_setLINMode(LINA_BASE, LIN_MODE_LIN_COMMANDER);


LIN_enableParity(LINA_BASE);
LIN_enableParity(LINB_BASE);

//
// Set the ID to match while receiving
//
LIN_setIDResponderTask(LINB_BASE, rxID);
LIN_setIDByte(LINB_BASE, rxID);

//
// Set the frame length (number of bytes to be transmitted)
//
LIN_setFrameLength(LINA_BASE, 8);
LIN_setFrameLength(LINB_BASE, 8);

//
// Write data to Tx Buffer of LINA
//
LIN_sendData(LINA_BASE, txData);

//
// Set the message ID to initiate a header transmission.
// This causes the ID to be written to the bus followed by the
// data in the transmit buffers.
//
txID = LIN_generateParityID(txID);

LIN_setIDByte(LINA_BASE, txID);

//
// Wait until Transmit buffer is empty and has completed transmission
//
while(!LIN_isTxBufferEmpty(LINA_BASE));

//
//Wait for the Reception
//
while(!LIN_isRxMatch(LINB_BASE));

LIN_clearInterruptStatus(LINA_BASE,LIN_INT_ALL);
LIN_clearInterruptStatus(LINB_BASE,LIN_INT_ALL);

//
// Read the received data in the receive buffers
//
LIN_getData(LINB_BASE, rxData);

//
// Verify the transmitted data matches the received data
//
for (dataIndex=0; dataIndex < 8; dataIndex++)
{
if (rxData[dataIndex] != txData[dataIndex])
{
error++;
}
}

//
// Check if any data errors occurred
//
if(error == 0)
{
result = LIN_PASS;
}
else
{
result = LIN_FAIL;
}

//
// Example completed. Check "result" variable for completion status.
//
asm(" ESTOP0");
}

//
// End of File
//

  • Hi Yash,

    I would recommend to utilize the user’s guide as much as possible while ensuring the pull-up is only active for the commander node by ensuring  only one termination per end of the bus, both the LaunchXL’s ground and the TLIN2029EVM’s ground are tied together and VCC is supplied. Please let me know if any specific issues observed, thanks. 



    Best Regards,

    Michael. 

  • Hi Michael

    Yes I've considered this while configuring the setup. I've read the manual(LINK ) and according to it setup the hardware for LIN commander and slave communication.

    the pull-up is only active for the commander node by ensuring  only one termination per end of the bus, both the LaunchXL’s ground and the TLIN2029EVM’s ground are tied together and VCC is supplied.

    But this doesn't work. And could you please suggest how can I set up the baud rate in the code.

    I am working with C2000Ware version: 5_02_00_00

    Regards,

    Yash

  • Hi Yash,

    I have gone ahead to move the thread to the MCU's group for the appropriate expert to help in configuring the C2000Ware for you, thanks.

    Best Regards,

    Michael.

  • Hi Michael,

    Sure thank you, hope that might help me to setup the communication successfully. As the hardware setup is aligned here according to the reference manual. 

    Now seeking for the software setup need to work in conjunction with the hardware.

    Best Regards

    Yash

  • LAUNCHXL_P65X

    Above is LaunchXL_P65X connections

    Above is LIN_Responder


    Above is LIN_Commander

    Please find the hardware setup reference images.

    Best Regards

    Yash

  • Hi Yash,

    Once you have the GPIO pins configured appropriately, no additional software setup is needed. You can test LIN communication as per your requirements.

    Regards,

    Arnav

  • Hi Arnav, 

    According to the default GPIO Configurations I have made the connections. In the code provided by TI C2000Ware for external loopback ex_7 the GPIOs are as follows:
    LIN_TXA- IO-14
    LIN_RXA- IO15

    LIN_TXB- IO-24

    LIN_RXB- IO-25(From "device.h" file)

    GPIO_setPinConfig(DEVICE_GPIO_CFG_LINTXA);
    GPIO_setPinConfig(DEVICE_GPIO_CFG_LINRXA);
    GPIO_setPinConfig(DEVICE_GPIO_CFG_LINTXB);
    GPIO_setPinConfig(DEVICE_GPIO_CFG_LINRXB);

    After making proper connections, I checked the LIN signals on LINA_TX pin i.e. IO-14, the LIN signals are visible here on this IO.  Please refer to image attached.

    And while this connection is going toward the LIN Transceiver's TX pin same signal is visible, but not on the output of LIN Transceiver.

    Please suggest if I am missing any step.

    Regards

    Yash

  • Hi Yash,

    Pending Arnav's feedback, please double confirm the speed for TXD.

    Also confirm TXD signal is connected to the right of the header pin and not the left (GND) similar to the RXD output probe while EN is not being pulled low and LIN is connected to just an output probe, thanks.

    Best Regards,

    Michael.

  • Hi Michael,

    Thanks for replying. The Baud used is 20Kbps and is matching for both TX device and RX device. 

    The LIN_TX signal coming and visible(Signal on Oscilloscope) from the LaunchXL_F28P65X & is connected with the correct TX pin on TLIN2029 EVM(Please refer Images above). Required connections with the LIN_RX also.

    When checking the flow of code on debugging window, it stuck on " while(!LIN_isRxMatch(LINA_BASE));" API. This means the RX ID does not match, but I've confirmed with the RX_ID and TX_ID  both matches. And the parity is also enabled in the code.

    How should I look toward this issue.

    Regards,

    Yash

  • Hi Yash,

    It would then seem to be in the controller domain and not the transceiver. I.e., if you can see clean LIN_TX and LIN_RX waveforms (while ensuring that the LIN_RX pin of the MCU is really tied to the LIN_RX in the LINA_BASE driver), the transceiver is working as expected and would recommend seeking additional controller feedback from the controller support team (note that, most LIN receivers seem to allow only a 2% deviation from the 20 Kbps and if the MCU clock setup is off, the peripheral might discard valid frames) while referencing the below recommendations toward the issue:

    • A valid header wait time for LIN_isRxMatch I.e., sending a break field followed by the sync byte. It seems the ID may not be recognized if the break is too short or the sync byte is not 0x55.
      • Scope the break - count cycles and confirm ≥ 13 bit times. 
      • Scope the sync - seems it should be 0x55, MSb first.
    • The ID may look wrong with a single bit error in your parity bits and would recommend double checking the code is calculating and inserting the two parity bits exactly as LIN specs require.
      • Scope the ID field - capture the 6-bit ID + parity bits that follow then run your own parity check on them.
      • You may add a receiver ID mode (filter = 0x3F) just to see if any match triggers. If it works, it would seem to be most likely a filter / ID mismatch issue.
    • Double check you have programmed your RX mailbox or ID filter exactly to match the same protected identifier you are transmitting I.e., the LIN peripheral seems to typically include an ID acceptance filter or mask.
      • If you never see RX match flag, try looping on the sync detection flag (LIN_isSyncDet(LINA_BASE)) - this will most likely indicate a header generation or clocking issue if it never fires, thanks.

    Best Regards,

    Michael.

  • Hi Michael,

    As you recommended i have checked, tested and implemented the following: 

    • A valid header wait time for LIN_isRxMatch I.e., sending a break field followed by the sync byte. It seems the ID may not be recognized if the break is too short or the sync byte is not 0x55.
      • Scope the break - count cycles and confirm ≥ 13 bit times. 
      • Scope the sync - seems it should be 0x55, MSb first.
    • The ID may look wrong with a single bit error in your parity bits and would recommend double checking the code is calculating and inserting the two parity bits exactly as LIN specs require.
      • Scope the ID field - capture the 6-bit ID + parity bits that follow then run your own parity check on them.
      • You may add a receiver ID mode (filter = 0x3F) just to see if any match triggers. If it works, it would seem to be most likely a filter / ID mismatch issue.

    These parameters are set and working same as earlier implementation.

    And the below API is not available in the source code environment. Can you please recheck this once.

    (LIN_isSyncDet(LINA_BASE))

    While debugging the code, it was mostly stopping at only these two API's- "LIN_isTxBufferEmpty(LINA_BASE)" and "LIN_isRxMatch(LINB_BASE)".

    Also, while watching the register in debug session, the TX registers(LINTD0 and LINTD1) are not getting updated with the original transmitting buffer data.

    Regards,

    Yash

  • Hello TI Team,

    Is there any updates or some recommendations on this thread? I request TI's MCU Group for their suggestions on the said issue.

    Regards,

    Yash

  • Hi Yash,

    I apologize for the delay here. Let me familiarize myself with the issue and get a response back to you in the next 1-2 days.

    Best Regards,

    Delanet

  • Hi Delaney,

    Thanks for replying. I have mentioned all the required information here in the forum.

    Incase you required anything extra, please ask.

    Regards,

    Yash

  • Hi Yash,

    A few things to check:

    • Which SYSCLK and VCLK frequencies do you have configured? And which baud rate are you using? There is sometimes error introduced by specific VCLK & baud rate combinations. Note that you can check the VCLK frequency by looking at the divider configured in the PERCLKDIVSEL.LINACLKDIV register field.
    • Can you check the SCIFLR register in the CCS register view (make sure Continuous Refresh is toggled on) and see if any error flags are going high when you are stuck at LIN_isRxMatch())?

    Best Regards,

    Delaney

  • Hi Delaney,

    The baud that i am using is the default baud provided by the TI's external loopback example-7(under API- LIN_initModule()). Below is the reference image for you.

    Which SYSCLK and VCLK frequencies do you have configured? And which baud rate are you using? There is sometimes error introduced by specific VCLK & baud rate combinations. Note that you can check the VCLK frequency by looking at the divider configured in the PERCLKDIVSEL.LINACLKDIV register field.

    clk_image

    Can you check the SCIFLR register in the CCS register view (make sure Continuous Refresh is toggled on) and see if any error flags are going high when you are stuck at LIN_isRxMatch())?

    This is the SCIFLR values when checking in register view. Below is the reference image.

    sciflr_img

    The values which are getting high for "LINB" are-

    • NRE
    • PE
    • TXEMPTY
    • TXRDY
    • TIMEOUT

    The values which are getting low for "LINA" are only-

    • Timeout

    Please check the provided values of the registers.

    Regards,

    Yash

  • Hi Yash,

    Thank you for sending the status register values. Could you also check the VCLK frequency in PERCLKDIVSEL.LINACLKDIV?

    Best Regards,

    Delaney

  • Hi Delaney,

    The VCLK frequency is particularly not present in the example. Can you please guide me where i can find it.

    The values for PERCLKDIVSEL reg values i can share with you. this is as follows-

    Regards,

    Yash

  • Hi Yash,

    Thank you for sending the register values. I will have another response back to you tomorrow.

    Best Regards,

    Delaney

  • Hi Delaney,

    Yes please. Suggest any way to resolve the issue.

    Regards,

    Yash

  • Hi Yash,

    I apologize for the delay; I still haven't had a chance to look into the settings. I will update with my progress tomorrow.

    Best Regards,

    Delaney

  • Hi Yash,

    The SYSCLK should be 200MHz and LINACLKDIV value is /2, so the VCLK frequency should be 100MHz. Based on this and a baud rate of 20kbps, there should be no significant error.

    Are you trying to achieve a baud rate of 20kbps? If so, based on the given clock settings, you should set the baud rate using the function parameters below in your code:

    LIN_setBaudRatePrescaler(LINA_BASE, 311U, 0U);
    Best Regards,
    Delaney
  • Hi Delaney,

    Yes I wanted to work with 20Kbps baud. 

    Are you trying to achieve a baud rate of 20kbps?

    As you said above i have set the parameters for LIN_setBaudRatePrescaler(LINA_BASE, 311U, 0U) that is present in "lin.c" file. Shown below-

    And set the Baud rate settings  in SysConfig file also. As per you suggested.

    But the successful completion of program is not proceeding. The program is getting stuck on function LIN_isTxBufferEmpty(), shown below-

     

    This is where mostly the program stucks. I am not getting why execution halts at this part of program.

    Regards,

    Yash

  • Hi Yash,

    I will get back to you with another response in the next 1-2 days.

    Best Regards,

    Delaney 

  • Hi Yash,

    If you scope the TX line, do you see anything getting sent by the F28P65x? Is the TXEMPTY bit in the Register View low (with Continuous Refresh on)?

    Also note that there is no need to modify the Sysconfig file unless you are calling Board_init() in your program, which the LIN ex7 does not do. I was just showing it as an example for how to calculate the baud values. Calling the LIN_setBaudRatePrescaler() function in your main configurations should be sufficient. 

    Best Regards,

    Delaney

  • Hi Delaney,

    Here is have checked the LIN-TX line on oscilloscope. It is getting high when I execute the program from debugger.

    I have mentioned the reference image for register with continuous refresh on.

    The values which are getting low for "LINA" are only-

    The value is low on TXEMPTY.

    Got the register values shown in earlier messages for your reference please.

    Regards,

    Yash

  • Hi Yash,

    The idle state of the TX line should be high (3.3V). Can you check if it ever goes low after reaching this high idle state? The TX line should show the following logic when it sends the header frame:

    If TXEMPTY is low, that means it still has data in the LIN TX buffer that it needs to transmit out (which the software writes). 

    Best Regards,

    Delaney

  • Hi Delaney,

    I have checked the state of the LIN frame, it shows like this-

    What would be the approach now?

    Regards,

    Yash

  • Hi Yash,

    Let me get back to you with another response in 1-2 days.

    Best Regards,

    Delaney

  • Hi Delaney,

    Is there any updates? It is quite a time.

    Thanks & Regards,

    Yash

  • Hi Yash,

    Apologies, I have been held up with some other activities. I will try to have a reply back tomorrow.

    Best Regards,

    Delaney

  • Hi Delaney, 

    Wanted your opinion on the LIN example no. 7 with the LaunchXL-F28P65x development board with TLIN2029 evaluation board.

    If possible can you try with the same hardware which i was working and having issues on implementation LIN. 

    That would also be clear for you for any bug present or faults. That i want from your side, what is the practical approach of it.

    Thanks and Regards,

    Yash

  • Hi Yash,

    Unfortunately I don’t have access to a TLIN2029 board. Let me see if I can place an order for it.

    Best Regards,

    Delaney

  • Hi Yash,

    To update, I have placed an order for the LIN EVM and should be receiving it sometime next week for testing.

    Best Regards,

    Delaney

  • Hi Delaney,

    Good to hear about the progress. 

    Thanks and Regards

    Yash

  • Hi Yash,

    I will update when I receive the shipment with the LIN EVM.

    Best Regards,

    Delaney

  • Hi Delaney,

    Sure, Thank you.

    Regards,

    Yash

  • Hi Yash,

    No problem Slight smile

    Best Regards,

    Delaney