Skip to content

Commit

Permalink
STM32 FDCAN: Get all messages from FIFO in RX ISR
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Pluzhnikov committed May 9, 2023
1 parent bfafcd3 commit 66ef90e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/modm/platform/can/stm32-fdcan/can.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -239,23 +239,23 @@ MODM_ISR({{ reg }}_IT1)
%% if options["buffer.rx"] > 0
RxMessage rxMessage;

if (rxFifo0HasMessage()) {
while (rxFifo0HasMessage()) {
readMsg(rxMessage.message, 0, &rxMessage.filter_id, &rxMessage.timestamp);
// acknowledge interrupt flag
{{ reg }}->IR = FDCAN_IR_RF0N;

modm_assert_continue_ignore(rxQueue.push(rxMessage), "fdcan.rx.buffer",
"CAN receive software buffer overflowed!", {{ id }});
}
{{ reg }}->IR = FDCAN_IR_RF0N;

if (rxFifo1HasMessage()) {
while (rxFifo1HasMessage()) {
readMsg(rxMessage.message, 1, &rxMessage.filter_id, &rxMessage.timestamp);
// acknowledge interrupt flag
{{ reg }}->IR = FDCAN_IR_RF1N;

modm_assert_continue_ignore(rxQueue.push(rxMessage), "fdcan.rx.buffer",
"CAN receive software buffer overflowed!", {{ id }});
}
{{ reg }}->IR = FDCAN_IR_RF1N;
%% endif
}

Expand Down
2 changes: 2 additions & 0 deletions src/modm/platform/can/stm32-fdcan/can.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#ifndef MODM_STM32_FDCAN{{ id }}_HPP
#define MODM_STM32_FDCAN{{ id }}_HPP

#include <optional>

#include <modm/architecture/interface/can.hpp>
#include <modm/architecture/interface/can_filter.hpp>
#include <modm/platform/gpio/connector.hpp>
Expand Down

0 comments on commit 66ef90e

Please sign in to comment.