USE AT YOUR OWN RISK!!!
Hardware:
Take a Raspberry Pi running the latest Jessie FULL version, specifically 4.9.35-v7+ (2017).
The Linux kernel includes almost everything you need. For older operating systems, the configurations may be slightly different, but you can use the familiar "how-to" guides for those cases.
I can only recommend the StromPi because it offers the possibility of connecting the Raspberry Pi to the mains power supply.
There's a CAN bus interface available, which is called MCP2515 on the network. Actually, that's one of the chips used, but that doesn't really matter for now.
The component can be identified by the "NiRen" marking on the circuit board.
It is important to disconnect the power supply of the TJA1050 and then provide it with a separate 5V power source.
Because if the GPIO pins of the Raspberry Pi are powered with 5V, you will have created a paperweight.
So, connect the 3V3 from the Raspberry Pi to the VCC of the MCP2515, and connect the 5V directly to the TJA1050 (but please remember to isolate them!).
If you search online, you'll quickly find something, although it includes a capacitor to ground, which isn't strictly necessary.
Please note the scratch mark on the right side, next to the soldered cable.
I also replaced the 8 MHz quartz crystal with a 16 MHz one. (It's not necessary to do this, but it seems you can achieve higher baud rates as a result.)
Here is the standard tutorial .
Software:
Once the operating system installation is complete, you can immediately start making some adjustments to the settings.
Does the standard tutorial not work for you?
Very simple.
The tutorial is quite old.
In the terminal:
sudo apt-get install can-utils // Installing
sudo raspi-config // Enable SPI
with
sudo nano /boot/config.txt
The line with...
dtparam=spi-on // Optionally, comment this out
"then add the following line:"
dtoverlay=mcp2515-can0, oscillator=16000000,interrupt=25 // Important: Space after the comma before "oscillator"! Use oscillator=8000000 for an 8MHz quartz crystal.
"Those who don't want to constantly start the CAN interface manually (using commands like `sudo ip link set can0 up type can bitrate 500000`) can use..."
sudo nano /etc/network/interfaces
at the end of the line.
Code: |
auto can0
iface can0 can static
bitrate 500000
|
supplement. It's also included again with the important and correct indentation in the standard TuT documentation.
Save and restart.
After the restart.
sudo ip link set can0 up type can bitrate 500000
with
ifconfig
It checks whether
can0 is present in the first line. The 1000 zeros are normal because the CAN bus functions like a network, but addressing is done via IDs.
There are still ways to test the software without a real CAN bus; just search for "vcan" or "vcan0 mcp2515," and you'll find something.
Regarding my software:
The spell checker modifies the source code. That's why I uploaded it as a ZIP archive.
Have fun!