SPI Overlay not changing states BBB 4.1.15-ti-r43 Debian Image 2015-11-12

I am trying to get the SPI bus to work, unfortunately it will not change states. Is there something obvious that I am missing. I believe that this ties into my previous post on strace and is the reason that I cannot my LCD to work. Thanks in advance to those that respond to this post.

Linux beaglebone 4.1.15-ti-r43 #1 SMP PREEMPT Thu Jan 21 22:33:31 UTC 2016 armv7l GNU/Linux

BeagleBoard.org Debian Image 2015-11-12

root@beaglebone:~# . ~/.profile

root@beaglebone:~# echo $SLOTS

/sys/devices/platform/bone_capemgr/slots

root@beaglebone:~# echo $PINS

/sys/kernel/debug/pinctrl/44e10800.pinmux/pins

root@beaglebone:~# ls

DM-SPI-Test-00A0.dtbo DM-SPI-Test.dtbo DM-SPI-Test.dts bb.org-overlays boneDeviceTree exploringBB git

root@beaglebone:~# dtc -O dtb -o DM-SPI-Test-00A0.dtbo -b 0 -@ DM-SPI-Test.dts

root@beaglebone:~# cp DM-SPI-Test-00A0.dtbo /lib/firmware

root@beaglebone:~# cd /lib/firmware

root@beaglebone:/lib/firmware# ls

ADAFRUIT-SPI0-00A0.dtbo BB-UART3-00A0.dtbo PyBBIO-gpio0_11-00A0.dtbo PyBBIO-gpio1_3-00A0.dtbo PyBBIO-gpio3_19-00A0.dtbo

ADAFRUIT-SPI1-00A0.dtbo BB-UART4-00A0.dtbo PyBBIO-gpio0_12-00A0.dtbo PyBBIO-gpio1_30-00A0.dtbo PyBBIO-gpio3_21-00A0.dtbo

ADAFRUIT-UART1-00A0.dtbo BB-UART5-00A0.dtbo PyBBIO-gpio0_13-00A0.dtbo PyBBIO-gpio1_31-00A0.dtbo PyBBIO-usr0-00A0.dtbo

ADAFRUIT-UART2-00A0.dtbo BB-W1-P9.12-00A0.dtbo PyBBIO-gpio0_14-00A0.dtbo PyBBIO-gpio1_4-00A0.dtbo PyBBIO-usr1-00A0.dtbo

ADAFRUIT-UART4-00A0.dtbo DM-SPI-Test-00A0.dtbo PyBBIO-gpio0_15-00A0.dtbo PyBBIO-gpio1_5-00A0.dtbo PyBBIO-usr2-00A0.dtbo

ADAFRUIT-UART5-00A0.dtbo DVK530-LCD4-01-00A0.dtbo PyBBIO-gpio0_2-00A0.dtbo PyBBIO-gpio1_6-00A0.dtbo PyBBIO-usr3-00A0.dtbo

BB-ADC-00A0.dtbo LICENCE.atheros_firmware PyBBIO-gpio0_20-00A0.dtbo PyBBIO-gpio1_7-00A0.dtbo bone_eqep0-00A0.dtbo

BB-BBBMINI-00A0.dtbo LICENCE.broadcom_bcm43xx PyBBIO-gpio0_22-00A0.dtbo PyBBIO-gpio2_1-00A0.dtbo bone_eqep1-00A0.dtbo

BB-BONE-AUDI-02-00A0.dtbo LICENCE.rtlwifi_firmware.txt PyBBIO-gpio0_23-00A0.dtbo PyBBIO-gpio2_10-00A0.dtbo bone_eqep2-00A0.dtbo

BB-BONE-BACONE-00A0.dtbo LICENCE.ti-connectivity PyBBIO-gpio0_26-00A0.dtbo PyBBIO-gpio2_11-00A0.dtbo bone_eqep2b.dtbo

BB-BONE-CRYPTO-00A0.dtbo NL-AB-BBBC-00D0.dtbo PyBBIO-gpio0_27-00A0.dtbo PyBBIO-gpio2_12-00A0.dtbo brcm

BB-BONE-DVID-01-00A3.dtbo PyBBIO-ADC-00A0.dtbo PyBBIO-gpio0_3-00A0.dtbo PyBBIO-gpio2_13-00A0.dtbo cape-CBB-Serial-r01.dtbo

BB-BONE-LCD3-01-00A2.dtbo PyBBIO-AIN0-00A0.dtbo PyBBIO-gpio0_30-00A0.dtbo PyBBIO-gpio2_14-00A0.dtbo cape-bone-ibb-00A0.dtbo

BB-BONE-LCD4-01-00A1.dtbo PyBBIO-AIN1-00A0.dtbo PyBBIO-gpio0_31-00A0.dtbo PyBBIO-gpio2_15-00A0.dtbo cape-univ-audio-00A0.dtbo

BB-BONE-LCD7-01-00A3.dtbo PyBBIO-AIN2-00A0.dtbo PyBBIO-gpio0_4-00A0.dtbo PyBBIO-gpio2_16-00A0.dtbo cape-univ-emmc-00A0.dtbo

BB-BONE-REPLICAP-00B1.dtbo PyBBIO-AIN3-00A0.dtbo PyBBIO-gpio0_5-00A0.dtbo PyBBIO-gpio2_17-00A0.dtbo cape-univ-hdmi-00A0.dtbo

BB-BONE-SERL-03-00A1.dtbo PyBBIO-AIN4-00A0.dtbo PyBBIO-gpio0_7-00A0.dtbo PyBBIO-gpio2_2-00A0.dtbo cape-universal-00A0.dtbo

BB-BONE-WTHR-01-00B0.dtbo PyBBIO-AIN5-00A0.dtbo PyBBIO-gpio0_8-00A0.dtbo PyBBIO-gpio2_22-00A0.dtbo cape-universaln-00A0.dtbo

BB-CAN1-00A0.dtbo PyBBIO-AIN6-00A0.dtbo PyBBIO-gpio0_9-00A0.dtbo PyBBIO-gpio2_23-00A0.dtbo carl9170-1.fw

BB-I2C1-00A0.dtbo PyBBIO-AIN7-00A0.dtbo PyBBIO-gpio1_0-00A0.dtbo PyBBIO-gpio2_24-00A0.dtbo dev-USB-PWR-CTL-00A1.dtbo

BB-I2C1-PCA9685-00A0.dtbo PyBBIO-ecap0-00A0.dtbo PyBBIO-gpio1_1-00A0.dtbo PyBBIO-gpio2_25-00A0.dtbo htc_9271.fw

BB-I2C2-0A00.dtbo PyBBIO-ecap1-00A0.dtbo PyBBIO-gpio1_12-00A0.dtbo PyBBIO-gpio2_3-00A0.dtbo mt7601u.bin

BB-RELAY-4PORT-00A0.dtbo PyBBIO-ehrpwm1-00A0.dtbo PyBBIO-gpio1_13-00A0.dtbo PyBBIO-gpio2_4-00A0.dtbo rtlwifi

BB-RTC-01-00A0.dtbo PyBBIO-ehrpwm2-00A0.dtbo PyBBIO-gpio1_14-00A0.dtbo PyBBIO-gpio2_5-00A0.dtbo ti-connectivity

BB-SPI0-MCP3008-00A0.dtbo PyBBIO-epwmss0-00A0.dtbo PyBBIO-gpio1_15-00A0.dtbo PyBBIO-gpio2_6-00A0.dtbo univ-all-00A0.dtbo

BB-SPI1-01-00A0.dtbo PyBBIO-epwmss1-00A0.dtbo PyBBIO-gpio1_16-00A0.dtbo PyBBIO-gpio2_7-00A0.dtbo univ-emmc-00A0.dtbo

BB-SPIDEV1-00A0.dtbo PyBBIO-epwmss2-00A0.dtbo PyBBIO-gpio1_17-00A0.dtbo PyBBIO-gpio2_8-00A0.dtbo univ-hdmi-00A0.dtbo

BB-SPIDEV1.dtbo PyBBIO-eqep0-00A0.dtbo PyBBIO-gpio1_18-00A0.dtbo PyBBIO-gpio2_9-00A0.dtbo univ-nhdmi-00A0.dtbo

BB-SPIDEV1A1-00A0.dtbo PyBBIO-eqep1-00A0.dtbo PyBBIO-gpio1_19-00A0.dtbo PyBBIO-gpio3_14-00A0.dtbo

BB-UART1-00A0.dtbo PyBBIO-eqep2-00A0.dtbo PyBBIO-gpio1_2-00A0.dtbo PyBBIO-gpio3_15-00A0.dtbo

BB-UART2-00A0.dtbo PyBBIO-eqep2b-00A0.dtbo PyBBIO-gpio1_28-00A0.dtbo PyBBIO-gpio3_16-00A0.dtbo

BB-UART2-RTSCTS-00A0.dtbo PyBBIO-gpio0_10-00A0.dtbo PyBBIO-gpio1_29-00A0.dtbo PyBBIO-gpio3_17-00A0.dtbo

root@beaglebone:/lib/firmware# cat $SLOTS

0: PF---- -1

1: PF---- -1

2: PF---- -1

3: PF---- -1

root@beaglebone:/lib/firmware# cat $PINS|grep 950

pin 84 (44e10950.0) 00000037 pinctrl-single

root@beaglebone:/lib/firmware# cat $PINS|grep 954

pin 85 (44e10954.0) 00000037 pinctrl-single

root@beaglebone:/lib/firmware# cat $PINS|grep 958

pin 86 (44e10958.0) 00000037 pinctrl-single

root@beaglebone:/lib/firmware# cat $PINS|grep 95c

pin 87 (44e1095c.0) 00000037 pinctrl-single

root@beaglebone:/lib/firmware# echo DM-SPI-Test > $SLOTS

root@beaglebone:/lib/firmware# cat $PINS|grep 950

pin 84 (44e10950.0) 00000037 pinctrl-single

root@beaglebone:/lib/firmware# cat $PINS|grep 954

pin 85 (44e10954.0) 00000037 pinctrl-single

root@beaglebone:/lib/firmware# cat $PINS|grep 958

pin 86 (44e10958.0) 00000037 pinctrl-single

root@beaglebone:/lib/firmware# cat $PINS|grep 95c

pin 87 (44e1095c.0) 00000037 pinctrl-single

Here is the code …

/*

  • Copyright © 2013 CircuitCo

after ^

dmesg | grep bone

Regards,

root@beaglebone:~# dmesg | grep bone
[ 5.093226] bone_capemgr bone_capemgr: Baseboard: ‘A335BNLT,000C,2715BBBK0795’
[ 5.100609] bone_capemgr bone_capemgr: compatible-baseboard=ti,beaglebone-black - #slots=4
[ 5.168530] bone_capemgr bone_capemgr: slot #0: No cape found
[ 5.228522] bone_capemgr bone_capemgr: slot #1: No cape found
[ 5.288522] bone_capemgr bone_capemgr: slot #2: No cape found
[ 5.348521] bone_capemgr bone_capemgr: slot #3: No cape found
[ 5.354392] bone_capemgr bone_capemgr: initialized OK.
[ 6.570208] systemd[1]: Set hostname to .
[ 6.839587] systemd[1]: Configuration file /lib/systemd/system/bonescript.socket is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
[ 6.860332] systemd[1]: Configuration file /lib/systemd/system/bonescript.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
[ 6.963418] systemd[1]: Configuration file /lib/systemd/system/bonescript-autorun.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
[ 507.748022] bone_capemgr bone_capemgr: part_number ‘DM-SPI-Test’, version ‘N/A’
[ 507.756582] bone_capemgr bone_capemgr: slot #4: override
[ 507.770021] bone_capemgr bone_capemgr: Using override eeprom data at slot 4
[ 507.777097] bone_capemgr bone_capemgr: slot #4: ‘Override Board Name,00A0,Override Manuf,DM-SPI-Test’
[ 507.801823] bone_capemgr bone_capemgr: slot #4: dtbo ‘DM-SPI-Test-00A0.dtbo’ loaded; overlay id #0

ls -lh /dev/spi*

remember you application was looking for:

open("/dev/spidev2.0", O_RDWR) = -1 ENOENT (No such file or directory)

so make sure you application has the correct port name..

Regards,

I ought to qualify what I am saying here. To be clear this application does not appear to be looking for a spidev2.0. All said I am still not getting a change in state. I had a similar problem with GPIO’s yet that went away with the latests updates, this however seems to be sticking. No change. Am I missing something here ?

I did some experiments and see what appears to be serious errors in dmesg. (not experienced in reading these).

I boot, and then look at slots:

0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,univ-emmc

This is normal. I’m using a slightly modified version of univ-emmc to connect PRUs.
This works as expected. I had not tried additional changes to the slots until now.
Remove slot 4:

echo -4 > slots

cat slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1

All looks good to this point. Now add a different dtbo:

echo cape-universal > slots

Now the ssh connection to the board closes.
But it’s not a hard crash, I can ssh back in. From dmesg:
[ 287.654746] Unable to handle kernel NULL pointer dereference at virtual address 00000004

That is at least one problem, I think there are more.

I’m sure there are plenty of other clues. dmesg is pretty long, so I attached a file.
I’m using 4.1.15-ti-rt-r43 on a Beaglebone Black.

Greg

dmesg_slots_problem_jan31.txt (73.2 KB)

I’ve been using spi2 quite extensively in python:

from spidev import SpiDev as SPI
and it works fine for me.

ls /dev/spi*
/dev/spidev1.0 /dev/spidev1.1

sudo cat $SLOTS
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-BONE-PRU
5: P-O-L- 1 Override Board Name,00A0,Override Manuf,BB-ADC
6: P-O-L- 2 Override Board Name,00A0,Override Manuf,ADAFRUIT-SPI1

uname -a
Linux BBB4 4.1.15-bone17 #1 Wed Dec 16 17:39:16 UTC 2015 armv7l GNU/Linux

lsb_release -d
Description: Debian GNU/Linux 8.3 (jessie)

I could post my tbo file if you think it would help, but I don’t think I changed it much besides playing with the clock rate
and making sure d1 and d0 change on negative edges of the clock (i.e. commenting out spi-cpha;)
Have you checked your pins carefully; for example, the clock should be an input not an output; I’ve never figured this one out.

I load the overlays using a service that simply calls a shell script in my bin directory:

#!/bin/sh
cd /lib/firmware
echo BB-BONE-PRU > /sys/devices/platform/bone_capemgr/slots
echo BB-ADC > /sys/devices/platform/bone_capemgr/slots
echo ADAFRUIT-SPI1 > /sys/devices/platform/bone_capemgr/slots

I could also post the service, but it is very straightforward and simple.

My pins are defined as:

pinctrl_spi1_pins {
pinctrl-single,pins = <0x190 0x33 0x194 0x33 0x198 0x13
0x19c 0x13>;
linux,phandle = <0x1>;
phandle = <0x1>;
};

When I do >sudo cat $PINS, their values are verified:

pin 100 (44e10990.0) 00000033 pinctrl-single
pin 101 (44e10994.0) 00000033 pinctrl-single
pin 102 (44e10998.0) 00000013 pinctrl-single
pin 103 (44e1099c.0) 00000013 pinctrl-single

I hope this helps a bit.