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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,717 次查看
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 项奖励
1 解答
1,674 次查看
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 项奖励
6 回复数
1,678 次查看
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 项奖励
1,712 次查看
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,686 次查看
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 项奖励
1,675 次查看
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 项奖励
1,657 次查看
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 项奖励
1,638 次查看
shingo
Contributor II

There are the API to register the ISR:

INT_SYS_InstallHandler() and INT_SYS_EnableIRQ()
0 项奖励