RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

cpu/samd5x write can driver

Open firas-hamdi opened this issue 2 years ago • 3 comments

Contribution description

This PR provides the samd5x CPU definition with the CAN controller driver. The driver supports the initialization of the CAN controller, the send/receive operations set/remove filters and the test mode that sets the CAN controller in loop back (listens to the bus as well as the own transmitted messages)

Testing procedure

The PR provides also an application to test the driver using the same54-xpro board. The CAN controller should receive only the messages having a CAN ID matching the filters, and it will send therefore a message as an answer. The bus can be monitored using a PCAN-USB adapter or a logic analyser.

firas-hamdi avatar Jun 14 '23 13:06 firas-hamdi

It's been ages since I worked with CAN and RIOT also has changed quite a bit since I last used it, so I probably won't be able to add much.

One question I did have after skimming through the code is: what's up with the separate candev test? The original test (now found in tests/drivers/candev) was meant to be entirely agnostic to the device used. Just specify the CAN device you're using, flash to target, et voila! It works and does the same as it would on another device. This way, it's possible to have several different MCU's with different CAN devices all running the same example while still being able to communicate with each other. I wonder what the reason is for creating a separate test that appears to be doing more or less the same. I would suggest editing the existing test with some preprocessor code to select your same5 driver and change as little as possible aside from that.

wosym avatar Jun 14 '23 21:06 wosym

Murdock results

:heavy_check_mark: PASSED

9d2dda27ce1a72b22fd80d59abca3dea958235e9 Merge branch 'master' into cpu/samd5x-write-CAN-driver

Success Failures Total Runtime
10026 0 10027 11m:28s

Artifacts

riot-ci avatar Jul 07 '23 18:07 riot-ci

Changes based on #19964 The test app does not work correctly currently, DO NOT MERGE until I fix it. Problem is when the shell is integrated the interrupts do not get triggered for some reason, and thus the reception of the CAN frame by the SAMD5x is not successful. However, switching the shell to an infinite loop makes the driver work as expected

firas-hamdi avatar Oct 11 '23 16:10 firas-hamdi

you may squash your fix, fixup, minor changes commits up to this point

kfessel avatar Mar 18 '24 17:03 kfessel

some of your commit message titles are too long

please squash cpu/samd5x: add copyright and descriptive comments

into the commits that are creating the file

kfessel avatar Mar 20 '24 10:03 kfessel

I will make a commits cleanup after the next round of reviewing

firas-hamdi avatar Mar 26 '24 13:03 firas-hamdi

please squash your last 4 commits where they belong and put

add CAN RX mailbox feature

some where before them (the commit title needs area of work)

other than that this is good to go

if you like to you may rebase on master ( not required

kfessel avatar Mar 26 '24 13:03 kfessel

:tada:

kfessel avatar Mar 28 '24 22:03 kfessel