/
Reception of a CAN frame
Reception of a CAN frame
If a task wants to receive a CAN frame, the function CanBusRead()
must be called. The following steps will be performed:
Figure - CAN reception
- With the receive complete interrupt of the CAN controller, the function
CanBusRxHandler()
shall be activated. - The handler uses the low level device driver function
Read()
to get the CAN frame from CAN controller. - The CAN frame will be copied to the internal can receive queue.
CANOS_P
ostRxFrame is called to indicated the new received frame and the handler exits.
Asynchronous to this actions, a task can wait for CAN frames:
- The function is
CanBusRead()
pending on the receive semaphore with the configured timeout. The timeout must be set withCanBusIoCtl()
CANBUS_SET_RX_TIMEOUT
. - If a CAN frame is received within the timeout, the content will be copied to the given. In this case the function exists normally. If a timeout is detected, the function exits with an error code.