OVMS3-idf/examples/peripherals/can/can_self_test
Darian Leung dc3fa14a26 CAN: Add pm_lock, fix gpio bug, update docs
This commit does the following

- Add power management lock to CAN driver so that APB frequency does not change
whilst CAN driver is in use
- Fix incorrect flag in can_transmit()
- Refactor can_driver_install() and can_driver_uninstall() so that critical sections
are shorter
- Fix CAN gpio configuration bug on RX pin. Closes #2302
- Add docs about multiple ID configuration and fix example links
2018-09-01 02:46:05 +08:00
..
main CAN: Add pm_lock, fix gpio bug, update docs 2018-09-01 02:46:05 +08:00
example_test.py CAN Driver 2018-07-04 14:01:57 +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 Self Test Example

Overview

The CAN Self Test Example demonstrates the self testing capabilities of the ESP32 CAN peripheral and only requires a single ESP32 module to run. The Self Test Example can be used to verify that the wiring between the ESP32 and an external transceiver operates correctly.

The CAN Self Test Example will do the following over multiple iterations:

  1. Start the CAN driver
  2. Simultaneously transmit and receive messages using the self reception request.
  3. Stop the CAN driver

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 Self Test Example utilizes the following default pin assignments

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

Note

If the Self Test Example does not receive any messages, it is likely that the wiring between the ESP32 and the external transceiver is incorrect. To verify that the CAN controller in the ESP32 is operating correctly, users can bypass the external transceiver by connecting the TX Pin directly to the RX Pin when running the Self Test Example.