OVMS3-idf/examples/peripherals/can/can_alert_and_recovery
Darian Leung a049e02d96 can: Refactor CAN to use HAL and LowLevel layers
The following commit refactors the CAN driver such that
it is split into HAL and Lowlevel layers. The following
changes have also been made:

- Added bit field members to can_message_t as alternative
  to message flags. Updated examples and docs accordingly
- Register field names and fields of can_dev_t updated
2020-01-09 16:13:51 +08:00
..
main can: Refactor CAN to use HAL and LowLevel layers 2020-01-09 16:13:51 +08:00
CMakeLists.txt ci: support to build esp32s2beta simple examples 2019-07-08 09:16:06 +08:00
example_test.py test: update example and unit tests with new import roles: 2019-12-07 10:34:54 +08:00
Makefile CAN Driver 2018-07-04 14:01:57 +08:00
README.md CAN Driver 2018-07-04 14:01:57 +08:00

CAN Alert and Recovery Example

Overview

The CAN Alert and Recovery Example demonstrates the usage of alerts and bus recovery in the CAN driver. This example requires only a single ESP32 module to run.

The CAN Alert and Recovery Example will do the following...

  1. Initialize and start the CAN driver on the ESP32 module
  2. Repeatedly transmit messages (no acknowledgement required)
  3. Reconfigure alerts to detect bus-off state
  4. Purposely trigger errors on transmissions
  5. Detect Bus Off condition
  6. Initiate bus recovery
  7. Deinitialize CAN driver on ESP32 module

External Transceiver and Pin Assignment

The CAN controller in the ESP32 does not contain an internal transceiver. Therefore users are responsible for providing an external transceiver compatible with the physical layer specifications of their target ISO standard (such as SN65HVD23X transceivers for ISO 11898-2 compatibility)

The CAN controller in the ESP32 represents dominant bits to the transceiver as logic low, and recessive bits as logic high. The Alert and Recovery Example utilizes the following default pin assignments

  • TX Pin is routed to GPIO21
  • RX Pin is routed to GPIO22