CAN Bus Error management functions.
More...
CAN Bus Error management functions.
===============================================================================
##### CAN Bus Error management functions #####
===============================================================================
[..] This section provides functions allowing to
(#) Return the CANx's last error code (LEC)
(#) Return the CANx Receive Error Counter (REC)
(#) Return the LSB of the 9-bit CANx Transmit Error Counter(TEC).
[..]
(@) If TEC is greater than 255, The CAN is in bus-off state.
(@) If REC or TEC are greater than 96, an Error warning flag occurs.
(@) If REC or TEC are greater than 127, an Error Passive Flag occurs.
uint8_t CAN_GetLastErrorCode |
( |
CAN_TypeDef * |
CANx | ) |
|
Returns the CANx's last error code (LEC).
- Parameters
-
CANx,: | where x can be 1 to select the CAN1 peripheral. |
- Return values
-
Error | code:
- CAN_ErrorCode_NoErr: No Error
- CAN_ErrorCode_StuffErr: Stuff Error
- CAN_ErrorCode_FormErr: Form Error
- CAN_ErrorCode_ACKErr : Acknowledgment Error
- CAN_ErrorCode_BitRecessiveErr: Bit Recessive Error
- CAN_ErrorCode_BitDominantErr: Bit Dominant Error
- CAN_ErrorCode_CRCErr: CRC Error
- CAN_ErrorCode_SoftwareSetErr: Software Set Error
|
uint8_t CAN_GetLSBTransmitErrorCounter |
( |
CAN_TypeDef * |
CANx | ) |
|
Returns the LSB of the 9-bit CANx Transmit Error Counter(TEC).
- Parameters
-
CANx,: | where x can be 1 or 2 to to select the CAN peripheral. |
- Return values
-
LSB | of the 9-bit CAN Transmit Error Counter. |
uint8_t CAN_GetReceiveErrorCounter |
( |
CAN_TypeDef * |
CANx | ) |
|
Returns the CANx Receive Error Counter (REC).
- Note
- In case of an error during reception, this counter is incremented by 1 or by 8 depending on the error condition as defined by the CAN standard. After every successful reception, the counter is decremented by 1 or reset to 120 if its value was higher than 128. When the counter value exceeds 127, the CAN controller enters the error passive state.
- Parameters
-
CANx,: | where x can be 1 or 2 to to select the CAN peripheral. |
- Return values
-
CAN | Receive Error Counter. |