Most proper way of detecting CAN BUS OFF condition?
Dear ST community,
We are running a CAN network with a lot of nodes (>200) using the STM32F107VCTx chip (and MCP2551 transciever) all receiving instructions from a central linux embedded computer with a MCP2515 CAN Controller.
Sometimes the nodes stop replying on messages and we need to power cycle the nodes in order for communication to resume. We suspect the nodes have gone bus-off, but want a bit more information in order to be completely sure.
From the STM32 manual it seems that the CAN error states can be derived from reading the TEC from the CAN_ESR register.
I have two questions:
1. Is there any example code somewhere that showcase a separate driver accessing these registers?
2. Is there any other more proper way track the CAN error states from my parts of the code, i.e. some HAL library "get_CAN_state" function I could call that handles the registry access and state translation for me?
Many thanks in advance!
BR,
David