Beaglebone Black LCD4-CAN

Because of the hardware modification and the additional CAN interface we need to modify some software as well. The Beaglebone cape manager needs to know how to configure the GPIO pins and the device tree needs to be changed so the Linux operating system can find and register the CAN interface in addition to the LCD and touch panel. I´m not going into detail of this, the internet is full of descriptions and tutorials, just do a search.

Modified eeprom for the projects LCD4-CAN cape.

Modified eeprom for the projects LCD4-CAN cape.

The modified content of the LCD cape eeprom must be loaded to configure the CAN1 interface pins, relocated the ENTER button and it´s telling the cape manager that we can supply power through the cape. Any other data is individual chosen to identify the modified cape. Copy the eeprom binary to the Beaglebone and use the following shell command to update the eeprom. Make sure you have disable the write protection first and run as root.

cat BB-LCD4-CAN.eeprom > /sys/bus/i2c/devices/1-0057/eeprom

The eeprom address (1-0057) is default when no jumper is set on the LCD cape. You can check the eeprom content with another shell command:

cat /sys/bus/i2c/devices/1-0057/eeprom | hexdump -C

Next the device tree blob for the LCD cape must be updated. The original one that comes with the Beaglebones Debian image enables the LCD, touch panel, user buttons and LEDs. The new one includes also the CAN1 interface.

Upload the device tree binary blob to the Beaglebone and then copy to the firmware folder.

cp BB-LCD4-CAN-00A0.dtbo /lib/firmware/.

The next step, most important, ensures that the firmware gets copied to initrd. So it can be found and loaded during boot time. Otherwise the cape will not work. Check the kernel release number with uname -r before and change the command as required.

update-initramfs -uk 3.8.13-bone79

These two commands must be executed whenever the device tree binary blob changes, in example when the device tree source file (DTS) was changed and recompiled.

Debian7 wheezy

Debian8 jessie

In Debian8 edit /boot/uEnv.txt and uncomment/add:

##BeagleBone Black: HDMI (Audio/Video) disabled:
##Custom Cape

The dmesg log should look like below. The cape manager found the cape and loads the device tree binary blob.

[    0.556321] bone-capemgr bone_capemgr.9: compatible-baseboard=ti,beaglebone-black
[    0.586667] bone-capemgr bone_capemgr.9: slot #0: No cape found
[    0.623773] bone-capemgr bone_capemgr.9: slot #1: No cape found
[    0.660883] bone-capemgr bone_capemgr.9: slot #2: No cape found
[    0.691044] bone-capemgr bone_capemgr.9: slot #3: ´4D 4.3 LCD CAPE-4DCAPE-43T+CAN1,00A0,MICTRONICS,BB-LCD4-CAN´
[    0.691146] bone-capemgr bone_capemgr.9: slot #4: specific override
[    0.691166] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 4
[    0.691181] bone-capemgr bone_capemgr.9: slot #4: ´Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G´
[    0.691257] bone-capemgr bone_capemgr.9: slot #5: specific override
[    0.691274] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 5
[    0.691289] bone-capemgr bone_capemgr.9: slot #5: ´Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI´
[    0.691368] bone-capemgr bone_capemgr.9: slot #6: specific override
[    0.691385] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 6
[    0.691399] bone-capemgr bone_capemgr.9: slot #6: ´Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN´
[    0.691718] bone-capemgr bone_capemgr.9: loader: before slot-3 BB-LCD4-CAN:00A0 (prio 0)
[    0.691733] bone-capemgr bone_capemgr.9: loader: check slot-3 BB-LCD4-CAN:00A0 (prio 0)
[    0.691809] bone-capemgr bone_capemgr.9: loader: before slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
[    0.691821] bone-capemgr bone_capemgr.9: loader: check slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
[    0.691893] bone-capemgr bone_capemgr.9: loader: before slot-5 BB-BONELT-HDMI:00A0 (prio 1)
[    0.691905] bone-capemgr bone_capemgr.9: loader: check slot-5 BB-BONELT-HDMI:00A0 (prio 1)
[    0.691938] bone-capemgr bone_capemgr.9: initialized OK.
[    0.692463] bone-capemgr bone_capemgr.9: loader: after slot-3 BB-LCD4-CAN:00A0 (prio 0)
[    0.692482] bone-capemgr bone_capemgr.9: slot #3: Requesting part number/version based ´BB-LCD4-CAN-00A0.dtbo
[    0.692497] bone-capemgr bone_capemgr.9: slot #3: Requesting firmware ´BB-LCD4-CAN-00A0.dtbo´ for board-name ´4D 4.3 LCD CAPE-4DCAPE-43T+CAN1´, version ´00A0´
[    0.692756] bone-capemgr bone_capemgr.9: slot #3: dtbo ´BB-LCD4-CAN-00A0.dtbo´ loaded; converting to live tree

Later on the CAN device driver is loaded.

[    6.177845] CAN device driver interface
[    6.269904] c_can_platform 481d0000.d_can: invalid resource
[    6.276151] c_can_platform 481d0000.d_can: control memory is not used for raminit
[    6.486181] c_can_platform 481d0000.d_can: c_can_platform device registered (regs=fa1d0000, irq=55)

To be continued…

Leave a Reply