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

Add Peak CAN driver #14

Open
wants to merge 7 commits into
base: ag/tracing
Choose a base branch
from
Open

Add Peak CAN driver #14

wants to merge 7 commits into from

Conversation

Notgnoshi
Copy link
Member

I don't have a way of testing this, so I have no idea how far off it is.

@Notgnoshi Notgnoshi self-assigned this Aug 8, 2023
@Notgnoshi Notgnoshi force-pushed the ag/tracing branch 2 times, most recently from a5c5e7d to cf7edb6 Compare August 16, 2023 16:27
@JannesBrands
Copy link
Member

I completed the implementation of PCAN that supports all interfaces. Anyway I dont have any PCAN to test it.
https://github.com/JannesBrands/AgIsoStack-rs/commit/273dfd6f51b87dbeb63aad20beb0ea5340a03e04

src/driver/peak.rs Outdated Show resolved Hide resolved
examples/forward.rs Show resolved Hide resolved
I suspect this lint was added to clippy since we last merged to main,
and that the CI/CD pipeline uses the latest clippy release.
@Notgnoshi Notgnoshi force-pushed the ag/pcan branch 2 times, most recently from a850b7c to eec1282 Compare November 7, 2023 02:45
@Notgnoshi
Copy link
Member Author

Fedora PCAN-Basic installation instructions

sudo dnf install kernel-devel popt-devel
tar -xzvf peak-linux-driver-8.16.0.tar.gz
cd peak-linux-driver-8.16.0/
make KERNEL_LOCATION=/usr/src/kernels/6.5.9-200.fc38.x86_64/ clean
EXTRA_CFLAGS=-Wno-error=incompatible-pointer-types make KERNEL_LOCATION=/usr/src/kernels/6.5.9-200.fc38.x86_64/ NET=NETDEV_SUPPORT all
sudo make KERNEL_LOCATION=/usr/src/kernels/6.5.9-200.fc38.x86_64/ install

Question: Should this be a netdev or chardev network device? The peak driver documentation says they now default to using chardev.

forward example application instructions

Build the forward example like so

cargo run --example forward --features tracing,socketcan,peak --input-driver socketcan --input-interface can0 --output-driver pcan --output-interface USB0

This will read from the can0 socketcan interface (which you can use cansend can0 123#44556677 to send fake data on) and write to the USB0 pcan interface. I think it's maybe possible to create a virtual pcan device?

I don't know enough about PCAN to know if that would be easy to read from to test, so I think I'd use forward to read from USB0 and forward to can1 and use candump can1 to read back to the console for verification.

Jannes Brands and others added 3 commits November 6, 2023 21:48
builds, driver works, no functional test (no pcan available)

---------

Co-authored-by: Jannes Brands <[email protected]>
Co-authored-by: Austin Gill <[email protected]>
Including pcan support in the tests requires the test environment have
libpcanbasic available, which has to be built from source.
@Notgnoshi Notgnoshi changed the title DRAFT: Add Peak CAN driver Add Peak CAN driver Nov 7, 2023
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
src/driver/driver.rs 0.00% <ø> (ø)
src/network_management/control_function.rs 15.78% <ø> (ø)

... and 2 files with indirect coverage changes

📢 Thoughts on this report? Let us know!

@Notgnoshi Notgnoshi marked this pull request as ready for review November 7, 2023 03:52
@Notgnoshi Notgnoshi requested a review from ad3154 November 7, 2023 03:53
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