How to use LinFlexd component to receive all messages from LIN BUS(MPC5748G Devkit)?

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

How to use LinFlexd component to receive all messages from LIN BUS(MPC5748G Devkit)?

Jump to solution
1,574 Views
shingo
Contributor II

Hi:

To receive all the message from LIN BUS, adding a LinFlexd component in S32DS for PA, There are some question:

1.There's a sentence on the schematic of MPC5748G Devkit, That is "Master Mode Pullup Enable". So the Lin component on the Devkit can not be configured as a slave? And There is no API to confige it to slave or master.

2.The VSUP1 on the Devkit must be connected to external power supply(12V) ?

shingo_0-1615547789043.png

 

 

BR

0 Kudos
1 Solution
1,531 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

for receiving data be sure CANoe is set to respond on given ID and check the RX frame on bus with the scope too.

You can refer to master/slave example on https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5748G-LINFlex-LIN-Master-Slave-test-G...

BR, Petr 

View solution in original post

0 Kudos
6 Replies
1,535 Views
shingo
Contributor II

By the way, is there an example for LIN working as a slave node? I want the two devkit boards to communicate with each other, so

I made some configuration changes base on the "linflexd_lin" example. Unfortunately, It didn't work out.

0 Kudos
1,569 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1) it will work as Slave node too, but to follow LIN standard this pullup should be removed. You can just solder out R4 and place header to have this configurable.
Yes, there is no LIN driver in the SDK. You can find simple baremetal code for LIN in S32DS called "linflex_lin".

2) yes, the LIN transceiver requires 12 V supply on pin P3.3

BR, Petr 

1,543 Views
shingo
Contributor II

Hi, Perts:

  I new a project from example called "linflexd_lin" , and download it to the devkit, using oscilloscope one can observe transmitted waveforms.

 Next step, Adding "receiveLINframe();"function to the main loop, while connecting the P3.4 of devkit to the Lin pin of the CANOE.

shingo_2-1615882671864.png

 

  And then, sending periodic messages to simulated slave node using CANOE, as shown below:

shingo_0-1615881576503.png

I set a breakpoit in the function "reveiveLINframe" 。

shingo_1-1615882539435.png

But it doesn't stop running at this breakpoint, it seems that the MCU did not receive the message from slave node. Where is the problem?

BR,

0 Kudos
1,532 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

for receiving data be sure CANoe is set to respond on given ID and check the RX frame on bus with the scope too.

You can refer to master/slave example on https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5748G-LINFlex-LIN-Master-Slave-test-G...

BR, Petr 

0 Kudos
1,514 Views
shingo
Contributor II

Hi,PetrS:

   Thanks for your advice. I transplanted the master/slave example to my project. But there are still some problems:

1)The Rx/Tx ISR of LINFlexD_0 as slave node is registered in the interrupt vector table. 

shingo_0-1616408427281.png

But where and how to register the Rx/Tx ISR in my project using S32_SDK_S32PA_RTM_3.0.3?
I try to use the API "LINFLEXD_UART_DRV_InstallRxCallback()" and "LINFLEXD_UART_DRV_InstallTxCallback()", but failed. The result is that while the master sends data, the slave does not receive it.

2)Whether as a slave or a master, The VSUP pin on DEVKIT must connect to power supply(12V)?

BR.

0 Kudos
1,495 Views
shingo
Contributor II

There are the API to register the ISR:

INT_SYS_InstallHandler() and INT_SYS_EnableIRQ()
0 Kudos