CAN
The principal operation of SocketCAN in the User VM can be found in the system architecture section.
The code running in the User VM, referred to as the User Code interacts with the CAN subsystems in two ways, firstly by sending Messaging requests to the CAN service in the ACU6 Base System and secondly by normal SocketCAN APIs against the virtual PV-CAN interface inside of the User VM
The diagram below illustrates a typical flow where User Code initializes CAN interfaces, opens a socket and sends and receives any number of frames and then closes the CAN interface.
Configuration
The central functionality of the CAN service is configuration of the physical CAN interface(s) of the device. The main way to configure a CAN interface is via the ipc_msg_can_configure_req AIPC message. For 2.0B (“Classic”) CAN the only configurable parameter is the data-rate, for CAN FD the configuration must include both the nominal data rate and the increased data data-rate.
In addition a CAN interface can be configured as a wake-up source from Sleep and Stand-by power states (see Power Modes and Handling) by using the ipc_msg_can_set_wakeup_req AIPC message.
Status and bus state handling
The bus state can be polled by the ipc_msg_can_status_req AIPC message.
If the bus enters an error state such as BUS_OFF the interface needs to be reset to recover the bus, which can be done with the ipc_msg_can_reset_req AIPC message.