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
This commit is contained in:
Darian Leung
2018-08-28 21:13:20 +08:00
parent ba17648aea
commit dc3fa14a26
5 changed files with 117 additions and 54 deletions

View File

@@ -574,6 +574,23 @@ use of the :cpp:func:`can_stop` and :cpp:func:`can_driver_uninstall` functions.
return;
}
Multiple ID Filter Configuration
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The acceptance mask in :cpp:type:`can_filter_config_t` can be configured such that
two or more IDs will be accepted for a single filter. For a particular filter to
accept multiple IDs, the conflicting bit positions amongst the IDs must be set
in the acceptance mask. The acceptance code can be set to any one of the IDs.
The following example shows how the calculate the acceptance mask given multiple
IDs::
ID1 = 11'b101 1010 0000
ID2 = 11'b101 1010 0001
ID3 = 11'b101 1010 0100
ID4 = 11'b101 1010 1000
//Acceptance Mask
MASK = 11'b000 0000 1101
Application Examples
^^^^^^^^^^^^^^^^^^^^
@@ -581,19 +598,19 @@ Application Examples
**Network Example:** The CAN Network example demonstrates communication between
two ESP32s using the CAN driver API. One CAN node acts as a network master initiate
and ceasing the transfer of a data from another CAN node acting as a network slave.
The example can be found via :example:`examples/peripheral/can/can_network`.
The example can be found via :example:`peripherals/can/can_network`.
**Alert and Recovery Example:** This example demonstrates how to use the CAN driver's
alert and bus recovery API. The example purposely introduces errors on the CAN
bus to put the CAN controller into the Bus-Off state. An alert is used to detect
the Bus-Off state and trigger the bus recovery process. The example can be found
via :example:`examples/peripheral/can/can_alert_and_recovery`.
via :example:`peripherals/can/can_alert_and_recovery`.
**Self Test Example:** This example uses the No Acknowledge Mode and Self Reception
Request to cause the CAN controller to send and simultaneously receive a series
of messages. This example can be used to verify if the connections between the CAN
controller and the external transceiver are working correctly. The example can be
found via :example:`examples/peripheral/can/can_self_test`.
found via :example:`peripherals/can/can_self_test`.
.. ---------------------------- API Reference ----------------------------------