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.

RM46L852: LIN Communication Basic Example

Part Number: RM46L852
Other Parts Discussed in Thread: HALCOGEN,

Hi everyone,

we are looking for a basic example for HalCoGen and CCS to run the LIN Bus communication on the RM46L852. We tried the RM57 example but didnt get very far because of the different layout ?

To be a bit more precise we are trying to run the RM46 board as an ECU sending and receiving LIN Messages (with additional LIN transceiver).

Thanks a lot in advance


  • Hi Marv,

    The HALCoGen generates a basic LIN driver. It has several APIs: 

    But we don't have an application example.

  • Hi QJ Wang,

    thanks for the fast reply. We got the example with the loopback interrupt runnin.

    When we try to implement the LIN functionality to our main project there is an issue with _enable_IRQ() which cant be resolved.. Do we need additional modifications/drívers in HalCoGen?

    This is the code:

    #include "Project_hska.h"
    #include "lin.h"
    #include "system.h"
    #include "sys_common.h"
    /* USER CODE BEGIN (2) */
    #define  TSIZE1 8
    uint8  TEXT1[TSIZE1]= {'H','E','R','C','U','L','E','S'};
    #define  TSIZE2 10
    uint8 TEXT2[TSIZE2]= {0};
    #define  TSIZE3 19
    uint8  TEXT3[TSIZE3]= {'T','E','X','A','S',' ','I','N','S','T','R','U','M','E','N','T','S','\n','\r'};
    /* USER CODE END */
    uint8   emacAddress[6U] =   {0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU};
    uint32  emacPhyAddress  =   0U;
    int main(void)
    /* USER CODE BEGIN (3) */
    	canInit();											/* initialize can 1 */
    	rtiInit();											/* Initialize RTI driver */
    	gioSetDirection(hetPORT1, 0xFFFFFFFF);   			/* Set high end timer GIO port hetPort pin direction to all output */
    	rtiEnableNotification(rtiNOTIFICATION_COMPARE0);	/* Enable RTI Compare 0 interrupt notification */
    	rtiEnableNotification(rtiNOTIFICATION_COMPARE1);	/* Enable RTI Compare 1 interrupt notification */
    		/* Enable IRQ - Clear I flag in CPS register */
    	_enable_IRQ();                                     // ohne keine CAN Tx ToDo wo liegt hier der Fehler? enable_IRQ kann nicht gefunden werden..
    	rtiStartCounter(rtiCOUNTER_BLOCK0);				/* Start RTI Counter Block 0 */		//500ms Timer
    	rtiStartCounter(rtiCOUNTER_BLOCK1);				/* Start RTI Counter Block 1 */		//15 sec Timer
    	linInit();                                          /* Initialize LIN driver */
    	/* 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, 0x28);
        /*Send data TEXT1 */
    			//wait for interrupt
    /* USER CODE END */
        return 0;
    /* 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 */

    Thanks a lot !

  • Hi Marvin,

    There are three "gates" before an interrupt request gets to the CPU:

    1. The module that generates an interrupt request has a register to enable each interrupt that it can generate.
    2. The Vectored Interrupt Manager (VIM) has registers to allow an interrupt request from a module to be forwarded to the CPU as per the priority scheme (lower channel number first).
    3. Finally the CPU itself must be configured to respond to the interrupt requests forwarded by the VIM (IRQ or FIQ).

    Please check your code to make sure that the interrupt is enabled:

    1. linREG->SETINT

    2. LIN channels in VIM table are selected. You can select one of them based on which level (High or Low) is selected in #1

    3. IRQ is enabled: _enable_IRQ();

  • Hi QJ,

    thanks for the reply. Every setting is like you described, still he cant resolve the _enable_IRQ() ..

    Are there any header files which are mutually exclusive ?

    Thanks a lot

  • The interrupt should be generated after a frame has been received and the data is copied LINRD. Have you resolved the IRQ issue?