Canberry V 2.0 Canbus for Raspberry Pi B+ and A+
Canberry Pi V 2.0 is an extension board for Raspberry Pi B+ and A+. It is an Open Hardware Design. It has two functionalities: a can bus module and an onboard Real Time clock powered by a 12 mm battery. In figure is shown the Board on Raspberry PI.
The CanBus is based on MCP2515 SPI controller and the MCP2551 transceiver. All functionalities are full integrated in standard linux kernel, so, they can be available on fly, or at last recompiling linux kernel to add canbus functionalities. Canberry Pi V 2.0 is a “restyling” of V 1.1. The new version contains the same can controller and transceiver, but a different RTC. The RTC is the DS3231 with an internal temperature compensated oscillator of a classic DS1307 with external oscillator. The new board is desaigned with the Raspberry Hat specification. There are four fixing holes and the hardware identification EEPROM (Blank Memory not mounted).
If you have a RPI A or B see the Canberry V1.1 web page.
There is an important difference with V1.1, the MCP2515 interrupt is connected on GPIO22-PIN15 instead of GPIO25-PIN22. If your ISO works with boards like Canberry 1.1 or PiCan, you must redefine the interrupt pin, to use candump.
Edit /boot/config.txt modify the following row
It’s possible to order this board for only 23€ (21€ with DS1307 RTC) on Industrialberry contact form.
Canberry V2.0 is out of production, you can buy the V2.1.
Industrialberry needs of a global distributor, if interested use the contact form (Commercial).
Attention, for a mistake of the PCB manufacturer, the PCB aperture for Camera Flex is closed.
The first pin of connector X1 ( Green Screw Terminal Block) on the left of Ethernet is GND, the second is CANL and the third is CANH.
Download ready to use ISOs (kernel 4.1.7+ for Rpi B2 and B+ , kernel 3.12.28+ for Rpi 1or kernel 3.18.7-v7 for Rpi B+2)
How to prepare a SD Card with CAN kernel modules (only for expert Linux users).
Procedure tested on Raspberry B Rev 1, B Rev 2 and B+ Rev1.
Download Wheezy Raspbian 2014-09-09, but no kernel update is necessary, you must use the version 3.12.28+
After your raspberry has been booted, go to home directory:
add these lines to the script
insmod /lib/modules/3.12.28+/extra/spi-config.ko devices=\bus=0:cs=0:modalias=mcp2515:speed=10000000: gpioirq=25:pd=20:pds32-0=16000000:pdu32-4=0X2002:force_release
ip link set can0 up type can bitrate 1000000
Run the script:
sudo sh can-start.sh
So the system is ready, then you can use standard canbus command to use the peripheral:
candump can0 -> to monitoring can bus traffic
cansend can0 7DF#0201050000000000 -> to send canbus commands
Or read the following guide
For skilled linux users it’s possible to read this guide ( http://skpang.co.uk/blog/archives/1165 ) to prepare the ISO by yourself.
How to use RTC DS1307Z (DS3231)
It is possible to confugure the RTC IC with the terminal
- Login as root
- install i2c-tools apt-get install i2c-tools
- install libi2c-dev apt-get install libi2c-dev
- edit blacklist file nano /etc/modprobe.d/raspi-blacklist.conf
- Add # before blacklist spi-bcm2708
- Add # before blacklist i2c-bcm2708
- Edit nano /etc/modules
- Add rtc-ds1307
- Edit nano /etc/rc.local
- Add echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device (Rasp Pi Revision 1) or echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device (Rasp Pi Revision 2 and B+)
- Add hwclock -s
or with a compiled program. The DS1307Z (DS3231) is a device I2C, and then we must install i2c-tools and libi2c-dev before use it.