STM32F4 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F4 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Enumerator Groups
CAN Bus Error management functions

CAN Bus Error management functions. More...

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).
   
   @note If TEC is greater than 255, The CAN is in bus-off state.
   @note if REC or TEC are greater than 96, an Error warning flag occurs.
   @note 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
CANx,:where 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
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
LSBof 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
CANReceive Error Counter.