How do you configure LIN Slave to Slave on MPC5605B?

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

How do you configure LIN Slave to Slave on MPC5605B?

Jump to solution
1,028 Views
cspencer
Contributor II

Hello, 

I'm trying to configure a slave to slave data exchange.  I've been reading through the reference manual for the MPC5605B and it is pretty thin on how someone might accomplish this in the "programmers" section.

So, I'm wondering if there is a similar diagram that shows the sequence of bits and which callbacks are required to make this function properly.

In one of the tables (24-40), it mentions that DDRQ needs to be set to 1, but doesn't that mean the rest of the message is ignored (and no followup ISR occurs)?  I'd like to read the data from the buffer when it is complete so this seems to defeat my purpose.

Any help would be appreciated.

0 Kudos
1 Solution
886 Views
cspencer
Contributor II

I figured it out.  I was not clearing the HRF in the ISR which was causing problems in our scheduler.

For future readers of this post, you do not set DDRQ if you want to read the data from another slave.  It needs to be 0.

Thank you for your help Petr.

View solution in original post

0 Kudos
8 Replies
886 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can refer to this demo

https://community.nxp.com/docs/DOC-102526 

BR, Petr

0 Kudos
886 Views
cspencer
Contributor II

The demo doesn't cover the slave to slave case.

0 Kudos
886 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

there is  no slave to slave communication. In every cluster, there is one master node, and up to 16 slave nodes. The master node controls all communication on the bus, and contains the master task and the slave task to be delivered. The slave nodes are unable to communicate with each other, contain only the slave task, and are only capable of responding to the master if the message is directed at them. The master sends out a request to a designated slave as a header (beginning of the frame), and the slave responds to the master as a response frame. There is also a case where the master sends the slave the header and response frame, and the slave only listens with no response. 

BR, Petr

0 Kudos
886 Views
cspencer
Contributor II

Petr,

There is a slave to slave case.  It's even mentioned in the LIN FLEX documentation (at least for the MPC560XB).  

You are correct that the master needs to initiate all communication, but the slave nodes can listen to what the other slave nodes are doing and thus can receive and process this data.  Its essentially how a LIN bus monitor can function.

The question is how do you force the LIN FLEX implementation to do this?  The documentation is very light regarding this operating mode.

pastedImage_1.png

0 Kudos
886 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi Collin,

well, so you want to do slave-to-slave data exchange which is triggered by Master.

Then use the same config as for Master data reception and just set LINCR2[DDRQ] bit. Thus Master discard data received from the slave, that is responding to the header. Another slave must be set to receive data for that ID.

No interrupt is called on Master side, just DDRQ bit is reset by hardware once LINFlexD ignores the response and moves to Idle state.

BR, Petr

0 Kudos
886 Views
cspencer
Contributor II

Petr,

Interesting.  What if the master is subscribed to the same frame/signal as the receiving slave?

If I set the DDRQ, it looks like the second ISR is not fired (after the reception is complete).  So, do I need to poll periodically and see if the frame is complete?  I had to do this on the master side.

Thanks,

Collin

0 Kudos
886 Views
cspencer
Contributor II

I tried setting up a polling operation, but the DRF bit is not set if DDRQ is asserted so determining whether the frame is received is problematic.

So, back to the drawing board.

0 Kudos
887 Views
cspencer
Contributor II

I figured it out.  I was not clearing the HRF in the ISR which was causing problems in our scheduler.

For future readers of this post, you do not set DDRQ if you want to read the data from another slave.  It needs to be 0.

Thank you for your help Petr.

0 Kudos