Enabling the CAN bus interface means, that the CAN controller will go in active mode and will be ready for communication. The CAN Bus that we configured in the previous section will be the source of our example. (For more the previous section click Here)
Example
The CAN bus (we have configured in the chapter above) shall be enabled.
Source code
Description
- Local variable to hold the error code of
CanBusEnable()
function call. - Initialize the CAN bus management layer. This function call must be performed one time (and only one time) after reset of the system.
- Enable the configured CAN bus. The configuration variable
CanCfg
is assumed to be the global (constant) variable as described in Configure the CAN Bus.