Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TARGET_STM: only mask CAN rx interrupt after rx interrupt, not all CAN interrupts #15461

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions targets/TARGET_STM/can_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,13 +1216,13 @@ static void can_irq(CANName name, int id)
tmp1 = __HAL_CAN_MSG_PENDING(&CanHandle, CAN_FIFO0);
tmp2 = __HAL_CAN_GET_IT_SOURCE(&CanHandle, CAN_IT_FMP0);

// In legacy can (bxCAN and earlier), reading is the only way to clear rx interrupt. But can_read has mutex locks
// since mutexes cannot be used in ISR context, rx interrupt is masked here to temporary disable it
// rx interrupts will be unamsked in read operation. reads must be deffered to thread context.
// refer to the CAN receive interrupt problem due to mutex and resolution section of README doc.
__HAL_CAN_DISABLE_IT(&CanHandle, CAN_IT_FMP0);

if ((tmp1 != 0) && tmp2) {
// In legacy can (bxCAN and earlier), reading is the only way to clear rx interrupt. But can_read has mutex locks
// since mutexes cannot be used in ISR context, rx interrupt is masked here to temporary disable it
// rx interrupts will be unamsked in read operation. reads must be deffered to thread context.
// refer to the CAN receive interrupt problem due to mutex and resolution section of README doc.
__HAL_CAN_DISABLE_IT(&CanHandle, CAN_IT_FMP0);

irq_handler(can_irq_contexts[id], IRQ_RX);
}

Expand Down
Loading