Skip to main content
Visitor II
August 14, 2019
Question

FDCAN Tx Interrupts

  • August 14, 2019
  • 2 replies
  • 4303 views

Hi,

I'm trying to configure STM32H7 and STM32G4 FDCANs to generate an ISR on transmit complete frame.

I call the functios to enable respective ISRs:

HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_TX_COMPLETE, 0);  

HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_TX_FIFO_EMPTY, 0);  

When a FDCAN frame is trasmited, only TxFifoEmptyCallback notify an interrupt, there's no call to TxBufferCompleteCallback.

What am I missing?

    This topic has been closed for replies.

    2 replies

    Visitor II
    October 9, 2019

    It appears you are missing the last parameter in ActivateNotification:

     * @param BufferIndexes Tx Buffer Indexes.
     * This parameter can be any combination of @arg FDCAN_Tx_location.
     * This parameter is ignored if ActiveITs does not include one of the following:
     * - FDCAN_IT_TX_COMPLETE
     * - FDCAN_IT_TX_ABORT_COMPLETE

    0 is not a valid option in the `FDCAN_Tx_location` group.

    Visitor II
    February 25, 2020

    i'm having the same issue. if 0 isn't an acceptable third argument for (HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_TX_COMPLETE, 0), then what is? I can't find any information given on the task.

    Visitor II
    February 25, 2020

    After Digging endlessly through the HAL code, I figured it out.

    to activate TX IT complete notifications :

     if (HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_TX_COMPLETE, FDCAN_TX_BUFFER0 | FDCAN_TX_BUFFER1 | FDCAN_TX_BUFFER2) != HAL_OK)

       {

       Error_Handler();

       }

    //then the interrupt function

    // Transmission Complete callback FDCAN_Tx_location

    void HAL_FDCAN_TxBufferCompleteCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t BufferIndexes)

      {

        HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_7);

      }