2014-04-24 08:27 AM
Dear everybody,
I found a strange behaviour, which I have no explanation for currently. This code doesn't workNCAN_Outgoing.DLC = 8;
NCAN_Outgoing.ExtId = 0;
NCAN_Outgoing.IDE = CAN_ID_STD;
NCAN_Outgoing.RTR = CAN_RTR_DATA;
NCAN_Outgoing.StdId = 0x7DF;
NCAN_Outgoing.Data[0] = 0x02;
NCAN_Outgoing.Data[1] = 0x09;
NCAN_Outgoing.Data[2] = 0x02;
NCAN_Outgoing.Data[3] = 0x00;
NCAN_Outgoing.Data[4] = 0x00;
NCAN_Outgoing.Data[5] = 0x00;
NCAN_Outgoing.Data[6] = 0x00;
NCAN_Outgoing.Data[7] = 0x00;
whereas the exact same code with 0x5FF (and every lower value) doesnt work (meaning no transmission is detected by other devices in the CAN)
NCAN_Outgoing.DLC = 8;
NCAN_Outgoing.ExtId = 0;
NCAN_Outgoing.IDE = CAN_ID_STD;
NCAN_Outgoing.RTR = CAN_RTR_DATA;
NCAN_Outgoing.StdId = 0x5FF;
//only differece
NCAN_Outgoing.Data[0] = 0x02;
NCAN_Outgoing.Data[1] = 0x09;
NCAN_Outgoing.Data[2] = 0x02;
NCAN_Outgoing.Data[3] = 0x00;
NCAN_Outgoing.Data[4] = 0x00;
NCAN_Outgoing.Data[5] = 0x00;
NCAN_Outgoing.Data[6] = 0x00;
NCAN_Outgoing.Data[7] = 0x00;
I appreciate any advice. Thank you all very much in advance!
#can
2014-04-25 12:23 AM
As far as I understand
CAN-frames
with
ID=0x5FF
are recepted by other devices on CAN bus, while
with
ID = 0x7DF
not.
What kind of
''other devices
in the
CAN''?
How are they
configured
?
2014-04-25 01:10 AM
thanks for the reply, glory.man - I appreciate it!
I used several devices, e.g. a ETAS CAN-Link II or a car (haha) with no filters active. Standard CAN Messages (''standard adressing'' using 11 Bits) should range from 0b00 0000 0000 (0x000) to 0b111 1111 1111 (0x7FF) so there sould be no problemo!''As far as I understand
CAN-frames
with
ID=0x5FF
are recepted by other devices on CAN bus, whilewith
ID = 0x7DF
not.'' - exactly, or even a little bit more precise:
CAN-Frames with ID <= 0x5FF are recepted while IDs > 0x5FF are not.2014-04-25 02:24 AM
Found another strange behaviour:
NCAN_Outgoing.DLC = 8;
NCAN_Outgoing.ExtId = 0;
NCAN_Outgoing.IDE = CAN_ID_STD;
NCAN_Outgoing.RTR = CAN_RTR_DATA;
NCAN_Outgoing.StdId = 0x7DF;
NCAN_Outgoing.Data[0] = 0x02;
NCAN_Outgoing.Data[1] = 0x10;
NCAN_Outgoing.Data[2] = 0x02;
NCAN_Outgoing.Data[3] = 0x00;
NCAN_Outgoing.Data[4] = 0x00;
NCAN_Outgoing.Data[5] = 0x00;
NCAN_Outgoing.Data[6] = 0x00;
NCAN_Outgoing.Data[7] = 0x00;
works, while everything lower in the second databate does not
NCAN_Outgoing.DLC = 8;
NCAN_Outgoing.ExtId = 0;
NCAN_Outgoing.IDE = CAN_ID_STD;
NCAN_Outgoing.RTR = CAN_RTR_DATA;
NCAN_Outgoing.StdId = 0x7DF;
NCAN_Outgoing.Data[0] = 0x02;
NCAN_Outgoing.Data[1] = 0x09;
// only difference
NCAN_Outgoing.Data[2] = 0x02;
NCAN_Outgoing.Data[3] = 0x00;
NCAN_Outgoing.Data[4] = 0x00;
NCAN_Outgoing.Data[5] = 0x00;
NCAN_Outgoing.Data[6] = 0x00;
NCAN_Outgoing.Data[7] = 0x00;
How is that possible?
2014-04-25 06:02 AM
It's really strange
-
usually
can-
controllers
uses ID filtering forframes
,not
the data filterring.
To transmit data you need to select one empty transmit mailbox - may be there is no empty MB.Can you
add to
your
CAN_TX_IRQHandlerincremented counter
andcheck
its value
(for example you can transmitt its value via CAN with ''good'' ID )?
May be this is software trick of other CAN-devices - i.e. they are uses some data protocol to decode data.It would be
nice to use some kind of CAN-logger (an
alyzer) to check CAN-bus state -and make sure
that the data
with that ID
is not transmitted.
2014-04-25 06:48 AM
This looks more like a problem with whatever CAN protocol your devices are using. Yes, a message identifier can be anywhere in the 11 bit range, but that's no guarantee it won't be ignored by other devices on the bus.
For example, in CANopen protocol the 0x7df identifier is in the range used by the service that assigns node numbers dynamically, the equivalent of DHCP on a TCP/IP network. Chances are the other devices do receive the message but are not processing it. This assumes filtering doesn't block it, and if these are commercial devices you may have no way of knowing what message IDs the devices will ignore. The other possibility is you are colliding with an identifier used by another device on the same bus. Message identifiers are supposed to be unique to a node except in special cases where you know there won't be a collision. Try sending the message between two STM32 nodes. If it works you will know the problem is in someone else's box. Jack Peacock2014-04-25 07:02 AM
This looks more like a problem with whatever CAN protocol your devices are using...Try sending the message between two STM32 nodes. If it works you will know the problem is in someone else's box.
Totally this! The measurements you make are only as good as the tools making the measurement. Typically you'd want to find analysis equipment that's an order of magnitude better (functionality, bandwidth, cost, etc) than the signal/protocol you want to observe.