mcp2515: SetAcceptanceFilter — RXMODE never switched to filter mode
Hi, Found an issue in the mcp2515 driver while working on the e-Golf module. SetAcceptanceFilter() writes the filter and mask registers correctly but never switches RXMODE from 3 (receive all) to 0 (filter-matched), so the hardware filters are never actually active. Looks like it was never exercised in any vehicle module, NIU GTevo has the call commented out. Also, REG_RXB1CTRL is missing from the regdefs. This matters on the e-Golf because without the filter the OBC floods FCAN at ~860 frames/s during charging, which starves the Events task and triggers TWDT resets. The filter drops it to the 5 IDs we actually decode, which fixes it. Fix I have: SetAcceptanceFilter() clears RXMODE to 0 on both RX buffers after writing the registers, and stores the config so Start() can re-apply it on SetPowerMode(On), otherwise every ignition cycle resets RXMODE back to 3. Tested on hardware, working fine. Happy to send a PR if the approach looks right. Andreas
Andreas,
your finding & solution sound correct to me, please post the PR.
Regards, Michael
Am 02.05.26 um 13:00 schrieb Andreas Jansson:
Hi,
Found an issue in the mcp2515 driver while working on the e-Golf module.
SetAcceptanceFilter() writes the filter and mask registers correctly but never switches RXMODE from 3 (receive all) to 0 (filter-matched), so the hardware filters are never actually active. Looks like it was never exercised in any vehicle module, NIU GTevo has the call commented out. Also, REG_RXB1CTRL is missing from the regdefs.
This matters on the e-Golf because without the filter the OBC floods FCAN at ~860 frames/s during charging, which starves the Events task and triggers TWDT resets. The filter drops it to the 5 IDs we actually decode, which fixes it.
Fix I have: SetAcceptanceFilter() clears RXMODE to 0 on both RX buffers after writing the registers, and stores the config so Start() can re-apply it on SetPowerMode(On), otherwise every ignition cycle resets RXMODE back to 3. Tested on hardware, working fine.
Happy to send a PR if the approach looks right.
Andreas
OvmsDev mailing list -- ovmsdev@lists.openvehicles.com To unsubscribe send an email to ovmsdev-leave@lists.openvehicles.com
-- Michael Balzer * Am Rahmen 5 * D-58313 Herdecke Fon 02330 9104094 * Handy 0176 20698926
participants (2)
-
Andreas Jansson -
Michael Balzer