Problem with CanBus (STM32F407) when alone on bus.

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

jkozien
Posts: 6
Joined: Fri Jan 29, 2016 12:48 pm

Re: Problem with CanBus (STM32F407) when alone on bus.

Post by jkozien »

I add CAN_MCR_ABOM to my configuration and now everything is working properly.
Thank you very much.
Jaroslaw
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: Problem with CanBus (STM32F407) when alone on bus.

Post by rew »

I don't know by heart what ABOM is, but reading your problem description I had the impression that you configured your 407 to wait for confirmation from the CANBUS, and then somehow things don't start working again after you've connected other devices, probably because you don't clear the error.
avrhack
Posts: 140
Joined: Tue Dec 24, 2013 1:42 pm
Has thanked: 17 times
Been thanked: 3 times

Re: Problem with CanBus (STM32F407) when alone on bus.

Post by avrhack »

rew wrote:I don't know by heart what ABOM is, but reading your problem description I had the impression that you configured your 407 to wait for confirmation from the CANBUS, and then somehow things don't start working again after you've connected other devices, probably because you don't clear the error.


ABOM = Automatic Bus Off Management

CAN bus devices need to sync with the bus so there's a very specific protocol defined by the standard about new devices joining the bus and watching for xxxx cycles before being allowed to transmit. A single device on a bus is an unusual and special case of course - any transmission by such a device will error as there is nothing else on the bus. ABOM ensures that this (or indeed an error for any other reason with multiple devices on the bus) is automatically restarted by the CAN hardware in the STM32 rather than needing manual restart.

Quote from the CAN spec on this single-node case.....

Code: Select all

If during start-up only 1 node is online, and if this node transmits some message, it will get no acknowledgment, detect an error and repeat the message. It can become ’error passive’ but not ’bus off’ due to this reason.


In other words, with one device on the bus, it will always get an error and turn off. The OP's original stopCAN/startCAN effectively reset the CAN hardware which is necessary if ABOM is not set. If ABOM is set, it automatically does that for you and tries again.
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: Problem with CanBus (STM32F407) when alone on bus.

Post by rew »

Thanks for your explanation. So I was right in that the STM detected the error and, without ABOM, was waiting for a "manual" restart.
avrhack
Posts: 140
Joined: Tue Dec 24, 2013 1:42 pm
Has thanked: 17 times
Been thanked: 3 times

Re: Problem with CanBus (STM32F407) when alone on bus.

Post by avrhack »

rew wrote:Thanks for your explanation. So I was right in that the STM detected the error and, without ABOM, was waiting for a "manual" restart.


Exactly
Post Reply