Martin Johnson / STM32F3-Discovery

Dependents:   Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more

Embed: (wiki syntax)

« Back to documentation index

CAN Bus Error management functions

CAN Bus Error management functions
[CAN_Private_Functions]

CAN Bus Error management functions. More...

Functions

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

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:
CANx,:where x can be 1 to select the CAN1 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 1014 of file stm32f30x_can.c.

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 select the CAN peripheral.
Return values:
LSBof the 9-bit CAN Transmit Error Counter.

Definition at line 1059 of file stm32f30x_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:
CANx,:where x can be 1 or 2 to select the CAN peripheral.
Return values:
CANReceive Error Counter.

Definition at line 1039 of file stm32f30x_can.c.