Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nissan LEAF: Increase robustness by using CRC bit on incoming messages #134

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

dalathegreat
Copy link
Contributor

What

This PR adds CRC checking on all incoming LEAF BMS messages that have a CRC

Why

EV conversions and high voltage systems are noisy. Incase a high voltage connection comes too close to an unshielded CAN network, message data can become corrupt. Incase the VCU interprets one of these corrupt frames, it can wreck havoc on the decision making (Imagine suddenly seeing undervoltage and the vehicle cuts out at a critical moment!). This is why OEMs use CRCs, counters and other methods to ensure CAN data is valid.

How

We now use the already existing CRC algorithm used to sign outgoing messages, in reverse. Incoming messages get their CRC byte inspected, incase we notice that the actual value deviates from the calculated CRC, we simply discard the message.

Warning

Code has not been tested on a vehicle, only on simulated values. Please test on a vehicle equipped with LEAF BMS before merging.

For future development, we should consider incrementing a counter/flag/event that corrupted CAN messages have been detected.

@damienmaguire damienmaguire merged commit 55f87f0 into damienmaguire:master Dec 6, 2024
1 check passed
@damienmaguire
Copy link
Owner

Thanks Dala

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants