Skip to content

Conversation

@jukkar
Copy link
Owner

@jukkar jukkar commented Oct 24, 2019

I am now able to receive and send CAN packets in Zephyr. The Linux vcan virtual interface is the peer in this case. My earlier problems were because filters were not set properly. Currently this only supports Socket-CAN interface in Zephyr, we can add support for Zephyr native API later.

In Linux one can use cansend to send CAN packets like this:

./cansend zcan 001#11.2233.44556677.88

To receive CAN packets do this:

./candump zcan,1:1

The candump and cansend are part of the can-utils package https://github.com/linux-can/can-utils
You also need the can-setup.sh script from Zephyr net-tools repo, I will send new version for it shortly.

jukkar added 2 commits April 17, 2019 23:42
This initial version supports SocketCAN. The driver passes
CANBUS data between Linux vcan virtual CAN driver and Zephyr.

You also need to use can-setup.sh script from the net-tools
project in order to make communication work with Linux vcan
driver.

Signed-off-by: Jukka Rissanen <[email protected]>
Add native_posix board support to socket-can sample application.

Signed-off-by: Jukka Rissanen <[email protected]>
@rxdu
Copy link

rxdu commented Nov 6, 2020

Hello, I'm trying to work on the native_posix board with can bus lately and came across your pull request zephyrproject-rtos#14196 in zephyr repo. I was wondering if you still have any plan to merge this feature into the upstream or if you have any suggestions on how to make use of this feature with more recent zephyr releases. Thank you very much!

@jukkar
Copy link
Owner Author

jukkar commented Nov 6, 2020

This was an experiment but I did not had time to finalize it. I am fine if you want to continue this work, currently I do not have plans to continue with this PR.

@rxdu
Copy link

rxdu commented Feb 24, 2021

Just for anyone who might be interested. I rebased jukkar's work to v2.4-branch and updated the code to make 2 vcan work with the native_posix board. I'm planning to use it in our project for a while in case further adjustments are required. Hopefully, a pull request to the latest master can be made sometime later. Thanks again for jukkar's work.

The code can be found here:

https://github.com/westonrobot/zephyr/tree/can_native_posix

Two additional commits made in addition to the existing 2 commits listed here.

@jukkar
Copy link
Owner Author

jukkar commented Feb 24, 2021

Hopefully, a pull request to the latest master can be made sometime later.

Thanks, it would be great if you can create a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants