arduino / arduino/ArduinoCore-renesas
CAN write possible bug
- Dominant language
- C
- Stars
- 193
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Description
[CAN::write()](https://github.com/arduino/ArduinoCore-renesas/blob/16bdbea34732678faa950858a7d9e63e621778b4/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp#L256) uses mailbox 16 if the ID is standard, which is configured as a receive mailbox. I think this [should be 8](https://github.com/arduino/ArduinoCore-renesas/blob/16bdbea34732678faa950858a7d9e63e621778b4/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp#L77)?
I think this works because the FSP only checks if the [TRMREQ flag is set](https://github.com/renesas/fsp/blob/5e8fbb10c752e16272790bd3a2587485d0377835/ra/fsp/src/r_can/r_can.c#L537), which it won't be for a receive mailbox, and then configures it for transmit.
I'm guessing that all future receives will come via mailbox 17 onwards, as 16 is no longer configured as a receive, which would break any filters assigned to 16.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp at CAN::write() around line 256, then compare the mailbox setup around line 77 with the FSP transmit handling in ra/fsp/src/r_can/r_can.c around line 537. Verify whether using mailbox 16 changes receive-mailbox allocation or filters assigned to it, and confirm that standard-ID writes and subsequent receives use the intended mailboxes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100