Skip to content

Commit 829164a

Browse files
authored
Merge pull request #14778 from MubeenHCLite/Can_TxIrq_callback_resolution
CAN TxIRq callback never called -STM32G474
2 parents 9244625 + 1fc1419 commit 829164a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

targets/TARGET_STM/can_api.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,16 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable)
612612
}
613613

614614
if (enable) {
615-
HAL_FDCAN_ActivateNotification(&obj->CanHandle, interrupts, 0);
615+
/* The TXBTIE register controls the TX complete interrupt in FDCAN
616+
* and is only used in case of TX interrupts, Hence in case of enabling the
617+
* TX interrupts the bufferIndexes of TXBTIE are to be set */
618+
#ifdef TARGET_STM32H7
619+
// TXBTIE for STM32H7 is 2 bytes long
620+
HAL_FDCAN_ActivateNotification(&obj->CanHandle, interrupts, 0xFFFF);
621+
#else
622+
//TXBTIE for rest supported FDCAN Platforms(STM32G0x1, STM32G4 and STM32L5) is 3 bits.
623+
HAL_FDCAN_ActivateNotification(&obj->CanHandle, interrupts, 0x07);
624+
#endif
616625
} else {
617626
HAL_FDCAN_DeactivateNotification(&obj->CanHandle, interrupts);
618627
}

0 commit comments

Comments
 (0)