Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
Interrupts and flags management functions
[CAN_Private_Functions]
Interrupts and flags management functions. More...
Functions | |
| void | CAN_ITConfig (CAN_TypeDef *CANx, uint32_t CAN_IT, FunctionalState NewState) |
| Enables or disables the specified CANx interrupts. | |
| FlagStatus | CAN_GetFlagStatus (CAN_TypeDef *CANx, uint32_t CAN_FLAG) |
| Checks whether the specified CAN flag is set or not. | |
| void | CAN_ClearFlag (CAN_TypeDef *CANx, uint32_t CAN_FLAG) |
| Clears the CAN's pending flags. | |
| ITStatus | CAN_GetITStatus (CAN_TypeDef *CANx, uint32_t CAN_IT) |
| Checks whether the specified CANx interrupt has occurred or not. | |
| void | CAN_ClearITPendingBit (CAN_TypeDef *CANx, uint32_t CAN_IT) |
| Clears the CANx's interrupt pending bits. | |
Detailed Description
Interrupts and flags management functions.
===============================================================================
##### Interrupts and flags management functions #####
===============================================================================
[..] This section provides functions allowing to configure the CAN Interrupts
and to get the status and clear flags and Interrupts pending bits.
[..] The CAN provides 14 Interrupts sources and 15 Flags:
*** Flags ***
=============
[..] The 15 flags can be divided on 4 groups:
(+) Transmit Flags:
(++) CAN_FLAG_RQCP0.
(++) CAN_FLAG_RQCP1.
(++) CAN_FLAG_RQCP2: Request completed MailBoxes 0, 1 and 2 Flags
Set when the last request (transmit or abort) has
been performed.
(+) Receive Flags:
(++) CAN_FLAG_FMP0.
(++) CAN_FLAG_FMP1: FIFO 0 and 1 Message Pending Flags;
Set to signal that messages are pending in the receive FIFO.
These Flags are cleared only by hardware.
(++) CAN_FLAG_FF0.
(++) CAN_FLAG_FF1: FIFO 0 and 1 Full Flags;
Set when three messages are stored in the selected FIFO.
(++) CAN_FLAG_FOV0.
(++) CAN_FLAG_FOV1: FIFO 0 and 1 Overrun Flags;
Set when a new message has been received and passed the filter
while the FIFO was full.
(+) Operating Mode Flags:
(++) CAN_FLAG_WKU: Wake up Flag;
Set to signal that a SOF bit has been detected while the CAN
hardware was in Sleep mode.
(++) CAN_FLAG_SLAK: Sleep acknowledge Flag;
Set to signal that the CAN has entered Sleep Mode.
(+) Error Flags:
(++) CAN_FLAG_EWG: Error Warning Flag;
Set when the warning limit has been reached (Receive Error Counter
or Transmit Error Counter greater than 96).
This Flag is cleared only by hardware.
(++) CAN_FLAG_EPV: Error Passive Flag;
Set when the Error Passive limit has been reached (Receive Error
Counter or Transmit Error Counter greater than 127).
This Flag is cleared only by hardware.
(++) CAN_FLAG_BOF: Bus-Off Flag;
Set when CAN enters the bus-off state. The bus-off state is
entered on TEC overflow, greater than 255.
This Flag is cleared only by hardware.
(++) CAN_FLAG_LEC: Last error code Flag;
Set If a message has been transferred (reception or transmission)
with error, and the error code is hold.
*** Interrupts ***
==================
[..] The 14 interrupts can be divided on 4 groups:
(+) Transmit interrupt:
(++) CAN_IT_TME: Transmit mailbox empty Interrupt;
If enabled, this interrupt source is pending when no transmit
request are pending for Tx mailboxes.
(+) Receive Interrupts:
(++) CAN_IT_FMP0.
(++) CAN_IT_FMP1: FIFO 0 and FIFO1 message pending Interrupts;
If enabled, these interrupt sources are pending when messages
are pending in the receive FIFO.
The corresponding interrupt pending bits are cleared only by hardware.
(++) CAN_IT_FF0.
(++) CAN_IT_FF1: FIFO 0 and FIFO1 full Interrupts;
If enabled, these interrupt sources are pending when three messages
are stored in the selected FIFO.
(++) CAN_IT_FOV0.
(++) CAN_IT_FOV1: FIFO 0 and FIFO1 overrun Interrupts;
If enabled, these interrupt sources are pending when a new message
has been received and passed the filter while the FIFO was full.
(+) Operating Mode Interrupts:
(++) CAN_IT_WKU: Wake-up Interrupt;
If enabled, this interrupt source is pending when a SOF bit has
been detected while the CAN hardware was in Sleep mode.
(++) CAN_IT_SLK: Sleep acknowledge Interrupt:
If enabled, this interrupt source is pending when the CAN has
entered Sleep Mode.
(+) Error Interrupts:
(++) CAN_IT_EWG: Error warning Interrupt;
If enabled, this interrupt source is pending when the warning limit
has been reached (Receive Error Counter or Transmit Error Counter=96).
(++) CAN_IT_EPV: Error passive Interrupt;
If enabled, this interrupt source is pending when the Error Passive
limit has been reached (Receive Error Counter or Transmit Error Counter>127).
(++) CAN_IT_BOF: Bus-off Interrupt;
If enabled, this interrupt source is pending when CAN enters
the bus-off state. The bus-off state is entered on TEC overflow,
greater than 255.
This Flag is cleared only by hardware.
(++) CAN_IT_LEC: Last error code Interrupt;
If enabled, this interrupt source is pending when a message has
been transferred (reception or transmission) with error and the
error code is hold.
(++) CAN_IT_ERR: Error Interrupt;
If enabled, this interrupt source is pending when an error condition
is pending.
[..] Managing the CAN controller events:
The user should identify which mode will be used in his application to manage
the CAN controller events: Polling mode or Interrupt mode.
(+) In the Polling Mode it is advised to use the following functions:
(++) CAN_GetFlagStatus() : to check if flags events occur.
(++) CAN_ClearFlag() : to clear the flags events.
(+) In the Interrupt Mode it is advised to use the following functions:
(++) CAN_ITConfig() : to enable or disable the interrupt source.
(++) CAN_GetITStatus() : to check if Interrupt occurs.
(++) CAN_ClearITPendingBit() : to clear the Interrupt pending Bit
(corresponding Flag).
This function has no impact on CAN_IT_FMP0 and CAN_IT_FMP1 Interrupts
pending bits since there are cleared only by hardware.
Function Documentation
| void CAN_ClearFlag | ( | CAN_TypeDef * | CANx, |
| uint32_t | CAN_FLAG | ||
| ) |
Clears the CAN's pending flags.
- Parameters:
-
CANx,: where x can be 1 or 2 to select the CAN peripheral. CAN_FLAG,: specifies the flag to clear. This parameter can be one of the following values: - CAN_FLAG_RQCP0: Request MailBox0 Flag
- CAN_FLAG_RQCP1: Request MailBox1 Flag
- CAN_FLAG_RQCP2: Request MailBox2 Flag
- CAN_FLAG_FF0: FIFO 0 Full Flag
- CAN_FLAG_FOV0: FIFO 0 Overrun Flag
- CAN_FLAG_FF1: FIFO 1 Full Flag
- CAN_FLAG_FOV1: FIFO 1 Overrun Flag
- CAN_FLAG_WKU: Wake up Flag
- CAN_FLAG_SLAK: Sleep acknowledge Flag
- CAN_FLAG_LEC: Last error code Flag
- Return values:
-
None
Definition at line 1358 of file stm32f30x_can.c.
| void CAN_ClearITPendingBit | ( | CAN_TypeDef * | CANx, |
| uint32_t | CAN_IT | ||
| ) |
Clears the CANx's interrupt pending bits.
- Parameters:
-
CANx,: where x can be 1 or 2 to select the CAN peripheral. CAN_IT,: specifies the interrupt pending bit to clear. This parameter can be one of the following values: - CAN_IT_TME: Transmit mailbox empty Interrupt
- CAN_IT_FF0: FIFO 0 full Interrupt
- CAN_IT_FOV0: FIFO 0 overrun Interrupt
- CAN_IT_FF1: FIFO 1 full Interrupt
- CAN_IT_FOV1: FIFO 1 overrun Interrupt
- CAN_IT_WKU: Wake-up Interrupt
- CAN_IT_SLK: Sleep acknowledge Interrupt
- CAN_IT_EWG: Error warning Interrupt
- CAN_IT_EPV: Error passive Interrupt
- CAN_IT_BOF: Bus-off Interrupt
- CAN_IT_LEC: Last error code Interrupt
- CAN_IT_ERR: Error Interrupt
- Return values:
-
None
Definition at line 1522 of file stm32f30x_can.c.
| FlagStatus CAN_GetFlagStatus | ( | CAN_TypeDef * | CANx, |
| uint32_t | CAN_FLAG | ||
| ) |
Checks whether the specified CAN flag is set or not.
- Parameters:
-
CANx,: where x can be 1 or 2 to select the CAN peripheral. CAN_FLAG,: specifies the flag to check. This parameter can be one of the following values: - CAN_FLAG_RQCP0: Request MailBox0 Flag
- CAN_FLAG_RQCP1: Request MailBox1 Flag
- CAN_FLAG_RQCP2: Request MailBox2 Flag
- CAN_FLAG_FMP0: FIFO 0 Message Pending Flag
- CAN_FLAG_FF0: FIFO 0 Full Flag
- CAN_FLAG_FOV0: FIFO 0 Overrun Flag
- CAN_FLAG_FMP1: FIFO 1 Message Pending Flag
- CAN_FLAG_FF1: FIFO 1 Full Flag
- CAN_FLAG_FOV1: FIFO 1 Overrun Flag
- CAN_FLAG_WKU: Wake up Flag
- CAN_FLAG_SLAK: Sleep acknowledge Flag
- CAN_FLAG_EWG: Error Warning Flag
- CAN_FLAG_EPV: Error Passive Flag
- CAN_FLAG_BOF: Bus-Off Flag
- CAN_FLAG_LEC: Last error code Flag
- Return values:
-
The new state of CAN_FLAG (SET or RESET).
Definition at line 1258 of file stm32f30x_can.c.
| ITStatus CAN_GetITStatus | ( | CAN_TypeDef * | CANx, |
| uint32_t | CAN_IT | ||
| ) |
Checks whether the specified CANx interrupt has occurred or not.
- Parameters:
-
CANx,: where x can be 1 or 2 to select the CAN peripheral. CAN_IT,: specifies the CAN interrupt source to check. This parameter can be one of the following values: - CAN_IT_TME: Transmit mailbox empty Interrupt
- CAN_IT_FMP0: FIFO 0 message pending Interrupt
- CAN_IT_FF0: FIFO 0 full Interrupt
- CAN_IT_FOV0: FIFO 0 overrun Interrupt
- CAN_IT_FMP1: FIFO 1 message pending Interrupt
- CAN_IT_FF1: FIFO 1 full Interrupt
- CAN_IT_FOV1: FIFO 1 overrun Interrupt
- CAN_IT_WKU: Wake-up Interrupt
- CAN_IT_SLK: Sleep acknowledge Interrupt
- CAN_IT_EWG: Error warning Interrupt
- CAN_IT_EPV: Error passive Interrupt
- CAN_IT_BOF: Bus-off Interrupt
- CAN_IT_LEC: Last error code Interrupt
- CAN_IT_ERR: Error Interrupt
- Return values:
-
The current state of CAN_IT (SET or RESET).
Definition at line 1418 of file stm32f30x_can.c.
| void CAN_ITConfig | ( | CAN_TypeDef * | CANx, |
| uint32_t | CAN_IT, | ||
| FunctionalState | NewState | ||
| ) |
Enables or disables the specified CANx interrupts.
- Parameters:
-
CANx,: where x can be 1 or 2 to select the CAN peripheral. CAN_IT,: specifies the CAN interrupt sources to be enabled or disabled. This parameter can be: - CAN_IT_TME: Transmit mailbox empty Interrupt
- CAN_IT_FMP0: FIFO 0 message pending Interrupt
- CAN_IT_FF0: FIFO 0 full Interrupt
- CAN_IT_FOV0: FIFO 0 overrun Interrupt
- CAN_IT_FMP1: FIFO 1 message pending Interrupt
- CAN_IT_FF1: FIFO 1 full Interrupt
- CAN_IT_FOV1: FIFO 1 overrun Interrupt
- CAN_IT_WKU: Wake-up Interrupt
- CAN_IT_SLK: Sleep acknowledge Interrupt
- CAN_IT_EWG: Error warning Interrupt
- CAN_IT_EPV: Error passive Interrupt
- CAN_IT_BOF: Bus-off Interrupt
- CAN_IT_LEC: Last error code Interrupt
- CAN_IT_ERR: Error Interrupt
NewState,: new state of the CAN interrupts. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 1218 of file stm32f30x_can.c.
Generated on Tue Jul 12 2022 17:34:45 by
1.7.2