imxrt-rs / imxrt-hal

Rust for NXP i.MX RT
Apache License 2.0
141 stars 33 forks source link

Controller Area Network (CAN) #103

Open reneherrero opened 4 years ago

reneherrero commented 4 years ago

Hi,

Wondering if anyone has ventured into the Controller Area Network (CAN) space?

Thanks,

mciantyre commented 4 years ago

I've not worked with CAN before, and I haven't heard of anyone working on a Rust-based CAN driver for these processors. I'm happy to support an i.MX RT CAN driver's development, then maintain it here.

Here's a quick summary of CAN support across the i.MX RT processor families. Let me know if we see a discrepancy.

i.MX RT CAN support? CANFD support?
1010 NO NO
1015 NO NO
1020 YES NO
1050 YES NO
1060 YES YES
1064 YES YES

We could implement embedded-can, then transition to the embedded-hal equivalent traits if / when it's merged.

DavidTheFighter commented 3 years ago

I have a CANFD only implementation written for the Teensy. It's pretty application specific to what I'm doing with it, and a little very messy code-wise, but it could be a decent reference for anyone else implementing their own. You can find it here: https://github.com/DavidTheFighter/teensy4-canfd I'm planning on rewriting it at some point so it depends only on imxrt-hal, however the only real teensy4-bsp dependency is for the interrupt handler.

rnd-ash commented 3 years ago

I too would love this. I plan on using a Teensy 4.0 as a Transmission ECU for this project, and want to use Rust rather than C++.

However, my TCM only uses standard 500kbps CAN 1.0 rather than CAN-FD or CAN-2.0.

I might try and get an implementation working some time in the next couple weeks.

myCatPlaysFetch commented 2 years ago

I have some decent experience with CAN, and specifically with the 1064, but only in C. I'd like experience with Rust. I could maybe be of some help here. If nothing else, I'm open to offering some support?

talhaHavadar commented 2 years ago

I have some decent experience with CAN, and specifically with the 1064, but only in C. I'd like experience with Rust. I could maybe be of some help here. If nothing else, I'm open to offering some support?

Here you can find CAN implementation example in Rust. https://github.com/stm32-rs/bxcan