From 1d53d31339bef03042e2d9d364466ab5b860ed8b Mon Sep 17 00:00:00 2001 From: Karl Fessel Date: Thu, 2 May 2024 10:44:38 +0200 Subject: [PATCH] cpu/samd5x/can: set EFF and RTR Flag if received --- cpu/samd5x/periph/can.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cpu/samd5x/periph/can.c b/cpu/samd5x/periph/can.c index 64b8c325e4..66a1e71be2 100644 --- a/cpu/samd5x/periph/can.c +++ b/cpu/samd5x/periph/can.c @@ -716,7 +716,12 @@ static void _isr(candev_t *candev) else { DEBUG_PUTS("Received extended CAN frame"); frame_received.can_id = dev->msg_ram_conf.rx_fifo_0[rx_get_idx].RXF0E_0.bit.ID; + frame_received.can_id |= CAN_EFF_FLAG; } + if (dev->msg_ram_conf.rx_fifo_0[rx_get_idx].RXF0E_0.bit.RTR) { + frame_received.can_id |= CAN_RTR_FLAG; + } + frame_received.can_dlc = dev->msg_ram_conf.rx_fifo_0[rx_get_idx].RXF0E_1.bit.DLC; memcpy(frame_received.data, (uint32_t *)dev->msg_ram_conf.rx_fifo_0[rx_get_idx].RXF0E_DATA, frame_received.can_dlc); @@ -747,7 +752,12 @@ static void _isr(candev_t *candev) else { DEBUG_PUTS("Received extended CAN frame"); frame_received.can_id = dev->msg_ram_conf.rx_fifo_1[rx_get_idx].RXF1E_0.bit.ID; + frame_received.can_id |= CAN_EFF_FLAG; } + if (dev->msg_ram_conf.rx_fifo_1[rx_get_idx].RXF1E_0.bit.RTR) { + frame_received.can_id |= CAN_RTR_FLAG; + } + frame_received.can_dlc = dev->msg_ram_conf.rx_fifo_1[rx_get_idx].RXF1E_1.bit.DLC; memcpy(frame_received.data, (uint32_t *)dev->msg_ram_conf.rx_fifo_1[rx_get_idx].RXF1E_DATA, frame_received.can_dlc);