While I’m relatively new to Python, I’m trying to get some Python test code to run on a Raspberry Pi 3B and talk CAN to a device under test. I have a 2 CAN FD HAT for the communication. But, I’m seeing something strange.
I have the two ports tied together in order to continuously monitor can1 and the bus. I send my commands through can0 to the DUT. However, whenever can1 reports a message, the data length is OK, but the message repeats the 1st byte twice, and the last byte is dropped. Here is an example message:
https://github.com/Seeed-Studio/pi-hats/issues/7 You can see the discussion in these issues. We are going to switch Marck’s Linux driver.
For now, There is a temporary way for test the software.
mkdir /opt/kernel
git clone --depth=1 --branch v4.19-rpi/mcp25xxfd-20200429-46 https://github.com/marckleinebudde/linux.git
cd linux
KERNEL=kernel7l
make bcm2711_defconfig
make -j4 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
OK, all the makes succeeded. The 1st and 2nd copy commands failed because there’s no .dtp directory in either arch/arm/boot or arch/arm/boot/overlays. The last 2 copy commands succeeded. Any suggestions?
Also, am I correct in assuming that copying things into the /boot directory will make our new kernel the default kernel that my Pi will boot with? If so, how easy will it be to switch back to the existing kernel?
Some updates, second can1 interface doesn’t come up after building and installing the patched module, getting this error:
mcp25xxfd spi1.0 (unnamed net_device) (uninitialized): Failed to detect MCP2517FD (osc=0x00000000).
When you boot your Raspberry Pi, the first thing you’ll see (unless you’re prepping an installation with NOOBS) is the GPU test screen. This is commonly known as the “rainbow screen” and is intended to appear for just a couple of seconds. After this, the operating system should load.
However, sometimes this doesn’t happen. Instead, the device will hang at the GPU test. If this occurs, you have a problem.
common raspberry pi issues and fixes
In most cases, this is due to a problem with the Raspbian kernel image on your microSD card. To test, install Raspbian onto another microSD card, and boot from this instead. If it works, then you know the problem is with the original microSD card.
However, it’s not ideal. Additionally, you may have data you need from the original microSD card. In order to retrieve this data, insert the microSD card into your computer’s card reader. Browse to the /home/ folder, then copy it to your PC’s hard disk drive.