### SPDIFRX HAL Driver Usage Guide Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F439xx_User_Manual/stm32f4xx__hal__spdifrx_8c.html Comprehensive guide on how to initialize and use the SPDIFRX HAL driver, covering low-level resource configuration (MspInit), NVIC and DMA setup, and various operation modes (Polling, Interrupt, DMA). ```APIDOC How to use this driver: 1. Declare SPDIFRX_HandleTypeDef handle structure. 2. Initialize low-level resources by implementing HAL_SPDIFRX_MspInit() API: - Enable the SPDIFRX interface clock. - SPDIFRX pins configuration: - Enable the clock for the SPDIFRX GPIOs. - Configure these SPDIFRX pins as alternate function pull-up. - NVIC configuration (if you need to use interrupt process): - Configure the SPDIFRX interrupt priority. - Enable the NVIC SPDIFRX IRQ handle. - DMA Configuration (if you need to use DMA process): - Declare a DMA handle structure for the reception of the Data Flow channel. - Declare a DMA handle structure for the reception of the Control Flow channel. - Enable the DMAx interface clock. - Configure the declared DMA handle structure CtrlRx/DataRx with the required parameters. - Configure the DMA Channel. - Associate the initialized DMA handle to the SPDIFRX DMA CtrlRx/DataRx handle. - Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA CtrlRx/DataRx channel. 3. Program the input selection, re-tries number, wait for activity, channel status selection, data format, stereo mode and masking of user bits using HAL_SPDIFRX_Init() function. Notes: - The specific SPDIFRX interrupts (RXNE/CSRNE and Error Interrupts) will be managed using the macros __SPDIFRX_ENABLE_IT() and __SPDIFRX_DISABLE_IT() inside the receive process. - Make sure that ck_spdif clock is configured. Operation Modes: Polling mode for reception operation (for debug purpose): - HAL_SPDIFRX_ReceiveDataFlow(): Receive data flow in blocking mode. - HAL_SPDIFRX_ReceiveControlFlow(): Receive control flow of data in blocking mode. Interrupt mode for reception operation: - HAL_SPDIFRX_ReceiveDataFlow_IT(): Receive an amount of data (Data Flow) in non blocking mode. - HAL_SPDIFRX_ReceiveControlFlow_IT(): Receive an amount of data (Control Flow) in non blocking mode. - HAL_SPDIFRX_RxHalfCpltCallback(): Executed at reception end of half transfer (customizable). - HAL_SPDIFRX_RxCpltCallback(): Executed at reception end of transfer (customizable). - HAL_SPDIFRX_ErrorCallback(): Executed in case of transfer Error (customizable). ``` -------------------------------- ### STM32F4xx LPTIM HAL Driver Usage Guide Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F417xx_User_Manual/stm32f4xx__hal__lptim_8c.html Provides a step-by-step guide on how to initialize and use the Low Power Timer (LPTIM) HAL driver, covering low-level resource setup, peripheral configuration, and various operational modes. ```APIDOC ##### How to use this driver ##### The LPTIM HAL driver can be used as follows: 1. Initialize LPTIM low-level resources (HAL_LPTIM_MspInit): - Enable LPTIM interface clock: __HAL_RCC_LPTIMx_CLK_ENABLE(). - For interrupts (e.g., HAL_LPTIM_PWM_Start_IT()): - Configure LPTIM interrupt priority: HAL_NVIC_SetPriority(). - Enable LPTIM IRQ handler: HAL_NVIC_EnableIRQ(). - Call HAL_LPTIM_IRQHandler() in LPTIM IRQ handler. 2. Initialize LPTIM HAL (HAL_LPTIM_Init): - Configures: - Instance: LPTIM1. - Clock: - Source: ULPTIM input (IN1) or internal clock (APB, LSE, LSI). - Prescaler: Select clock divider. - UltraLowPowerClock (if ULPTIM selected as source): - Polarity: Active edge polarity for counter unit. - SampleTime: Clock sampling time for glitch filter. - Trigger: - Source: Software or hardware triggers. - ActiveEdge: Only for hardware trigger. - SampleTime: Trigger sampling time for glitch filter. - OutputPolarity: 2 opposite polarities. - UpdateMode: Immediate or after current period. 3. Available Modes: - PWM Mode: Generate PWM signal. - Functions: HAL_LPTIM_PWM_Start(), HAL_LPTIM_PWM_Start_IT(). - One Pulse Mode: Generate pulse in response to stimulus. - Functions: HAL_LPTIM_OnePulse_Start(), HAL_LPTIM_OnePulse_Start_IT(). - Set once Mode: Output level changes on compare match. - Functions: HAL_LPTIM_SetOnce_Start(), HAL_LPTIM_SetOnce_Start_IT(). - Encoder Mode: Use encoder interface (LPTIM1 only). - Functions: HAL_LPTIM_Encoder_Start(), HAL_LPTIM_Encoder_Start_IT(). - Time out Mode: An active edge on one selected trigger input rests ``` -------------------------------- ### CRYP HAL Driver Initialization and Usage Guide Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F479xx_User_Manual/stm32f4xx__hal__cryp_8c.html This guide provides step-by-step instructions on how to initialize and use the CRYP HAL driver, covering clock enablement, interrupt configuration, and DMA setup for data transfers. ```APIDOC The CRYP HAL driver can be used in CRYP or TinyAES IP as follows: (#)Initialize the CRYP low level resources by implementing the HAL_CRYP_MspInit(): (##) Enable the CRYP interface clock using __HAL_RCC_CRYP_CLK_ENABLE()or __HAL_RCC_AES_CLK_ENABLE for TinyAES IP (##) In case of using interrupts (e.g. HAL_CRYP_Encrypt_IT()) (+++) Configure the CRYP interrupt priority using HAL_NVIC_SetPriority() (+++) Enable the CRYP IRQ handler using HAL_NVIC_EnableIRQ() (+++) In CRYP IRQ handler, call HAL_CRYP_IRQHandler() (##) In case of using DMA to control data transfer (e.g. HAL_CRYP_Encrypt_DMA()) (+++) Enable the DMAx interface clock using __RCC_DMAx_CLK_ENABLE() (+++) Configure and enable two DMA streams one for managing data transfer from memory to peripheral (input stream) and another stream for managing data transfer from peripheral to memory (output stream) (+++) Associate the initialized DMA handle to the CRYP DMA handle using __HAL_LINKDMA() (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the two DMA Streams. The output stream should have higher ``` -------------------------------- ### STM32F4xx HAL ETH Driver Usage Guide Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F423xx_User_Manual/stm32f4xx__hal__eth_8c.html A comprehensive guide on how to initialize, configure, and operate the STM32F4xx HAL Ethernet (ETH) driver. It covers the sequence of API calls for peripheral initialization, low-level resource setup, data reception and transmission, and communication with external PHY devices, including MAC, DMA, and PTP configurations. ```APIDOC ##### How to use this driver ##### [..] The ETH HAL driver can be used as follows: (#)Declare a ETH_HandleTypeDef handle structure, for example: ETH_HandleTypeDef heth; (#)Fill parameters of Init structure in heth handle (#)Call HAL_ETH_Init() API to initialize the Ethernet peripheral (MAC, DMA, ...) (#)Initialize the ETH low level resources through the HAL_ETH_MspInit() API: (##) Enable the Ethernet interface clock using (+++) __HAL_RCC_ETH1MAC_CLK_ENABLE() (+++) __HAL_RCC_ETH1TX_CLK_ENABLE() (+++) __HAL_RCC_ETH1RX_CLK_ENABLE() (##) Initialize the related GPIO clocks (##) Configure Ethernet pinout (##) Configure Ethernet NVIC interrupt (in Interrupt mode) (#) Ethernet data reception is asynchronous, so call the following API to start the listening mode: (##) HAL_ETH_Start(): This API starts the MAC and DMA transmission and reception process, without enabling end of transfer interrupts, in this mode user has to poll for data reception by calling HAL_ETH_ReadData() (##) HAL_ETH_Start_IT(): This API starts the MAC and DMA transmission and reception process, end of transfer interrupts are enabled in this mode, HAL_ETH_RxCpltCallback() will be executed when an Ethernet packet is received (#) When data is received user can call the following API to get received data: (##) HAL_ETH_ReadData(): Read a received packet (#) For transmission path, two APIs are available: (##) HAL_ETH_Transmit(): Transmit an ETH frame in blocking mode (##) HAL_ETH_Transmit_IT(): Transmit an ETH frame in interrupt mode, HAL_ETH_TxCpltCallback() will be executed when end of transfer occur (#) Communication with an external PHY device: (##) HAL_ETH_ReadPHYRegister(): Read a register from an external PHY (##) HAL_ETH_WritePHYRegister(): Write data to an external RHY register (#) Configure the Ethernet MAC after ETH peripheral initialization (##) HAL_ETH_GetMACConfig(): Get MAC actual configuration into ETH_MACConfigTypeDef (##) HAL_ETH_SetMACConfig(): Set MAC configuration based on ETH_MACConfigTypeDef (#) Configure the Ethernet DMA after ETH peripheral initialization (##) HAL_ETH_GetDMAConfig(): Get DMA actual configuration into ETH_DMAConfigTypeDef (##) HAL_ETH_SetDMAConfig(): Set DMA configuration based on ETH_DMAConfigTypeDef (#) Configure the Ethernet PTP after ETH peripheral initialization (##) Define HAL_ETH_USE_PTP to use PTP APIs. (##) HAL_ETH_PTP_GetConfig(): Get PTP actual configuration into ETH_PTP_ConfigTypeDef (##) HAL_ETH_PTP_SetConfig(): Set PTP configuration based on ETH_PTP_ConfigTypeDef (##) HAL_ETH_PTP_GetTime(): Get Seconds and Nanoseconds for the Ethernet PTP registers ``` -------------------------------- ### Guide to Using the STM32F4xx HAL SPDIFRX Driver Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F410Rx_User_Manual/stm32f4xx__hal__spdifrx_8c.html This section provides a detailed guide on how to initialize and use the SPDIFRX HAL driver, covering low-level resource configuration, NVIC and DMA setup, and different operation modes (polling and interrupt-driven reception). ```APIDOC How to use this driver: 1. Declare SPDIFRX_HandleTypeDef handle structure. 2. Initialize the SPDIFRX low level resources by implement the HAL_SPDIFRX_MspInit() API: - Enable the SPDIFRX interface clock. - SPDIFRX pins configuration: - Enable the clock for the SPDIFRX GPIOs. - Configure these SPDIFRX pins as alternate function pull-up. - NVIC configuration if you need to use interrupt process (HAL_SPDIFRX_ReceiveControlFlow_IT() and HAL_SPDIFRX_ReceiveDataFlow_IT() API's): - Configure the SPDIFRX interrupt priority. - Enable the NVIC SPDIFRX IRQ handle. - DMA Configuration if you need to use DMA process (HAL_SPDIFRX_ReceiveDataFlow_DMA() and HAL_SPDIFRX_ReceiveControlFlow_DMA() API's): - Declare a DMA handle structure for the reception of the Data Flow channel. - Declare a DMA handle structure for the reception of the Control Flow channel. - Enable the DMAx interface clock. - Configure the declared DMA handle structure CtrlRx/DataRx with the required parameters. - Configure the DMA Channel. - Associate the initialized DMA handle to the SPDIFRX DMA CtrlRx/DataRx handle. - Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA CtrlRx/DataRx channel. 3. Program the input selection, re-tries number, wait for activity, channel status selection, data format, stereo mode and masking of user bits using HAL_SPDIFRX_Init() function. Note: - The specific SPDIFRX interrupts (RXNE/CSRNE and Error Interrupts) will be managed using the macros __SPDIFRX_ENABLE_IT() and __SPDIFRX_DISABLE_IT() inside the receive process. - Make sure that ck_spdif clock is configured. 4. Three operation modes are available within this driver: Polling mode for reception operation (for debug purpose): - Receive data flow in blocking mode using HAL_SPDIFRX_ReceiveDataFlow() - Receive control flow of data in blocking mode using HAL_SPDIFRX_ReceiveControlFlow() Interrupt mode for reception operation: - Receive an amount of data (Data Flow) in non blocking mode using HAL_SPDIFRX_ReceiveDataFlow_IT() - Receive an amount of data (Control Flow) in non blocking mode using HAL_SPDIFRX_ReceiveControlFlow_IT() - At reception end of half transfer HAL_SPDIFRX_RxHalfCpltCallback is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_RxHalfCpltCallback - At reception end of transfer HAL_SPDIFRX_RxCpltCallback is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_RxCpltCallback - In case of transfer Error, HAL_SPDIFRX_ErrorCallback() function is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_ErrorCallback ``` -------------------------------- ### General Usage Guide for STM32F4 HAL CAN Driver Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F423xx_User_Manual/stm32f4xx__hal__can_8c.html This guide outlines the typical steps to initialize, configure, and operate the CAN peripheral using the STM32F4 HAL driver. It covers low-level resource setup, filter configuration, message transmission, and reception, providing a comprehensive overview for integrating CAN functionality. ```APIDOC How to use this driver: 1. Initialize the CAN low level resources by implementing the HAL_CAN_MspInit(): - Enable the CAN interface clock using __HAL_RCC_CANx_CLK_ENABLE() - Configure CAN pins: - Enable the clock for the CAN GPIOs - Configure CAN pins as alternate function - In case of using interrupts (e.g. HAL_CAN_ActivateNotification()): - Configure the CAN interrupt priority using HAL_NVIC_SetPriority() - Enable the CAN IRQ handler using HAL_NVIC_EnableIRQ() - In CAN IRQ handler, call HAL_CAN_IRQHandler() 2. Initialize the CAN peripheral using HAL_CAN_Init() function. This function resorts to HAL_CAN_MspInit() for low-level initialization. 3. Configure the reception filters using HAL_CAN_ConfigFilter(). 4. Start the CAN module using HAL_CAN_Start(). At this level the node is active on the bus: it receives messages, and can send messages. 5. To manage messages transmission, the following Tx control functions can be used: - HAL_CAN_AddTxMessage() to request transmission of a new message. - HAL_CAN_AbortTxRequest() to abort transmission of a pending message. - HAL_CAN_GetTxMailboxesFreeLevel() to get the number of free Tx mailboxes. - HAL_CAN_IsTxMessagePending() to check if a message is pending in a Tx mailbox. - HAL_CAN_GetTxTimestamp() to get the timestamp of Tx message sent, if time triggered communication mode is enabled. 6. When a message is received into the CAN Rx FIFOs, it can be retrieved using the HAL_CAN_GetRxMessage() function. The function HAL_CAN_GetRxFifoFillLevel() allows to know how many Rx message are stored in the Rx Fifo. 7. Calling the HAL_CAN_Stop() function stops the CAN module. 8. The deinitialization is achieved with HAL_CAN_DeInit() function. ``` -------------------------------- ### Comprehensive Guide to STM32F446xx HASH HAL Driver Usage Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F446xx_User_Manual/stm32f4xx__hal__hash_8c_source.html This comprehensive guide details the initialization and operational procedures for the STM32F446xx HASH HAL driver. It covers low-level resource setup via HAL_HASH_MspInit(), including clock enabling, interrupt configuration, and DMA setup. Furthermore, it explains the three distinct processing schemes: Polling, Interrupt, and DMA modes, providing examples of their respective API calls for HASH and HMAC operations. ```APIDOC =============================================================================== ##### How to use this driver ##### =============================================================================== ... The HASH HAL driver can be used as follows: (#)Initialize the HASH low level resources by implementing the HAL_HASH_MspInit(): (##) Enable the HASH interface clock using __HASH_CLK_ENABLE() (##) When resorting to interrupt-based APIs (e.g. HAL_HASH_xxx_Start_IT()) (+++) Configure the HASH interrupt priority using HAL_NVIC_SetPriority() (+++) Enable the HASH IRQ handler using HAL_NVIC_EnableIRQ() (+++) In HASH IRQ handler, call HAL_HASH_IRQHandler() API (##) When resorting to DMA-based APIs (e.g. HAL_HASH_xxx_Start_DMA()) (+++) Enable the DMAx interface clock using __DMAx_CLK_ENABLE() (+++) Configure and enable one DMA stream to manage data transfer from memory to peripheral (input stream). Managing data transfer from peripheral to memory can be performed only using CPU. (+++) Associate the initialized DMA handle to the HASH DMA handle using __HAL_LINKDMA() (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA stream: use HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ() (#)Initialize the HASH HAL using HAL_HASH_Init(). This function: (##) resorts to HAL_HASH_MspInit() for low-level initialization, (##) configures the data type: 1-bit, 8-bit, 16-bit or 32-bit. (#)Three processing schemes are available: (##) Polling mode: processing APIs are blocking functions i.e. they process the data and wait till the digest computation is finished, e.g. HAL_HASH_xxx_Start() for HASH or HAL_HMAC_xxx_Start() for HMAC (##) Interrupt mode: processing APIs are not blocking functions i.e. they process the data under interrupt, e.g. HAL_HASH_xxx_Start_IT() for HASH or HAL_HMAC_xxx_Start_IT() for HMAC (##) DMA mode: processing APIs are not blocking functions and the CPU is not used for data transfer i.e. the data transfer is ensured by DMA, e.g. HAL_HASH_xxx_Start_DMA() for HASH or HAL_HMAC_xxx_Start_DMA() ``` -------------------------------- ### STM32F4xx SPDIFRX HAL Driver Usage Guide Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F479xx_User_Manual/stm32f4xx__hal__spdifrx_8c.html Comprehensive guide on how to initialize, configure, and use the SPDIFRX audio interface driver, covering low-level resource setup, interrupt management, DMA configuration, and different operational modes (Polling, Interrupt). It details the necessary steps for declaring handles, implementing MSP initialization, configuring NVIC and DMA, programming SPDIFRX parameters, and utilizing various receive functions and callbacks. ```APIDOC ##### How to use this driver ##### =============================================================================== [..] The SPDIFRX HAL driver can be used as follow: (#) Declare SPDIFRX_HandleTypeDef handle structure. (#) Initialize the SPDIFRX low level resources by implement the HAL_SPDIFRX_MspInit() API: (##) Enable the SPDIFRX interface clock. (##) SPDIFRX pins configuration: (+++) Enable the clock for the SPDIFRX GPIOs. (+++) Configure these SPDIFRX pins as alternate function pull-up. (##) NVIC configuration if you need to use interrupt process (HAL_SPDIFRX_ReceiveControlFlow_IT() and HAL_SPDIFRX_ReceiveDataFlow_IT() API's). (+++) Configure the SPDIFRX interrupt priority. (+++) Enable the NVIC SPDIFRX IRQ handle. (##) DMA Configuration if you need to use DMA process (HAL_SPDIFRX_ReceiveDataFlow_DMA() and HAL_SPDIFRX_ReceiveControlFlow_DMA() API's). (+++) Declare a DMA handle structure for the reception of the Data Flow channel. (+++) Declare a DMA handle structure for the reception of the Control Flow channel. (+++) Enable the DMAx interface clock. (+++) Configure the declared DMA handle structure CtrlRx/DataRx with the required parameters. (+++) Configure the DMA Channel. (+++) Associate the initialized DMA handle to the SPDIFRX DMA CtrlRx/DataRx handle. (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA CtrlRx/DataRx channel. (#) Program the input selection, re-tries number, wait for activity, channel status selection, data format, stereo mode and masking of user bits using HAL_SPDIFRX_Init() function. -@- The specific SPDIFRX interrupts (RXNE/CSRNE and Error Interrupts) will be managed using the macros __SPDIFRX_ENABLE_IT() and __SPDIFRX_DISABLE_IT() inside the receive process. -@- Make sure that ck_spdif clock is configured. (#) Three operation modes are available within this driver : *** Polling mode for reception operation (for debug purpose) *** ================================================================ [..] (+) Receive data flow in blocking mode using HAL_SPDIFRX_ReceiveDataFlow() (+) Receive control flow of data in blocking mode using HAL_SPDIFRX_ReceiveControlFlow() *** Interrupt mode for reception operation *** ========================================= [..] (+) Receive an amount of data (Data Flow) in non blocking mode using HAL_SPDIFRX_ReceiveDataFlow_IT() (+) Receive an amount of data (Control Flow) in non blocking mode using HAL_SPDIFRX_ReceiveControlFlow_IT() (+) At reception end of half transfer HAL_SPDIFRX_RxHalfCpltCallback is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_RxHalfCpltCallback (+) At reception end of transfer HAL_SPDIFRX_RxCpltCallback is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_RxCpltCallback (+) In case of transfer Error, HAL_SPDIFRX_ErrorCallback() function is executed and user can ``` -------------------------------- ### Guide to Using SPDIFRX HAL Driver Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F412Zx_User_Manual/stm32f4xx__hal__spdifrx_8c.html This section outlines the step-by-step process for utilizing the SPDIFRX HAL driver, covering initialization, low-level resource configuration (MSP Init), and different operation modes (Polling, Interrupt, DMA). It details the necessary steps for setting up the SPDIFRX peripheral, including clock and GPIO configuration, NVIC setup for interrupts, and DMA configuration for data and control flow. ```APIDOC ##### How to use this driver ##### =============================================================================== [..] The SPDIFRX HAL driver can be used as follow: (#) Declare SPDIFRX_HandleTypeDef handle structure. (#) Initialize the SPDIFRX low level resources by implement the HAL_SPDIFRX_MspInit() API: (##) Enable the SPDIFRX interface clock. (##) SPDIFRX pins configuration: (+++) Enable the clock for the SPDIFRX GPIOs. (+++) Configure these SPDIFRX pins as alternate function pull-up. (##) NVIC configuration if you need to use interrupt process (HAL_SPDIFRX_ReceiveControlFlow_IT() and HAL_SPDIFRX_ReceiveDataFlow_IT() API's). (+++) Configure the SPDIFRX interrupt priority. (+++) Enable the NVIC SPDIFRX IRQ handle. (##) DMA Configuration if you need to use DMA process (HAL_SPDIFRX_ReceiveDataFlow_DMA() and HAL_SPDIFRX_ReceiveControlFlow_DMA() API's). (+++) Declare a DMA handle structure for the reception of the Data Flow channel. (+++) Declare a DMA handle structure for the reception of the Control Flow channel. (+++) Enable the DMAx interface clock. (+++) Configure the declared DMA handle structure CtrlRx/DataRx with the required parameters. (+++) Configure the DMA Channel. (+++) Associate the initialized DMA handle to the SPDIFRX DMA CtrlRx/DataRx handle. (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA CtrlRx/DataRx channel. (#) Program the input selection, re-tries number, wait for activity, channel status selection, data format, stereo mode and masking of user bits using HAL_SPDIFRX_Init() function. -@- The specific SPDIFRX interrupts (RXNE/CSRNE and Error Interrupts) will be managed using the macros __SPDIFRX_ENABLE_IT() and __SPDIFRX_DISABLE_IT() inside the receive process. -@- Make sure that ck_spdif clock is configured. (#) Three operation modes are available within this driver : *** Polling mode for reception operation (for debug purpose) *** ================================================================ [..] (+) Receive data flow in blocking mode using HAL_SPDIFRX_ReceiveDataFlow() (+) Receive control flow of data in blocking mode using HAL_SPDIFRX_ReceiveControlFlow() *** Interrupt mode for reception operation *** ========================================= [..] (+) Receive an amount of data (Data Flow) in non blocking mode using HAL_SPDIFRX_ReceiveDataFlow_IT() (+) Receive an amount of data (Control Flow) in non blocking mode using HAL_SPDIFRX_ReceiveControlFlow_IT() (+) At reception end of half transfer HAL_SPDIFRX_RxHalfCpltCallback is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_RxHalfCpltCallback (+) At reception end of transfer HAL_SPDIFRX_RxCpltCallback is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_RxCpltCallback (+) In case of transfer Error, HAL_SPDIFRX_ErrorCallback() function is executed and user can ``` -------------------------------- ### Get CEC Transmission Start Flag in C Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F412Zx_User_Manual/stm32f4xx__hal__cec_8h_source.html Retrieves the status of the Transmission Start of Message (TXSOM) flag from the CEC Control Register (CR). This macro can be used to check if a transmission has started. ```C #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXSOM) ``` -------------------------------- ### Configure and Get ADC Regular Group Trigger Source Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F412Zx_User_Manual/stm32f4xx__ll__adc_8h.html These functions allow getting the trigger source for the ADC regular group conversion, determining if it's an internal software start or an external event from a timer or interrupt line. It also provides a specific check for software start. ```APIDOC __STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource(const ADC_TypeDef *ADCx) ADCx: const ADC_TypeDef * - Pointer to ADC peripheral instance. Return: uint32_t - ADC group regular conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line). __STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart(const ADC_TypeDef *ADCx) ADCx: const ADC_TypeDef * - Pointer to ADC peripheral instance. Return: uint32_t - ADC group regular conversion trigger source internal (SW start) or external. ``` -------------------------------- ### Guide to Using STM32F4 SPDIFRX HAL Driver Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F411xE_User_Manual/stm32f4xx__hal__spdifrx_8c.html This section outlines the step-by-step process for initializing and using the SPDIFRX audio interface driver within the STM32F4 HAL framework. It covers low-level resource configuration, NVIC and DMA setup, and programming the SPDIFRX module, detailing polling and interrupt-driven reception modes. ```APIDOC SPDIFRX HAL Driver Usage: 1. Declare SPDIFRX_HandleTypeDef handle structure. 2. Initialize low-level resources via HAL_SPDIFRX_MspInit() API: a. Enable SPDIFRX interface clock. b. Configure SPDIFRX pins: i. Enable clock for SPDIFRX GPIOs. ii. Configure pins as alternate function pull-up. c. Configure NVIC for interrupt process (if using HAL_SPDIFRX_ReceiveControlFlow_IT(), HAL_SPDIFRX_ReceiveDataFlow_IT()): i. Configure SPDIFRX interrupt priority. ii. Enable NVIC SPDIFRX IRQ handle. d. Configure DMA for DMA process (if using HAL_SPDIFRX_ReceiveDataFlow_DMA(), HAL_SPDIFRX_ReceiveControlFlow_DMA()): i. Declare a DMA handle structure for the reception of the Data Flow channel. ii. Declare a DMA handle structure for the reception of the Control Flow channel. iii. Enable the DMAx interface clock. iv. Configure the declared DMA handle structure CtrlRx/DataRx with the required parameters. v. Configure the DMA Channel. vi. Associate the initialized DMA handle to the SPDIFRX DMA CtrlRx/DataRx handle. vii. Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA CtrlRx/DataRx channel. 3. Program the input selection, re-tries number, wait for activity, channel status selection, data format, stereo mode and masking of user bits using HAL_SPDIFRX_Init() function. Notes: - The specific SPDIFRX interrupts (RXNE/CSRNE and Error Interrupts) will be managed using the macros __SPDIFRX_ENABLE_IT() and __SPDIFRX_DISABLE_IT() inside the receive process. - Make sure that ck_spdif clock is configured. Operation Modes: Polling Mode (for reception): - Receive data flow in blocking mode using HAL_SPDIFRX_ReceiveDataFlow(). - Receive control flow of data in blocking mode using HAL_SPDIFRX_ReceiveControlFlow(). Interrupt Mode (for reception): - Receive an amount of data (Data Flow) in non-blocking mode using HAL_SPDIFRX_ReceiveDataFlow_IT(). - Receive an amount of data (Control Flow) in non-blocking mode using HAL_SPDIFRX_ReceiveControlFlow_IT(). - Callbacks: - At reception end of half transfer HAL_SPDIFRX_RxHalfCpltCallback is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_RxHalfCpltCallback. - At reception end of transfer HAL_SPDIFRX_RxCpltCallback is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_RxCpltCallback. - In case of transfer Error, HAL_SPDIFRX_ErrorCallback() function is executed and user can add his own code by customization of function pointer HAL_SPDIFRX_ErrorCallback. ``` -------------------------------- ### STM32F410Rx HAL SPDIFRX Driver Usage Guide Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F410Rx_User_Manual/stm32f4xx__hal__spdifrx_8c_source.html This section provides a comprehensive guide on how to integrate and utilize the SPDIFRX HAL driver. It covers the declaration of the handle structure, implementation of HAL_SPDIFRX_MspInit for low-level resource setup (clock, pins, NVIC, DMA), programming initial parameters with HAL_SPDIFRX_Init, and managing interrupts. It also outlines the polling and interrupt modes for data and control flow reception. ```APIDOC =============================================================================== ##### How to use this driver ##### =============================================================================== [..] The SPDIFRX HAL driver can be used as follow: (#) Declare SPDIFRX_HandleTypeDef handle structure. (#) Initialize the SPDIFRX low level resources by implement the HAL_SPDIFRX_MspInit() API: (##) Enable the SPDIFRX interface clock. (##) SPDIFRX pins configuration: (+++) Enable the clock for the SPDIFRX GPIOs. (+++) Configure these SPDIFRX pins as alternate function pull-up. (##) NVIC configuration if you need to use interrupt process (HAL_SPDIFRX_ReceiveControlFlow_IT() and HAL_SPDIFRX_ReceiveDataFlow_IT() API's). (+++) Configure the SPDIFRX interrupt priority. (+++) Enable the NVIC SPDIFRX IRQ handle. (##) DMA Configuration if you need to use DMA process (HAL_SPDIFRX_ReceiveDataFlow_DMA() and HAL_SPDIFRX_ReceiveControlFlow_DMA() API's). (+++) Declare a DMA handle structure for the reception of the Data Flow channel. (+++) Declare a DMA handle structure for the reception of the Control Flow channel. (+++) Enable the DMAx interface clock. (+++) Configure the declared DMA handle structure CtrlRx/DataRx with the required parameters. (+++) Configure the DMA Channel. (+++) Associate the initialized DMA handle to the SPDIFRX DMA CtrlRx/DataRx handle. (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA CtrlRx/DataRx channel. (#) Program the input selection, re-tries number, wait for activity, channel status selection, data format, stereo mode and masking of user bits using HAL_SPDIFRX_Init() function. -@- The specific SPDIFRX interrupts (RXNE/CSRNE and Error Interrupts) will be managed using the macros __SPDIFRX_ENABLE_IT() and __SPDIFRX_DISABLE_IT() inside the receive process. -@- Make sure that ck_spdif clock is configured. (#) Three operation modes are available within this driver : *** Polling mode for reception operation (for debug purpose) *** ================================================================ [..] (+) Receive data flow in blocking mode using HAL_SPDIFRX_ReceiveDataFlow() (+) Receive control flow of data in blocking mode using HAL_SPDIFRX_ReceiveControlFlow() *** Interrupt mode for reception operation *** ========================================= [..] ``` -------------------------------- ### Get FMPI2C SDA Setup Time (C) Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F446xx_User_Manual/stm32f4xx__ll__fmpi2c_8h_source.html Retrieves the SDA setup time for the FMPI2C peripheral. This function takes the FMPI2C instance as input. It returns a 32-bit value representing the setup time, which is between 0x0 and 0xF. ```C __STATIC_INLINE uint32_t LL_FMPI2C_GetDataSetupTime(const FMPI2C_TypeDef *FMPI2Cx) { return (uint32_t)(READ_BIT(FMPI2Cx->TIMINGR, FMPI2C_TIMINGR_SCLDEL) >> FMPI2C_TIMINGR_SCLDEL_Pos); } ``` -------------------------------- ### How to use the LPTIM HAL Driver Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F417xx_User_Manual/stm32f4xx__hal__lptim_8c_source.html This section outlines the steps to initialize and use the LPTIM HAL driver, covering low-level resource setup via HAL_LPTIM_MspInit, main HAL initialization with HAL_LPTIM_Init, and an overview of the six available operating modes including PWM and One Pulse. ```APIDOC @verbatim ============================================================================== ##### How to use this driver ##### ============================================================================== [..] The LPTIM HAL driver can be used as follows: (#)Initialize the LPTIM low level resources by implementing the HAL_LPTIM_MspInit(): (++) Enable the LPTIM interface clock using __HAL_RCC_LPTIMx_CLK_ENABLE(). (++) In case of using interrupts (e.g. HAL_LPTIM_PWM_Start_IT()): (+++) Configure the LPTIM interrupt priority using HAL_NVIC_SetPriority(). (+++) Enable the LPTIM IRQ handler using HAL_NVIC_EnableIRQ(). (+++) In LPTIM IRQ handler, call HAL_LPTIM_IRQHandler(). (#)Initialize the LPTIM HAL using HAL_LPTIM_Init(). This function configures mainly: (++) The instance: LPTIM1. (++) Clock: the counter clock. (+++) Source : it can be either the ULPTIM input (IN1) or one of the internal clock; (APB, LSE or LSI). (+++) Prescaler: select the clock divider. (++) UltraLowPowerClock : To be used only if the ULPTIM is selected as counter clock source. (+++) Polarity: polarity of the active edge for the counter unit if the ULPTIM input is selected. (+++) SampleTime: clock sampling time to configure the clock glitch filter. (++) Trigger: How the counter start. (+++) Source: trigger can be software or one of the hardware triggers. (+++) ActiveEdge : only for hardware trigger. (+++) SampleTime : trigger sampling time to configure the trigger glitch filter. (++) OutputPolarity : 2 opposite polarities are possible. (++) UpdateMode: specifies whether the update of the autoreload and the compare values is done immediately or after the end of current period. (#)Six modes are available: (++) PWM Mode: To generate a PWM signal with specified period and pulse, call HAL_LPTIM_PWM_Start() or HAL_LPTIM_PWM_Start_IT() for interruption mode. (++) One Pulse Mode: To generate pulse with specified width in response to a stimulus, call HAL_LPTIM_OnePulse_Start() or HAL_LPTIM_OnePulse_Start_IT() for interruption mode. ``` -------------------------------- ### How to Use STM32F4xx HAL CAN Driver Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F417xx_User_Manual/stm32f4xx__hal__can_8c_source.html This section provides a comprehensive guide on utilizing the STM32F4xx HAL CAN driver, covering the necessary steps from low-level resource initialization (HAL_CAN_MspInit) and peripheral setup (HAL_CAN_Init) to configuring filters, starting the CAN module, managing message transmission and reception, and finally deinitialization. It highlights key functions for each stage of CAN operation. ```APIDOC How to use this driver: 1. Initialize low-level resources by implementing HAL_CAN_MspInit(): - Enable CAN interface clock using __HAL_RCC_CANx_CLK_ENABLE() - Configure CAN pins: - Enable clock for CAN GPIOs - Configure CAN pins as alternate function - In case of using interrupts (e.g., HAL_CAN_ActivateNotification()): - Configure CAN interrupt priority using HAL_NVIC_SetPriority() - Enable CAN IRQ handler using HAL_NVIC_EnableIRQ() - In CAN IRQ handler, call HAL_CAN_IRQHandler() 2. Initialize the CAN peripheral using HAL_CAN_Init() function. 3. Configure reception filters using HAL_CAN_ConfigFilter(). 4. Start the CAN module using HAL_CAN_Start() function. At this level, the node is active on the bus: it receives messages and can send messages. 5. To manage messages transmission, the following Tx control functions can be used: - HAL_CAN_AddTxMessage() to request transmission of a new message. - HAL_CAN_AbortTxRequest() to abort transmission of a pending message. - HAL_CAN_GetTxMailboxesFreeLevel() to get the number of free Tx mailboxes. - HAL_CAN_IsTxMessagePending() to check if a message is pending in a Tx mailbox. - HAL_CAN_GetTxTimestamp() to get the timestamp of Tx message sent, if time triggered communication mode is enabled. 6. When a message is received into the CAN Rx FIFOs, it can be retrieved using the HAL_CAN_GetRxMessage() function. The function HAL_CAN_GetRxFifoFillLevel() allows to know how many Rx messages are stored in the Rx Fifo. 7. Calling the HAL_CAN_Stop() function stops the CAN module. 8. The deinitialization is achieved with HAL_CAN_DeInit() function. *** Polling mode operation details follow. *** ``` -------------------------------- ### Get CEC Transmission Start Flag Status Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F446xx_User_Manual/stm32f4xx__hal__cec_8h_source.html Retrieves the status of the Transmission Start flag (TXSOM) for the specified CEC Handle. Returns FlagStatus. ```C #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXSOM) ``` -------------------------------- ### How to Use the STM32F4xx SPDIFRX HAL Driver Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F446xx_User_Manual/stm32f4xx__hal__spdifrx_8c_source.html This section outlines the steps to initialize and use the SPDIFRX audio interface driver. It covers declaring the handle structure, implementing HAL_SPDIFRX_MspInit() for low-level resource configuration (clock, GPIOs, NVIC, DMA), programming SPDIFRX parameters with HAL_SPDIFRX_Init(), and understanding the available operation modes (polling and interrupt). ```APIDOC =============================================================================== ##### How to use this driver ##### =============================================================================== [..] The SPDIFRX HAL driver can be used as follow: (#) Declare SPDIFRX_HandleTypeDef handle structure. (#) Initialize the SPDIFRX low level resources by implement the HAL_SPDIFRX_MspInit() API: (##) Enable the SPDIFRX interface clock. (##) SPDIFRX pins configuration: (+++) Enable the clock for the SPDIFRX GPIOs. (+++) Configure these SPDIFRX pins as alternate function pull-up. (##) NVIC configuration if you need to use interrupt process (HAL_SPDIFRX_ReceiveControlFlow_IT() and HAL_SPDIFRX_ReceiveDataFlow_IT() API's). (+++) Configure the SPDIFRX interrupt priority. (+++) Enable the NVIC SPDIFRX IRQ handle. (##) DMA Configuration if you need to use DMA process (HAL_SPDIFRX_ReceiveDataFlow_DMA() and HAL_SPDIFRX_ReceiveControlFlow_DMA() API's). (+++) Declare a DMA handle structure for the reception of the Data Flow channel. (+++) Declare a DMA handle structure for the reception of the Control Flow channel. (+++) Enable the DMAx interface clock. (+++) Configure the declared DMA handle structure CtrlRx/DataRx with the required parameters. (+++) Configure the DMA Channel. (+++) Associate the initialized DMA handle to the SPDIFRX DMA CtrlRx/DataRx handle. (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA CtrlRx/DataRx channel. (#) Program the input selection, re-tries number, wait for activity, channel status selection, data format, stereo mode and masking of user bits using HAL_SPDIFRX_Init() function. -@- The specific SPDIFRX interrupts (RXNE/CSRNE and Error Interrupts) will be managed using the macros __SPDIFRX_ENABLE_IT() and __SPDIFRX_DISABLE_IT() inside the receive process. -@- Make sure that ck_spdif clock is configured. (#) Three operation modes are available within this driver : *** Polling mode for reception operation (for debug purpose) *** ================================================================ [..] (+) Receive data flow in blocking mode using HAL_SPDIFRX_ReceiveDataFlow() (+) Receive control flow of data in blocking mode using HAL_SPDIFRX_ReceiveControlFlow() *** Interrupt mode for reception operation *** ========================================= [..] ``` -------------------------------- ### STM32 HAL I2C Driver Usage Guide APIDOC Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F446xx_User_Manual/stm32f4xx__hal__i2c_8c.html Comprehensive guide on initializing and using the STM32 HAL I2C driver. It covers low-level resource setup via HAL_I2C_MspInit, configuration of the I2C peripheral, initialization, device readiness checks, and various IO operations in polling mode for master, slave, and memory access. ```APIDOC Usage Steps: 1. Declare I2C_HandleTypeDef: I2C_HandleTypeDef hi2c; 2. Implement HAL_I2C_MspInit() for low-level setup: - Enable I2Cx interface clock. - Configure I2C pins (GPIO clock, alternate function open-drain). - Configure NVIC for interrupts (priority, enable I2C IRQ Channel). - Configure DMA for transfers (declare handle, enable clock, configure parameters, associate to hi2c DMA Tx/Rx, configure NVIC for transfer complete interrupt). 3. Configure hi2c Init structure: - Set Communication Speed, Duty cycle, Addressing mode, Own Address1, Dual Addressing mode, Own Address2, General call, Nostretch mode. 4. Call HAL_I2C_Init(): - Configures I2C registers and calls HAL_I2C_MspInit(). 5. Check device readiness: - Use HAL_I2C_IsDeviceReady(). 6. Perform IO operations (Polling mode): - Master Transmit: HAL_I2C_Master_Transmit() - Master Receive: HAL_I2C_Master_Receive() - Slave Transmit: HAL_I2C_Slave_Transmit() - Slave Receive: HAL_I2C_Slave_Receive() 7. Perform IO MEM operations (Polling mode): - Memory Write: HAL_I2C_Mem_Write() ``` -------------------------------- ### Get FMPI2C SDA Setup Time (C) Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F417xx_User_Manual/stm32f4xx__ll__fmpi2c_8h_source.html Retrieves the SDA setup time setting for the FMPI2C instance. The returned value is between 0x0 and 0xF. ```C __STATIC_INLINE uint32_t LL_FMPI2C_GetDataSetupTime(const FMPI2C_TypeDef *FMPI2Cx) { return (uint32_t)(READ_BIT(FMPI2Cx->TIMINGR, FMPI2C_TIMINGR_SCLDEL) >> FMPI2C_TIMINGR_SCLDEL_Pos); } ``` -------------------------------- ### IWDG Initialization and Start Functions Overview Source: https://github.com/xywml/stm32f4_hal_doc/blob/main/STM32F423xx_User_Manual/stm32f4xx__hal__iwdg_8c_source.html Overview of the functions available for initializing and starting the IWDG, including automatic watchdog reload upon initialization to ensure a correct time base. ```APIDOC =============================================================================== ##### Initialization and Start functions ##### =============================================================================== [..] This section provides functions allowing to: (+) Initialize the IWDG according to the specified parameters in the IWDG_InitTypeDef of associated handle. (+) Once initialization is performed in HAL_IWDG_Init function, Watchdog is reloaded in order to exit function with correct time base. ```