cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Outgoing Data / Different Adress from ECU

Posted on March 11, 2015 at 18:07

Hello,

I have a question regarding to adress CAN.

NCAN_Outgoing.Data.

For example I have defined the following lines like:

NCAN_Outgoing.Data[0] = 0x02; // this is for the destination ID

NCAN_Outgoing.Data[1] = 0x09;

NCAN_Outgoing.Data[2] = 0x06:

....

Assuming that I have two ECUs (e.g. 0x02 & 0x03) how is it possible to give STM32 the possibility to look up which adress should be used?

Maybe an idea: Creating a loop when the code check's if the destination ID matches up?

Thanks for helping!

#can

1 REPLY 1
jpeacock
Associate II
Posted on March 11, 2015 at 18:35

This sounds like a generic question on assigning node IDs in a network, rather than something specific to CAN.  There are many ways to do this.  A static approach uses some information available to the controller to calculate a unique node ID.  This can be an address switch, an address stored in flash at the final acceptance test during assembly, or some hash derived from a unique identifier in the controller.  A dynamic approach is to use an address manager node to assign IDs when requested, along the lines of DCHP in TCP/IP nets or LSS and flying bus master in CANopen networks.

You can listen for active nodes, assuming each node sends some kind of heartbeat message.  Build an address list and then assign an unused node.  This has several problems.  First, it takes time to collect active nodes.  Second, there may be inactive nodes with fixed address that come on line later and collide with your apparently unused address.  And third, what happens if EVERY node listens first and then all pick a node at the same time?

Since you mention ECU (engine control unit) are you using the J1939 CAN protocol?  Many CAN protocols incorporate the node ID into the message ID rather than in the data section, since you can't prioritize or use collision detection in the data bytes.

  Jack Peacock