Support for CAN Bus (Peak, Ixxat, canable etc)

ok, attached it to my HassOS, but in supervisor ‘hardware’ its not showing up … as a new hardware device
is it possible that HassOS is not able to detect it? my deconz USB stick works perfectly fine if i attach it

i see following output on hassio on raspberry 4:

  • name: 1-1.3
    sysfs: >-
    /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3
    dev_path: /dev/bus/usb/001/004
    subsystem: usb
    by_id: null
    attributes:
    BUSNUM: ‘001’
    DEVNAME: /dev/bus/usb/001/004
    DEVNUM: ‘004’
    DEVPATH: >-
    /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3
    DEVTYPE: usb_device
    DRIVER: usb
    ID_BUS: usb
    ID_MODEL: ‘CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw’
    ID_MODEL_ENC: >-
    CANable\x201205aa6\x20https:\x2f\x2fgithub.com\x2fnormaldotcom\x2fcantact-fw
    ID_MODEL_ID: 60c4
    ID_REVISION: ‘0200’
    ID_SERIAL: >-
    Protofusion_Labs_CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw_0004001E4E4E430820353036
    ID_SERIAL_SHORT: 0004001E4E4E430820353036
    ID_USB_INTERFACES: ‘:020201:0a0000:’
    ID_VENDOR: Protofusion_Labs
    ID_VENDOR_ENC: Protofusion\x20Labs
    ID_VENDOR_ID: ad50
    MAJOR: ‘189’
    MINOR: ‘3’
    PRODUCT: ad50/60c4/200
    SUBSYSTEM: usb
    TYPE: 2/2/0
    USEC_INITIALIZED: ‘82643440814’
  • name: ttyACM1
    sysfs: >-
    /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.0/tty/ttyACM1
    dev_path: /dev/ttyACM1
    subsystem: tty
    by_id: >-
    /dev/serial/by-id/usb-Protofusion_Labs_CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw_0004001E4E4E430820353036-if00
    attributes:
    DEVLINKS: >-
    /dev/serial/by-id/usb-Protofusion_Labs_CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw_0004001E4E4E430820353036-if00
    /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0
    DEVNAME: /dev/ttyACM1
    DEVPATH: >-
    /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.0/tty/ttyACM1
    ID_BUS: usb
    ID_MODEL: ‘CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw’
    ID_MODEL_ENC: >-
    CANable\x201205aa6\x20https:\x2f\x2fgithub.com\x2fnormaldotcom\x2fcantact-fw
    ID_MODEL_ID: 60c4
    ID_PATH: ‘platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0’
    ID_PATH_TAG: platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_3_1_0
    ID_REVISION: ‘0200’
    ID_SERIAL: >-
    Protofusion_Labs_CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw_0004001E4E4E430820353036
    ID_SERIAL_SHORT: 0004001E4E4E430820353036
    ID_TYPE: generic
    ID_USB_DRIVER: cdc_acm
    ID_USB_INTERFACES: ‘:020201:0a0000:’
    ID_USB_INTERFACE_NUM: ‘00’
    ID_VENDOR: Protofusion_Labs
    ID_VENDOR_ENC: Protofusion\x20Labs
    ID_VENDOR_ID: ad50
    MAJOR: ‘166’
    MINOR: ‘1’
    SUBSYSTEM: tty
    USEC_INITIALIZED: ‘82643445676’

Yeah, seems as USB with default firmware, but as serial with candle light… Working now , gonna try add today to HassOS, and then mount it on HA addon…
Going to add a custom component, so the canutils and python-can modules are going to be installed automaticly

@xtra, did you already done some stuff with the canable? Or still using the mcp?

ok, i added can-utils with this command : apk add can-utils
so i can use stuff like candump and slcand in HassOs

but seems i am unable to load the can0 ttyacm0 device, because of the kernel is not loading all “can & slcand” modules …

see here : http://socket-can.996257.n3.nabble.com/Some-problems-with-CANUSB-and-Ubuntu-8-04-9-04-td1632.html

no idea is this is possible in HassOs, so i quess we need an extra add-on for HassOs users

@pergola.fabio
Hm, this is not so good. I personally don’t use HassIO, because I prefer to have a “universal” Linux to build on.
I got my PEAK adapter working by following this guide (+ the socketcan docu):
https://python-can.readthedocs.io/en/master/interfaces/socketcan.html

About your canable.io:
I am pretty sure that the default firmware will be some kind of broken Chinese crap. If I got an canable.io-adapter, I would definitely flash the official firmware to make the device apear as a generic CAN device - no hassle around with unknown and undocumented default crap.

There is maybe an workaround for HassOs, gonna try it tomorrow, if i do a ssh access to the HassOs itself, on port 22222, there is a specific folder thats not read only, a folder to load extra modules in the kernel…

It’s only 3 modules i need to load, to make the can0 appear…nothing todo with firmware…

Cause making af extra addon will not solve my issue, since it will use the same OS kernel…

Afterwards it should be pretty easy i can just add the can-utils and the socket can for python, that’s easy to load with a custom component…

The below 3 i need to add in kernel, then it should work and then I can bring the can0 bus online with those other commands…

sudo modprobe can

sudo modprobe can_raw

sudo modprobe slcan

To bring can0 online, i have also found i a tutorial todo it in a python script, should be easy

I think I’ve lost track :sweat_smile:
What are you doing/planning currently? Just to get the hardware recognized and running?

Yeah, that’s the most important stuff, otherwise I’m not able to join the project :slight_smile:
Would be usefull for others too maybe that are running HassOs

hey @danielschramm, while googling i also find this board, SN65HVD230, its a 3.3v instead of 5v

see also here: https://www.beyondlogic.org/adding-can-controller-area-network-to-the-raspberry-pi/

is that board also supported on ESPHome? so we dont need that level shifter anymore?
but also, that board has less pin’s not sure how to wire it?

This is the board I already successfully used in other projects. Where is your problem about the wiring?
Basically this is plain SPI with (MO)SI, (MI)SO, clock and chip select. The INT line is not necessarily needed (but helps). Let me know which pins are unclear :slight_smile: .

ah, but i dont see those SPI MO and MI pinns on that board? only like tx and rx ? :slight_smile:

but i also think if i want to use it in esphome, there needs a change too
anway, i have asked for a request to use canbus devices to in HassOS, gonna make a PR

The board from your link is a normal MCP2515 board. There are no RX/TX pins.

If you are referring to the CAN bus driver itself, it has some kind of “RX/TX” pins, which are usually wired to either a stand-alone CAN bus controller (like the MCP2515) or a microcontroller with integrated CAN module.
Thats why I switched over to the STM32F103 or STM32F303 microcontrollers instead of Arduinos, because the have exactly that integrated CAN module, so I only need the bus driver IC.

Yes , link is confusing , you see pictures about mcp2515…
But i mean this board : https://www.waveshare.com/sn65hvd230-can-board.htm

ahhhh… I see :slight_smile: . This is basically just the transceiver (bus driver). As said, that one alone requires either a stand-alone CAN bus controller (like the MCP2515) or a microcontroller with integrated CAN module.
Have a look at the MCP2515 board. There is another IC on it, which is the entire transceiver. But it is surely the TJA1050 or the MCP2551. So the SNHVD230 alone is quite useless without an “intelligent” CAN controller.

ah ok, clear!

mayeb usefull for others with HassOS, i created an PR , its approved and merged now, to support canbus on HassOS system, in next release of HassOS, kernel will be compiled to support this hardware : canable + peak => drivers to can be loaded gs_usb (candlelight) / slcan / vcan / peak

that will be sufficient for now :slight_smile:

1 Like

Very good! This is the first and essential step for HassOS :+1: !
At a first glace at your PR, I saw “slcan” -> I am not familiar with the relationships, but this should be only one part of the drivers to include. But from your description I think you are aware of this.

https://www.kernel.org/doc/html/latest/networking/can.html#can-network-drivers

yeah, slcan is somekind of firmware used for canable for example
but i think if its merged, il will use the candlelight firmware , makes it easier to bring the can0 interface up, dont need to mount it anymore from the USB

indeed first step, that way i can work with it too on a HassOS system

and indeed , first i only added vcan and slcan, but later i added more : to also include Peak and Candlelight

CONFIG_CAN=m
CONFIG_CAN_RAW=m
CONFIG_CAN_VCAN=m
CONFIG_CAN_SLCAN=m
CONFIG_CAN_DEV=m
CONFIG_CAN_GS_USB=m
CONFIG_CAN_PEAK_USB=m