How to configure Slave in LIN module on MPC5777M EVM board ?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure Slave in LIN module on MPC5777M EVM board ?

350 Views
anishchoudhary
Contributor III

For LIN module on MPC5777M and MPC5748G EVM board ? I configure for LIN slave that you can find in following code

    LINFlexD_0.UARTCR.B.UART = 0 ;   // Disable the LINFlexd_UART to work with LINFlexD_LIN module
    LINFlexD_0.LINCR1.B.INIT = 1 ;  // For configuration come in INIT mode
    LINFlexD_0.LINCR1.B.SLEEP = 0 ;   // Avoid the sleep mode

    LINFlexD_0.LINIBRR.B.IBR = 480 ;   // Set the baud rate for slave ,same i configure in master side.
    LINFlexD_0.LINFBRR.B.FBR = 0 ;

    LINFlexD_0.LINCR2.R = 0x40 ;
    LINFlexD_0.LINTCSR.R = 0 ;

    LINFlexD_0.IFER.R = 0xF;                            // enable filters 0-3
    LINFlexD_0.IFMR.R = 0x0;                            // filters 0 - 3 are in identifier list mode.

   LINFlexD_0.IFCR[0].R = 0x1E37;
    LINFlexD_0.IFCR[1].R = 0x1C35;

    LINFlexD_0.IFCR[2].R = 0x1F36;
    LINFlexD_0.IFCR[3].R = 0x1F35;
    LINFlexD_0.IFCR[3].R = 0x1D35;


    LINFlexD_0.LINCR1.B.AUTOWU = 0x1u ;    // Enable the auto wake-up when the Rx Interrupt will coming
    LINFlexD_0.LINCR1.B.MBL = 0x3u ;
    LINFlexD_0.LINCR1.B.MME  = 0x0u ;    // set MME = 0 for salve mode
    LINFlexD_0.LINCR1.B.INIT = 0x0u ;      // Come out from LIN INIT mode

Please check the configuration that is correct or some other change must be needed ?

Tags (2)
2 Replies

134 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the configuration looks normal. Only you must be sure the module is in INIT mode before registers are set.

 Thus LINS status field should be checked, something like this

/* enter INIT mode */
  LINFlexD_0.LINCR1.B.INIT = 1 ;  // For configuration come in INIT mode
   LINFlexD_0.LINCR1.B.SLEEP = 0 ;   // Avoid the sleep mode

    /* wait for the INIT mode */
    while (0x1000 != (LINFlexD_0.LINSR.R & 0xF000)) {}

The instruction LINFlexD_0.LINCR2.R = 0x40 actually clears the LINCR2, reserved bits are written. If IOBE should be set use LINFlexD_0.LINCR2.R = 0x4000;

Then IFCR[3] is written twice, so second value is taken into account.

BR, Petr

134 Views
anishchoudhary
Contributor III

  Hi

If i change line following line as per yours suggestion transmission also not happened :

           LINFlexD_0.LINCR2.R = 0x40u ; into 

           LINFlexD_0.LINCR2.R = 0x4000u;

so please make me sure which is right is above lines.

0 Kudos