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). The following code snippets are taken from can_demo.c
found in $:\Micrium\Software\uC-CAN\Examples\<OS> where 'OS' is either NONE (for No-OS), uCOS-II or uCOS-III.
#include "can_bus.h" extern CANBUS_PARA CanCfg; void App_CAN_Startup (void) { CPU_INT16S can_err; ... [1] CanBusInit(0L); [2] /* Initialize CAN Objects & Bus Layer. */ can_err = CanBusEnable((CANBUS_PARA *)&CanCfg); [3] /* Enable CAN Device according to Configuration. */ if (can_err != CAN_ERR_NONE) { while (1); [4] /* Failure Handling Here. */ } }