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
Is there have Mater coding procedure to reference?
Please help me with this problem. Thank you.
Regards
Vennila
Hi,
seems you have loopback mode still enabled, so clear LBKM bit in LINCR1 in init mode.
BR, Petr
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.
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
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
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.
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.
Thanks and regards
Vennila
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
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
Hi,
what do you mean by debug mode? Debugger connected and code running? In that case it would work too.
BR, Petr
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.
Without Debug mode: Restarted the board after flashed the code. Received the Slave response continuously.
Thanks and regards
Vennila
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
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