How to config 5 LINFlexD instances as slave mode on MPC5748G

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

How to config 5 LINFlexD instances as slave mode on MPC5748G

Jump to solution
1,637 Views
shingo
Contributor II

Hi:

    In order to receive 5 channels LIN message through LIN, 5 LINFlexD instances on MPC5748G could only be configered as slave mode. But it says in the Reference Manual: "only LINFlexD0 could be configered as slave mode".

shingo_0-1616491912225.png

(1) How can I design to meet my needs? Use the serial port function to simulate the reception of LIN?

By the way, I have a question at the master/slave for LIN example on "https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5748G-LINFlex-LIN-Master-Slave-test-G... .

In LINFlexD_0_Init() function, I comment out a few sentences(the source code is shown below
), and then the LINFlexD_0 could not goto LINFlexD_0_RX_ISR() function while LINFlexD_1 send a LIN message. My question is that : Is it necessary to add a filter when configuring LIN as a slave node?
shingo_1-1616492833508.png

shingo_3-1616492946196.png

 

 

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

Hi,

I guess this will be hardly done using UART mode. There is no break detection, so you should get frame error when break is received. Checksum must be calculated by SW too.
I think I am out of suggestions or ideas.

BR, Petr

View solution in original post

0 Kudos
6 Replies
1,630 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

why do you need 5 LIN slaves in your MCU? You have application that has 5 LIN masters so have 5 separate LIN buses and you need all those busses connected to single MCU.
LINFlexD configured as master can communicate (transmit/receive data) with up to 16 slave devices on single bus.

The hardware filtering saves CPU resources that would otherwise be required to perform filtering by software. Read chapters 45.4.2.4 Slave mode and 45.4.2.6 Identifier filtering of the RM.
If you comment filter setting try to set BF bit in LINCR1 register at the end of init function, so have LINCR1.R=0x2380.

BR, Petr

0 Kudos
1,619 Views
shingo
Contributor II

Hi, PetrS:

    Because there are 5 separate LIN bus loops, and each of them has a master node and several slave nodes.

    In order to receive all messages on each LIN bus using MPC5748G, How do I configure the 5 Linflexd modules to achieve this goal?

    I have two ideas:

    1.the LINFlexD module of MPC5748G can be configured as a slave LIN node, But only LINFlexD0 can act as a slave node. So this idea is unlikely to accomplish the goal.

    2.LIN simulated with serial port. LINFLEXD module is configured to UART mode in the BSP layer, and LIN messages are parsed in the application layer according to LIN standard protocol.

Please give me some suggestions or ideas, Thanks!

 

BR,

   

 

0 Kudos
1,614 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I guess this will be hardly done using UART mode. There is no break detection, so you should get frame error when break is received. Checksum must be calculated by SW too.
I think I am out of suggestions or ideas.

BR, Petr

0 Kudos
1,603 Views
shingo
Contributor II

Hi, PetrS:

   Firstly, LINFlexD0 on MPC5748G Devkit is configured to UART mode, and standard UART messages can be received . 

  In theory,  "LINFLEXD0_UART_ErrIRQHandler()" function could be called when break field is received,

and then "LINFLEXD0_UART_RxIRQHandler()" function could be called when SYNC field(0x55), PID field and data field are received.

   Now, "LINFLEXD0_UART_ErrIRQHandler()" function could be called, and clear the flag "

LINFlexD_UART_BUFFER_OVERRUN_FLAG" in this function.       But "LINFLEXD0_UART_RxIRQHandler()" function could not be called. where is the problem?
  • maybe was the idea designed wrong in the first place?

0 Kudos
1,596 Views
shingo
Contributor II

Hi,Pert:

    Thanks for your advice.

     Because there is the "LINFLEXD_UART_DRV_CompleteReceiveUsingInterrupts()" function in 

"LINFLEXD_UART_DRV_ErrIRQHandler()" function, in other words, it disable receive data full interrupt and the receiver.
      Simply enable receive data interrupt and the receiver in the Error_Callback function just like using the "LINFLEXD_UART_DRV_ReceiveData()" function, it can goto Rx_Callback function again when Sync field(0x55), PID field, and data field received.
     Now, the final step is to analyze whether the data is correct in application layer
   
BR.
 
0 Kudos
1,385 Views
quanjia
Contributor I

Hi, shingo:

Now I have the same requirement with you, what's your final result?

If it works, would you do me a favor?

Thanks.

0 Kudos