CARME-M4 BSP  V1.5
CAN Bus Error management functions

CAN Bus Error management functions. More...

+ Collaboration diagram for CAN Bus Error management functions:

Functions

uint8_t CAN_GetLastErrorCode (CAN_TypeDef *CANx)
 Returns the CANx's last error code (LEC). More...
 
uint8_t CAN_GetReceiveErrorCounter (CAN_TypeDef *CANx)
 Returns the CANx Receive Error Counter (REC). More...
 
uint8_t CAN_GetLSBTransmitErrorCounter (CAN_TypeDef *CANx)
 Returns the LSB of the 9-bit CANx Transmit Error Counter(TEC). More...
 

Detailed Description

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.

Function Documentation

uint8_t CAN_GetLastErrorCode ( CAN_TypeDef *  CANx)

Returns the CANx's last error code (LEC).

Parameters
CANxwhere x can be 1 or 2 to select the CAN peripheral.
Return values
Errorcode:
  • 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

Definition at line 1040 of file stm32f4xx_can.c.

uint8_t CAN_GetLSBTransmitErrorCounter ( CAN_TypeDef *  CANx)

Returns the LSB of the 9-bit CANx Transmit Error Counter(TEC).

Parameters
CANxwhere x can be 1 or 2 to to select the CAN peripheral.
Return values
LSBof the 9-bit CAN Transmit Error Counter.

Definition at line 1085 of file stm32f4xx_can.c.

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
CANxwhere x can be 1 or 2 to to select the CAN peripheral.
Return values
CANReceive Error Counter.

Definition at line 1065 of file stm32f4xx_can.c.