MPC5744P LinFlexD Master Data Reception problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5744P LinFlexD Master Data Reception problem

874 Views
Vennila
Contributor I

Hi,

I'm using LinFlexD on MPC5744P EV-board. 

Configured MPC5744P as Master and flased S32 design studio LIN Master code, Different controller as slave and will respond to the ID added in the filter (ID=0x30,DATA=0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00)  and I connected PLIN Viewer to view LIN frame. 

Master Sending 0x30h Identifier to receive data from slave. I'm able to viewe the slave response data in PLIN viewer. But MPC5744P waiting in a while loop while (!LINFlexD_0.LINSR.B.DRF); /* Wait for data receive complete flag */. DRF is not triggered and BDRL, BDRM not updated. it's value remainds 0. 

//LIN init

void initLINFlexD_0 (void) { /* Master at 20K baud with 80MHz LIN_CLK */

LINFlexD_0.LINCR1.B.INIT = 1; /* Put LINFlex hardware in init mode */

LINFlexD_0.LINCR1.R = 0x000003B1; /* Configure module as LIN master & loopback mode and BF=1 
LINFlexD_0.LINIBRR.B.IBR= 250; /* Mantissa baud rate divider component */
/* Baud rate divider = 80 MHz LIN_CLK input / (16*20000 bps) ~=250 */
LINFlexD_0.LINFBRR.B.FBR = 0; /* Fraction baud rate divider comonent */
LINFlexD_0.LINCR1.R = 0x000003B0; /* Change module mode from init to normal */
/* Configure LINFlexD_0 TxD Pin. */
SIUL2.MSCR[PB2].B.SSS = 0b0001; //Pad PF14: Set to LINFlex_1 TxD. Must choose this option because F14 leads to LIN PHY of motherboard
SIUL2.MSCR[PB2].B.OBE = 1; //Enable output buffer
SIUL2.MSCR[PB2].B.src=3; //Full drive-strength without slew rate control

/* Configure LINFlexD_0 RxD Pin. */
SIUL2.MSCR[PB3].B.IBE = 1; //Pad PF15: Enable input buffer
SIUL2.IMCR[165].B.SSS = 0b0001; //Connect LINFlexD_2 signal to PF15
}

//Receive fun

void receiveLINframe_0 (void) {      /* Request data from ID 0x30 */
uint8_t i;
  LINFlexD_0.BIDR.R = 0x00001D30; /* Init header: ID=0x15, 8 B, Rx, classic cksum */
  LINFlexD_0.LINCR2.B.HTRQ = 1;   /* Request header transmission */
  while (!LINFlexD_0.LINSR.B.DRF); /* Wait for data receive complete flag */
                              /* Code waits here if no slave response */
  for (i=0; i<4;i++){         /* If received less than or equal 4 data bytes */
RxBuffer[i]= (LINFlexD_0.BDRL.R>>(i*8)); /* Fill buffer in reverse order */
  }
  for (i=4; i<8;i++){         /* If received more than 4 data bytes: */
RxBuffer[i]= (LINFlexD_0.BDRM.R>>((i-4)*8)); /* Fill rest in reverse order */
if(RxBuffer[i]){}
  }
  LINFlexD_0.LINSR.R = 0x00000204;   /* Clear DRF flag */
}
 
Register value:
Vennila_0-1715167472692.png

 

 
Slave responce capure in PLIN Viewer:
 
Vennila_1-1715167472420.png

 

Is there have Mater coding procedure to reference?

Please help me with this problem. Thank you.

Regards

Vennila

0 Kudos
Reply
11 Replies

829 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

seems you have loopback mode still enabled, so clear LBKM bit in LINCR1 in init mode.

BR, Petr

0 Kudos
Reply

824 Views
Vennila
Contributor I

Hi 

I removed from Loopback mode and configured LINFlexD_0.LINCR1.R = 0x00000390 and tried. But not received the data. Struck in the same place while (!LINFlexD_0.LINSR.B.DRF); /* Wait for data receive complete flag */.

LINSR shows 0x00007040 and LINESR shows 0x00006000.

MPC5744_master_receive.PNG

 

oscilloscope_0x30.PNG

I'm able to capture the slave response in oscilloscope and PLIN viewer. In MPC5744P DRF bit is not triggered. Kindly help me to fix the issue. 

thanks and regards 

Vennila

0 Kudos
Reply

821 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

what is a board exactly (name, rev.)? Show LINCR1 as well.
Bit error is detected for some reason, so try to measure LIN and master TXD/RXD signals to be sure transceiver is active.

BR, Petr

0 Kudos
Reply

814 Views
Vennila
Contributor I

Hi,

I'm using DEVKIT-MPC5744P 2017 NXP BV(REV-D which is on the white label). LIN transceiver placed on the board is TJA1021 NXP.

B1.PNGb2.PNG

LIN RXD and TXD Signal captured in Logic Analyser. Received the expected Slave response(data: 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00) in RXD.

D4 - TXD, D5 - RXD.

LIN_TX_RX.PNG

 

Thanks and regards

Vennila

0 Kudos
Reply

804 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

ok, this looks normal. But not sure why bit error is set. Is baudrate properly set?
Try to clear LINCR2's IOBE, IOPE as well. If does not change at all, share your project or try to refer to https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5744P-LIN-Master-Slave-test-GHS614/ta...

BR, Petr

0 Kudos
Reply

793 Views
Vennila
Contributor I

Hi Petr,

      RXD should default to High. But RXD pin from transiver is directly connected with MPC5744P pin. So i added pull up for RX pin and tested without debug mode salave response data received in MPC5744P EVK.  

/* Configure LINFlexD_0 TxD Pin. */
SIUL2.MSCR[PB2].B.SSS = 0b0001; //Pad PF14: Set to LINFlex_1 TxD. Must choose this option because F14 leads to LIN PHY of motherboard
SIUL2.MSCR[PB2].B.OBE = 1; //Enable output buffer
SIUL2.MSCR[PB2].B.ODE = 1; /* Pad PB2: Output Drain Enable */
SIUL2.MSCR[PB2].B.PUS = 1; /* Pad PB2: Pull up selected */
SIUL2.MSCR[PB2].B.PUE = 1; /* Pad PB2: Pull Enable */
SIUL2.MSCR[PB2].B.src=3; //Full drive-strength without slew rate control

/* Configure LINFlexD_0 RxD Pin. */
SIUL2.MSCR[PB3].B.IBE = 1; //Pad PF15: Enable input buffer
SIUL2.MSCR[PB3].B.PUS = 1; /* Pad PB2: Pull up selected */
SIUL2.MSCR[PB3].B.PUE = 1; /* Pad PB2: Pull Enable */
SIUL2.IMCR[165].B.SSS = 0b0001; //Connect LINFlexD_2 signal to PF15

With debug mode not able to received the slave response data in EVK and shows the above post error(Bit error). 

1. Are we able to test LIN in debug mode or not?

2. If yes, why I'm not received the slave response in debug mode?

 

Thanks and Regards

Vennila

0 Kudos
Reply

716 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

what do you mean by debug mode? Debugger connected and code running? In that case it would work too.

BR, Petr

0 Kudos
Reply

712 Views
Vennila
Contributor I

Hi Petr,

Debug mode: Code is flashed using debug as option and code is running state. Not received the slave response data. Facing the below errors.  MPC5744_master_receive.PNG

 

Without Debug mode: Restarted the board after flashed the code. Received the Slave response continuously. 

Thanks and regards

Vennila

0 Kudos
Reply

706 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

interesting, I can recommend to place breakpoint before frame sending and check all setting if it is expected (pins, clock, LINflex,..). If you do not find anything wrong, then share your project so we can test.

BR, Petr

0 Kudos
Reply

694 Views
Vennila
Contributor I

Hi Petr, 

I'm didn't find anything worng before send a frame. all register values present as configured values. shared the project file and configured a baud rate as 9615bps. Please give a fix for that debug mode.

 

Thanks and regards

Vennila

 

 

 

0 Kudos
Reply

569 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I did not tested still, but could not be issue just with PLIN tool if it goes to sleep, when debugging project?

BR, Petr

0 Kudos
Reply