Open Eisbaeeer opened 1 year ago
Kernel patching should not be required for a 6.x kernel. You just need to add the device overlay for the can0
device to be activated. Regarding hardware, a CAN transceiver like MCP2562 or ISO1050 is required to interface with the physical CAN bus.
Thank you for quick reply. I loaded the overlay successfully. The Kernel modules will be shown by:
lsmod |grep "can" can_raw 20480 0 can 20480 1 can_raw
Is there any way to use the waveshare can hat to connect to PH20/21?
I´m right, that the rpi does not have can support by CPU?
The rpi uses the SPI interface and this overlay:
dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000
Do you know a "ready-to-run" pcb to connect the PH20/21 if the waveshare can hat does not work with it?
I think this should work? Pin1/4 to PH20/21
Greets Lars
I don't think the Waveshare board is suited for this, as it connects via RS485 and SPI. You don't want a CAN controller, but a transceiver for generating the physical CAN levels. ISO1050 and MCP2562 are very easy to implement with few external parts. I used an empty RPI3 DIY hat for this.
After checking the wiring of waveshare, I ordered an MCP2562 and DIY-HAT. The waveshare uses an SPI to CAN-BUS converter. So it is not possible to use that. It´s hard to see, that the M2 does not wire the PH20/21 to GPIO pins like the M1 does. Last question: Why there are three wires on your pictures? You wrote, that you used a DIY HAT. The only two wires are needed are the PH20/21, right? Ground, 3.3V and 5V will be provided at the GPIO pins. Did you moved the activity LED to an other GPIO? Greets Lars
The black wire was for testing with the oscilloscope only when I tried the HW modification for the first time, it is not required.
After upgrading Kernel, CAN is not working anymore. One way will be to freeze kernel.
Which were the kernel versions before and after upgrade?
Hi. Actually installed:
Linux version 6.1.9-sunxi (root@428dcb7d02fb) (arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0, GNU ld (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 2.32.0.20190321) #trunk.0227 SMP Wed Feb 1 23:36:32 UTC 2023
No output with: lsmod |grep "can"
Did you try to modprobe -v sun4i_can
? Is the device tree overlay still active?
After doing the "new" modprobe -v sun4i_can i got this:
root@bananapim2ultra:~# lsmod |grep "can" sun4i_can 20480 0 can_dev 32768 1 sun4i_can
If I try to bring up can0 device
root@bananapim2ultra:~# ip link set can0 type can bitrate 250000 restart-ms 100 Cannot find device "can0"
also tried to load the modules on bootup with /etc/modules
sun4i_can
The device overlay is active with:
root@bananapim2ultra:~# cat /tmp/boot/boot/armbianEnv.txt verbosity=1 bootlogo=false console=both disp_mode=1920x1080p60 overlay_prefix=sun8i-r40 rootdev=UUID=f715d544-bf3a-4ee9-8a38-8feb2de051d1 rootfstype=ext4 user_overlays=bananapi-m2-berry-can usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
But don´t get a can0 device.
On this post the same problem. It seems a kernel patch is needed. https://forum.armbian.com/topic/726-can-bus-a20/
The linked post on the armbian forum is about device tree patching on A20 (BPI M1).
Can you post the full output of lsmod
and cat /proc/net/dev
?
I bought a Bananapi M2 Berry. My target is to exchange my Rpi with the Banana one. I´m using the waveshare RS485 CAN HAT to communicate with my Voron printer CAN hotend. With Rpi and CAN HAT all works fine. Now I read, that the Banana own´s CAN by design. The hardware changes are no problem. But what´s to do with my distri? How to get the can-interface? This is, what I actually installed on my Banana:
`# PLEASE DO NOT EDIT THIS FILE BOARD=bananapim2ultra BOARD_NAME="Banana Pi M2 Ultra" BOARDFAMILY=sun8i BUILD_REPOSITORY_URL=https://github.com/armbian/build BUILD_REPOSITORY_COMMIT=3188514 VERSION=23.02.0-trunk LINUXFAMILY=sunxi ARCH=arm IMAGE_TYPE=nightly BOARD_TYPE=csc INITRD_ARCH=arm KERNEL_IMAGE_TYPE=Image IMAGE_UUID=df4f5707-5c19-4995-8bdf-01adaee3cb19
PLEASE DO NOT EDIT THIS FILE
BOARD=bananapim2ultra BOARD_NAME="Banana Pi M2 Ultra" BOARDFAMILY=sun8i BUILD_REPOSITORY_URL=https://github.com/armbian/build BUILD_REPOSITORY_COMMIT=3188514 VERSION=23.02.0-trunk LINUXFAMILY=sunxi ARCH=arm IMAGE_TYPE=nightly BOARD_TYPE=csc INITRD_ARCH=arm KERNEL_IMAGE_TYPE=Image BRANCH=edge DISTRIB_ID=Ubuntu DISTRIB_RELEASE=23.04 DISTRIB_CODENAME=lunar DISTRIB_DESCRIPTION="Ubuntu Lunar Lobster (development branch)" PRETTY_NAME="Armbian 23.02.0-trunk Lunar" NAME="Ubuntu" VERSION_ID="23.04" VERSION="23.04 (Lunar Lobster)" VERSION_CODENAME=lunar ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=lunar LOGO=ubuntu-logo ` Is your patch also working for this version? Thank´s in advice. Greets Lars