Please note: Friday June 18 is a holiday celebrating Juneteenth, please allow extra time for your order to arrive and plan accordingly.
0

No Activity on DO pin when using Adafruit_BBIO python librar
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

No Activity on DO pin when using Adafruit_BBIO python librar

by AlexEshoo on Wed Apr 25, 2018 4:48 pm

I'm having some trouble getting the SPI devices talking on the Beaglebone black. Here's my setup so far:

I've added the following to /boot/uEnv.txt:
Code: Select all | TOGGLE FULL SIZE
cape_enable=bone_capemgr.enable_partno=cape-universala

note: I also have
Code: Select all | TOGGLE FULL SIZE
cape_enable=bone_capemgr.enable_partno=BB-CAN1
in that file since I use canbus also. Not sure if this will cause an issue (?)
Then I rebooted and ran the following commands:
Code: Select all | TOGGLE FULL SIZE
sudo config-pin P9.17 spi_cs
sudo config-pin P9.18 spi
sudo config-pin P9.21 spi
sudo config-pin P9.22 spi_sclk

Then I have a python script `spi_example.py`:
Code: Select all | TOGGLE FULL SIZE
from Adafruit_BBIO.SPI import SPI

spi = SPI(1,0)
spi.msh = 1000000  # Set max speed to 1Mhz
print spi.xfer2([3])

spi.close()

when I run this ( sudo python spi_example.py) I see the following output:
Code: Select all | TOGGLE FULL SIZE
[255]

Which doesn't seem right.
I also hooked a logic analyzer up to it and there is no activity on any of the pins when the script runs.

Is there something obvious I am doing wrong?

AlexEshoo
 
Posts: 5
Joined: Mon Jul 20, 2015 7:16 pm

Re: No Activity on DO pin when using Adafruit_BBIO python li

by drewfustini on Wed Apr 25, 2018 9:39 pm

Hello, I would like to know more about how your BeagleBone is configured.

Please paste the output of:
Code: Select all | TOGGLE FULL SIZE
sudo /opt/scripts/tools/version.sh

cat /boot/uEnv.txt

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: No Activity on DO pin when using Adafruit_BBIO python li

by AlexEshoo on Thu Apr 26, 2018 8:29 am

Version Info:
Code: Select all | TOGGLE FULL SIZE
git:/opt/scripts/:[4dd50b306e4eb31a05bb72a9573febc3695f1f05]
eeprom:[A335BNLT000C1631BBBG0778]
dogtag:[BeagleBoard.org Debian Image 2017-03-19]
bootloader:[/dev/mmcblk0]:[U-Boot 2017.03-00002-gd12b1519b4]
bootloader:[/dev/mmcblk1]:[U-Boot 2016.03-00001-gd12d09f]
kernel:[4.4.54-ti-r93]
nodejs:[v4.8.0]


uEnv.txt:
Code: Select all | TOGGLE FULL SIZE
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.4.54-ti-r93
#uuid=
#dtb=

##BeagleBone Black/Green dtb's for v4.1.x (BeagleBone White just works..)

##BeagleBone Black: HDMI (Audio/Video) disabled:
#dtb=am335x-boneblack-emmc-overlay.dtb

##BeagleBone Black: eMMC disabled:
#dtb=am335x-boneblack-hdmi-overlay.dtb

##BeagleBone Black: HDMI Audio/eMMC disabled:
#dtb=am335x-boneblack-nhdmi-overlay.dtb

##BeagleBone Black: HDMI (Audio/Video)/eMMC disabled:
#dtb=am335x-boneblack-overlay.dtb

##BeagleBone Black: wl1835
#dtb=am335x-boneblack-wl1835mod.dtb

##BeagleBone Green: eMMC disabled
#dtb=am335x-bonegreen-overlay.dtb

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
#enable_uboot_overlays=1
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###Custom Cape
#dtb_overlay=/lib/firmware/<file4>.dtbo
###Disable auto loading of virtual capes (emmc/video/wireless)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
###Cape Universal Enable
#enable_uboot_cape_universal=1
###U-Boot fdt tweaks...
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable video=HDMI-A-1:1024x768@60e

##Example v3.8.x
#cape_disable=capemgr.disable_partno=
#cape_enable=capemgr.enable_partno=

##Example v4.1.x
#cape_disable=bone_capemgr.disable_partno=
#cape_enable=bone_capemgr.enable_partno=

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

cape_enable=bone_capemgr.enable_partno=BB-CAN1
cape_enable=bone_capemgr.enable_partno=cape-universala


AlexEshoo
 
Posts: 5
Joined: Mon Jul 20, 2015 7:16 pm

Re: No Activity on DO pin when using Adafruit_BBIO python li

by drewfustini on Sun Apr 29, 2018 3:42 am

Could you please try that latest BeagleBoard.org Debian image?
http://beagleboard.org/latest-images

I would recommend Debian 9.3 2018-03-05 4GB SD IoT image:
http://debian.beagleboard.org/images/bo ... 4gb.img.xz

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: No Activity on DO pin when using Adafruit_BBIO python li

by AlexEshoo on Mon Apr 30, 2018 9:34 am

I updated to the latest image as you suggested, but I can't seem to get the pin mux set up now.
Code: Select all | TOGGLE FULL SIZE
git:/opt/scripts/:[e307a944e0be0610ff5296e0abe4ad31a6e70daa]
eeprom:[A335BNLT000C1631BBBG0778]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-03-05]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2018.01-00002-ge9ff418fb8]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2016.03-00001-gd12d09f]:[location: dd MBR]
kernel:[4.9.82-ti-r102]
nodejs:[v6.13.0]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg:[bb-cape-overlays]:[4.4.20180305.0-0rcnee0~stretch+20180305]
pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee2~stretch+20180104]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.enable_partno=cape-universala root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet cape_universal=enable]
dmesg | grep pinctrl-single
[    1.396254] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[    1.397275] gpio-of-helper ocp:cape-universal: ready
END

uEnv.txt
Code: Select all | TOGGLE FULL SIZE
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.9.82-ti-r102
#uuid=
#dtb=


###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.4.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
###pru_uio (4.4.x-ti, 4.14.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 quiet video=HDMI-A-1:1024x768@60e

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

cape_enable=bone_capemgr.enable_partno=cape-universala

But when I run:
Code: Select all | TOGGLE FULL SIZE
config-pin P9.17 spi_cs

The output I get is:
P9_17 pinmux file not found!
Pin has no cape: P9_17

I'm not really sure where I've gone wrong.

AlexEshoo
 
Posts: 5
Joined: Mon Jul 20, 2015 7:16 pm

Re: No Activity on DO pin when using Adafruit_BBIO python li

by drewfustini on Mon Apr 30, 2018 3:53 pm

I think one issue is that the bootloader installed on the eMMC is quite old:
Code: Select all | TOGGLE FULL SIZE
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2016.03-00001-gd12d09f]:[location: dd MBR]

Please run this script to update the bootloader on the eMMC:
Code: Select all | TOGGLE FULL SIZE
/opt/scripts/tools/developers/update_bootloader.sh

Reboot and then run this script:
Code: Select all | TOGGLE FULL SIZE
/opt/scripts/tools/version.sh

If "bootloader:[eMMC-(default)]:" is still the old version, then try running this command which will delete the bootloader from the eMMC (which is OK if you are running from SD card):
Code: Select all | TOGGLE FULL SIZE
sudo dd if=/dev/zero of=/dev/mmcblk1 bs=1M count=10

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: No Activity on DO pin when using Adafruit_BBIO python li

by AlexEshoo on Wed May 02, 2018 9:08 am

I updated the bootloader using the script provided, but it did not update the eMMC. I just booted with the push button, however and was able to use `config-pin` again successfully. And when I tried the SPI library again, the data transmission was successful verified by logic analyzer. Thanks for all your help.

I did have a couple follow up questions, however. The output of the python script is still `[255]` while the data transmitted is `[3]` is this to be expected?
Also I would really like a way to update the bootloader on the eMMC as well, is there a good guide for doing this you can point me to?

AlexEshoo
 
Posts: 5
Joined: Mon Jul 20, 2015 7:16 pm

Re: No Activity on DO pin when using Adafruit_BBIO python li

by drewfustini on Wed May 02, 2018 11:57 pm

This command should remove the bootloader from the emmc:
sudo dd if=/dev/zero of=/dev/mmcblk1 bs=1M count=10

Then run the update boot loader script again.

As for the output, please post the code that you are running.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: No Activity on DO pin when using Adafruit_BBIO python li

by AlexEshoo on Thu May 03, 2018 12:19 am

Thanks, I'll try that for the bootloader.

I am running the same code from my original post. I did notice that the MISO line is high for the duration of the transmission since I'm just measuring the bus without connecting a slave and I imagine there's a pull-up resistor for that pin. Is the output of xfer2 the value read from the MISO line during transmission?

AlexEshoo
 
Posts: 5
Joined: Mon Jul 20, 2015 7:16 pm

Re: No Activity on DO pin when using Adafruit_BBIO python li

by drewfustini on Thu May 03, 2018 12:41 am

Yes, looking at the function:
https://github.com/adafruit/adafruit-be ... ule.c#L298

I believe the return value is what was received while transmitting.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Please be positive and constructive with your questions and comments.