Skip to main content
Dick Lin
Senior
February 17, 2017
Question

SMTF32F1x CAN bus Error Frame

  • February 17, 2017
  • 11 replies
  • 3025 views
Posted on February 17, 2017 at 18:54

Hi,

I am seeing Error Frame from one of our project using STM32F1x MCU. Any recommendation how to debug this issue?

Thanks,

Dick

112.227000 1 108 Rx d 8 db 1f c0 69 ee 89 e8 3e

112.227000 1 109 Rx d 8 86 31 94 43 00 00 00 00

112.227000 1 10a Rx d 8 00 00 00 00 6d 86 ec bf

112.228000 1 10b Rx d 8 00 00 00 00 04 00 00 40

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 ErrorFrame ECC: 11011001

112.228000 1 6fe Rx d 8 00 49 82 56 53 29 39 16

112.229000 1 6fe Rx d 8 00 32 4e 38 37 86 23 21

112.229000 1 6fe Rx d 8 00 50 65 55 49 54 30 02
    This topic has been closed for replies.

    11 replies

    Oliver Beirne
    Associate II
    February 20, 2017
    Posted on February 20, 2017 at 04:46

    Hello

    I have moved your question to the

    https://community.st.com/community/stm32-community/stm32-forum?sr=search&searchId=827a2a41-077c-4191-a4c1-9da6021f9aff&searchIndex=0

    ‌ where someone should be able to assist you.

    Thanks

    Oli

    T J
    Senior III
    February 20, 2017
    Posted on February 20, 2017 at 05:12

    How many nodes are on the Bus ?

    is the bus terminated ?

    Only one master can be on the bus. Do you have multiple masters ?

    You need at least one slave too.

    Eugenia Suarez
    Associate III
    March 16, 2017
    Posted on March 16, 2017 at 11:30

    Are you meaning where to find the values of your error frames when debugging? 

    Have you solved your question? I would like to see if it possible and find the register where this frames are kept and translated.

    T J
    Senior III
    March 16, 2017
    Posted on March 16, 2017 at 23:00

    I think you are asking about hardware, not registers, so they are likely unavailable.

    what baud rate are you running ?

    what length of cable ?

    are you using a real CanBus cable solution, or still on loopback ?

    I received errors very occasionally at 250Khz on a true solution over a 10M cable with a 120 Ohm terminator at one end. (should be on both ends I know)

    after a few minutes I may see an error, but usually when someone turns on a fan or light or fridge I guess.

    The hardware recovers immediately, but it reports the error.

    Dick Lin
    Dick LinAuthor
    Senior
    March 16, 2017
    Posted on March 16, 2017 at 23:15

    I am using 1Mb/s baudrate. It's in a UAV device, so the cable length is short.

    The error frame only can be seen on bus. I am using a CANTrace to capture the CAN message, CANTrace also record error frame. I do use Kvaser CanKing, it accumulate error frame count but not record in log file.

    T J
    Senior III
    March 16, 2017
    Posted on March 16, 2017 at 23:34

    is it electric or petrol based UAV ? either way, you will have noise issues.

    I would say that you have noise on the line, so make sure both terminators are on, to reduce it.

    Are you using isolated CAN modules ? it shouldn't be necessary if you have good grounding. 2-4mm wire between modules with good connections.

    How are you generating the 5 volts ? .. it is likely your problem.

    Power supplies seem to have many issues, solved by extra parts.

    inductors and caps either side of the Switchers help, ferrites only stop noise above 2MHz

    In my power supplies, I tend to go overboard, but the results are good.

    do you need to go at 1Mhz ?

    can you try 250KHz so see if the problem is resolved ?

    Dick Lin
    Dick LinAuthor
    Senior
    March 16, 2017
    Posted on March 16, 2017 at 23:46

    It's battery-powered UAV. The whole system come with several subsystem, each one powered by a MCU and communicate with each other using CAN bus.

    Unless I can change all of subsystem to other baudrate, otherwise it will error frame too - I think.

    I think we don't have correct termination is the issue to have error frame. What I still can't prove is if the right termination will fix the issue. I have been tried couple of different termination already.

    Thanks.

    T J
    Senior III
    March 16, 2017
    Posted on March 16, 2017 at 23:52

    Hi,

    power off the whole system, and use a multimeter to read 60Ohms...

    120Ohms at each end is 60Ohms

    Dick Lin
    Dick LinAuthor
    Senior
    March 16, 2017
    Posted on March 16, 2017 at 23:56

    Yes, I did that. That's why I know we are not correctly terminated. What I am not sure if the right termination actually fix the issue.

    T J
    Senior III
    March 16, 2017
    Posted on March 17, 2017 at 00:32

    yes, you really should match the impedance of the drivers to have half a chance of reducing errors.

    are you using the CanBus filter ?

    or

    maybe you can get thicker power wires, the ground wire is most important.

    put extra capacitance on your 5V rail,

    can you feed power through an inductor or filter ?

    Dick Lin
    Dick LinAuthor
    Senior
    March 16, 2017
    Posted on March 17, 2017 at 00:56

    I did try both battery power and power supply, same result.

    T J
    Senior III
    March 17, 2017
    Posted on March 17, 2017 at 01:37

    are the issues more or less obvious when the UAV is operating ?

    how thick is the ground wire ?

    what did you do to suppress the 5V Switcher noise ?

    do you have an isolated CAN module ? Can you try one ?

    Jeroen3
    Senior
    March 17, 2017
    Posted on March 17, 2017 at 07:43

    What is the bus load and how much are error frames?

    You are to expect error frames, CAN bus can handle this up the bus-off limit. It will retransmit. If you go over the bus-off limit, then you should be worried.

    If you application is idling, thus no noise generating devices are enabled, do you have errors?

    Are you following the standard? Eg: no two nodes transmit the same ID, nodes have a little pause between identical identifiers. Cable is twisted pair. Cable can be shielded.

    Both ends of the bus are 120 ohm terminated, preferably split termination. Stub length is under 1.5 meter. (for 250 kbit)

    I've build a system with ~40 meters of cable and ~50 nodes at 250kbit with many VFD's and relays. Sometimes when relays switch, an error frame occurs.

    CAN is designed to handle this. Is your application?

    Dick Lin
    Dick LinAuthor
    Senior
    March 17, 2017
    Posted on March 17, 2017 at 15:42

    The definition of the error I have. See below. Thx

    ErrorFrame ECC: 11011001

    11 other type of error

    • 0 TX
    • 0x19 acknowledge slot

    Bit 7 Bit 6 Meaning

    0 0 bit error

    0 1 form error

    1 0 stuff error

    1 1 other type of error

    Bit 5 Meaning

    0 TX; error occurred during transmission

    1 RX; error occurred during reception

    Bit 4..0 Meaning

    0x03 start of frame

    0x02 ID.28 to ID.21

    0x06 ID.20 to ID.18

    0x04 bit SRTR

    0x05 bit IDE

    0x07 ID.17 to ID.13

    0x0F ID.12 to ID.5

    0x0E ID.4 to ID.0

    0x0C bit RTR

    0x0D reserved bit 1

    0x09 reserved bit 0

    0x0B data length code

    0x0A data field

    0x08 CRC sequence

    0x18 CRC delimiter

    0x19 acknowledge slot

    0x1B acknowledge delimiter

    0x1A end of frame

    0x12 intermission

    0x11 active error flag

    0x16 passive error flag

    0x13 tolerate dominant bits

    0x17 error delimiter

    0x1C overload flag

    ACK slot

    The acknowledge slot is used to acknowledge the receipt of a valid CAN frame.

    Each node that receives the frame without finding an error, transmits a dominant level in the ACK slot and thus overrides the recessive level of the transmitter.

    If a transmitter detects a recessive level in the ACK slot it knows that no receiver found a valid frame.

    A receiving node may transmit a recessive to indicate that it did not receive a valid frame, but another node that did receive a valid frame may override this with a dominant.

    The transmitting node cannot know that the message has been received by all of the nodes on the CAN network.

    ACKNOWLEDGEMENT ERROR

    Detected by the transmitter if a dominant value is not found in the

    ack slot
    Jeroen3
    Senior
    March 17, 2017
    Posted on March 17, 2017 at 19:57

    Do you have ACK errors?  How many active nodes are bus-on? You need at least 2 active nodes for CAN bus to work.

    A receiving node may transmit a recessive to indicate that it did not receive a valid frame, but another node that did receive a valid frame may override this with a dominant.

    If a receiving node does not receive a correct CAN frame, it won't ACK but it will send and error frame. This is, iirc, 6 dominant bit times. (violates stuffing rule, is an error frame)

    Either all nodes receive the message, or no nodes receive the message. If some nodes do, they will discard it on an error frame.