Hello, all! This is my first post on this board, so please excuse any poor formatting or rookie mistakes.
Anyway, I recently started a project using Tiny Core on a Pi Zero to try to interface with my car's CAN bus.
I've attempted to get this
MCP2515+TJA1050 board to work by altering the PCB and connecting it to the Pi as discussed
here.
I've set mounted home and tce directories in my cmdline.txt, since this Pi will not be able to connect to the internet to download extensions in its normal operation, and it will need to read many audio files which I would prefer were not copied to RAM on every boot.
Additionally, I have put these 2 lines at the bottom of my config.txt:
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=12
dtoverlay=spi-bcm2835-overlay
and I changed
dtparam=i2c=on,spi=on,i2s=on
to
dtparam=i2c=off,spi=on,i2s=off
elsewhere in the file to slightly speed up boot times.
To get the can0 interface recognized on spi0.0, I placed the following files from the source archive into /usr/local inside two .tcz extensions which I have load on boot:
/lib/modules/4.9.22-piCore/kernel/drivers/net/can/can-dev.ko
/lib/modules/4.9.22-piCore/kernel/drivers/net/can/spi/mcp251x.ko
/lib/modules/4.9.22-piCore/kernel/net/can/can-raw.ko
/lib/modules/4.9.22-piCore/kernel/net/can/can-gw.ko
/lib/modules/4.9.22-piCore/kernel/net/can/can-bcm.ko
/lib/modules/4.9.22-piCore/kernel/net/can/can.ko
I attempted to use code in a C++ program to listen for messages over can0 using the socketcan broadcast manager, but when that didn't work, I compiled can-utils and ran the following 2 commands:
tce-load -il iproute2
sudo ip link set can0 up type can bitrate 500000
I set up another of these MCP2515 boards with an Arduino Uno to create a testbench CAN bus. I then connected the 2 modules together and placed jumpers on the boards to enable the 120 ohm resistors between CAN high and low on each end of the bus, and put a sketch on the Arduino to send a CAN message every second. When I ran candump on the Pi and scoped each pin of the MCP boards, I discovered that there was normal activity on the Arduino's SPI connection to the MCP board, and the signal was present on both sides of the CAN bus at the boards, but on the Pi's SPI connection, only INT, CS, and VCC were high at 3.3v, while SCK, SI, SO, and of course GND were at 0v. At no point during sending or receiving with my program nor with candump, cangen, and cansend did any of these pins change.
At this point, I'm at a loss as to what to do next to diagnose this or get it working, so any help is appreciated! Thanks for reading!