cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN Tx Interrupts

Asantos
Senior

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?

3 REPLIES 3
TKrop
Associate II

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.

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.

MMint
Associate II

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);

  }