Skip to content
New issue

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

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

Already on GitHub? # to your account

New generic module supporting CAN232/CANUSB/LAWICEL protocol #89

Merged
merged 3 commits into from
Mar 31, 2017

Conversation

DePierre
Copy link
Contributor

Hi there,

I've been interested with using CANToolz with my Arduino+Seeed CAN-BUS shield. I've flashed my Arduino with https://github.com/latonita/arduino-canbus-monitor, which implements CANUSB protocol.

I've seen that the hw_USBtin.py module also implements the CANUSB protocol somehow but I couldn't easily remove the things that were specific to USBtin to make it work with my setup.

So I've decided to have a look to implement a more generic module that should be able to support all hardware implementing CAN232/CANUSB/LAWICEL protocol. It works quite okay-ish. You can receive CAN frames and send CAN232 commands at the same time without missing too many frames. I've plugged the new module with mod_stat and it works quite well.

I have to be honest though, there are very likely a lots of bugs. I've tried to have a look to implement some unit tests for it for looking at the other unit tests, I'm not sure to understand how I should proceed.

Also, due to parallel processing I suppose, there are some unexpected corruptions that affect the received frames, which raised quite some unexpected exceptions during the development of the module. I've tried to have it as stable as possible for the initial version but some work remains IMO.

This new module implements the following CANUSB commands:

  • V -- Get version number
  • v -- Get detailed firmware version number
  • N -- Get serial number
  • O -- Open channel
  • L -- Open channel in read only
  • C -- Close channel
  • S -- Speed of the channel
  • F -- Get status flag
  • Z -- Switch timestamp on/off (although when turned on, the timestamps are not handled...)
  • t -- Transmit standard (11bit) CAN frame
  • T -- Transmit extended (29bit) CAN frame
  • r -- Transmit RTR standard (11bit) CAN frame
  • R -- Transmit RTR extended (29bit) CAN frame

Hardware I am currently using for the module:

Screenshot from the web interface:
can232_module

All feedback are welcome!

eik00d and others added 3 commits March 17, 2017 16:43
Supported commands

+ V, v, N, O, L, C, S, F, Z, t, T, r, R and read commands

Example of hardware setup:

+ Seeed CAN-BUS Shield (http://wiki.seeed.cc/CAN-BUS_Shield_V1.2/)
+ Arduino flashed with firmware implementing CAN232 protocol (https://github.com/latonita/arduino-canbus-monitor)
@eik00d eik00d changed the base branch from master to trunk March 31, 2017 10:39
@eik00d eik00d merged commit e5769c0 into eik00d:trunk Mar 31, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants