This file provides firmware functions to manage the following functionalities of the Controller Area Network (CAN) peripheral: More...
#include "stm32f4xx_hal.h"
Go to the source code of this file.
This file provides firmware functions to manage the following functionalities of the Controller Area Network (CAN) peripheral:
============================================================================== ##### User NOTE ##### ============================================================================== [..] (#) This HAL CAN driver is deprecated, it contains some CAN Tx/Rx FIFO management limitations. Another HAL CAN driver version has been designed with new API's, to fix these limitations. ============================================================================== ##### How to use this driver ##### ============================================================================== [..] (#) Enable the CAN controller interface clock using __HAL_RCC_CAN1_CLK_ENABLE() for CAN1, __HAL_RCC_CAN2_CLK_ENABLE() for CAN2 and __HAL_RCC_CAN3_CLK_ENABLE() for CAN3 -@- In case you are using CAN2 only, you have to enable the CAN1 clock. (#) CAN pins configuration (++) Enable the clock for the CAN GPIOs using the following function: __GPIOx_CLK_ENABLE() (++) Connect and configure the involved CAN pins to AF9 using the following function HAL_GPIO_Init() (#) Initialize and configure the CAN using CAN_Init() function. (#) Transmit the desired CAN frame using HAL_CAN_Transmit() function. (#) Or transmit the desired CAN frame using HAL_CAN_Transmit_IT() function. (#) Receive a CAN frame using HAL_CAN_Receive() function. (#) Or receive a CAN frame using HAL_CAN_Receive_IT() function. *** Polling mode IO operation *** ================================= [..] (+) Start the CAN peripheral transmission and wait the end of this operation using HAL_CAN_Transmit(), at this stage user can specify the value of timeout according to his end application (+) Start the CAN peripheral reception and wait the end of this operation using HAL_CAN_Receive(), at this stage user can specify the value of timeout according to his end application *** Interrupt mode IO operation *** =================================== [..] (+) Start the CAN peripheral transmission using HAL_CAN_Transmit_IT() (+) Start the CAN peripheral reception using HAL_CAN_Receive_IT() (+) Use HAL_CAN_IRQHandler() called under the used CAN Interrupt subroutine (+) At CAN end of transmission HAL_CAN_TxCpltCallback() function is executed and user can add his own code by customization of function pointer HAL_CAN_TxCpltCallback (+) In case of CAN Error, HAL_CAN_ErrorCallback() function is executed and user can add his own code by customization of function pointer HAL_CAN_ErrorCallback *** CAN HAL driver macros list *** ============================================= [..] Below the list of most used macros in CAN HAL driver. (+) __HAL_CAN_ENABLE_IT: Enable the specified CAN interrupts (+) __HAL_CAN_DISABLE_IT: Disable the specified CAN interrupts (+) __HAL_CAN_GET_IT_SOURCE: Check if the specified CAN interrupt source is enabled or disabled (+) __HAL_CAN_CLEAR_FLAG: Clear the CAN's pending flags (+) __HAL_CAN_GET_FLAG: Get the selected CAN's flag status [..] (@) You can refer to the CAN Legacy HAL driver header file for more useful macros
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file stm32f469/stm32f469i-disco/Drivers/STM32F4xx_HAL_Driver/Src/Legacy/stm32f4xx_hal_can.c.