stm32: Update pyb.CAN loopback unit tests for FDCAN, fix CAN2 filter bug#18946
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18946 +/- ##
=======================================
Coverage 98.45% 98.45%
=======================================
Files 175 175
Lines 22635 22635
=======================================
Hits 22286 22286
Misses 349 349 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
28061d9 to
68aa819
Compare
|
Code size report: |
|
Apart from the comments above, this looks really good, thanks! I tested on PYBV10 and PYBD_SF6, running the new tests both before and after the bug fix to the firmware in this PR. The expected part of the test fails prior to fixing the CAN2 filter issue, and they all pass with the fix (ie with firmware compiled from this PR). |
68aa819 to
05744b0
Compare
Also rename the prefix from can to pyb_can, in anticipation of machine.CAN tests. Signed-off-by: Angus Gratton <[email protected]>
Closes micropython#18922 Signed-off-by: Angus Gratton <[email protected]>
The function arguments mean totally different things for Classic vs FDCAN hardware, but the argument name wasn't particularly clear for either. This commit shouldn't really change the binary firmware at all. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
05744b0 to
22ee568
Compare
dpgeorge
left a comment
There was a problem hiding this comment.
Retested on PYBD_SF2 and PYBD_SF6 and the updated tests work.
|
Thanks for the quick review, @dpgeorge! Have merged so I can more easily rebase the machine.CAN PR. |
|
Excellent! |
Summary
tests/ports/stm32/can*.pyto pass on CANFD hardware, renames them topyb_can*.pyto account for incoming machine.CAN functionality.pyb_can2.pyto work with FDCAN, was also able to fix STM32 pyb.CAN: Instantiating one CAN instance can corrupts settings of another instance. #18922 and make that unit test a regression test for it.can_clearfilter()as they weren't very clear.NUCLEO_G474REboard, as used for testing.This work is to support #18572 - now tests pass for
pyb.CANwe can verify there's no regression when addingmachine.CAN. Have made into a separate PR as the other is already too big!Testing
ports/stm32/pyb_can*.pyunit tests on PYBDV11 (Classic CAN), NUCLEO_G474RE and NUCLEO_H723ZG boards (both flavours of FDCAN). All now passing.NUCLEO_H723ZGdoesn't have externally usable FDCAN2 pins without changing solder jumper settings (and possibly other things), so I didn't commit the change to this PR as it's only immediately usable for loopback tests. For refernece, the patch for loopback testing is:Generative AI
I did not use generative AI tools when creating this PR.