LED Backpack not working on beaglebone black with debian 9.4

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
TheGribble
 
Posts: 8
Joined: Wed Aug 29, 2018 8:34 am

LED Backpack not working on beaglebone black with debian 9.4

Post by TheGribble »

Hi,

I've got a seven segment LED backpack I'm trying to get working with a beaglebone black. I've got a clean install of the latest stable BB image (Debian 9.4 2018-06-17 4GB SD IoT) and followed the instructions given here (https://learn.adafruit.com/led-backpack ... ack/wiring) until I try to run the sample code. I then get this error:

Code: Select all

Traceback (most recent call last):
  File "sevensegment_test.py", line 33, in <module>
    display.begin()
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_LED_Backpack-1.8.1-py2.7.egg/Adafruit_LED_Backpack/HT16K33.py", line 53, in begin
    self._device.writeList(HT16K33_SYSTEM_SETUP | HT16K33_OSCILLATOR, [])
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-1.0.3-py2.7.egg/Adafruit_GPIO/I2C.py", line 129, in writeList
    self._bus.write_i2c_block_data(self._address, register, data)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_PureIO-0.2.3-py2.7.egg/Adafruit_PureIO/smbus.py", line 294, in write_i2c_block_data
    self._device.write(data)
IOError: [Errno 16] Device or resource busy
If I run i2cdetect it seems to find the backpack on the right address:

Code: Select all

i2cdetect -r 2
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
root@beaglebone:~/Adafruit_Python_LED_Backpack/examples#

Has anybody got any ideas?

Thanks!

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

Re: LED Backpack not working on beaglebone black with debian

Post by drewfustini »

It is import to know what versions of software you have installed on your BeagleBone, especially the version of u-boot bootloader on the eMMC.

Please run:

Code: Select all

sudo /opt/scripts/tools/version.sh
and copy the output into your reply.

Also, please upload a photo that shows how the hardware is connected.

User avatar
TheGribble
 
Posts: 8
Joined: Wed Aug 29, 2018 8:34 am

Re: LED Backpack not working on beaglebone black with debian

Post by TheGribble »

Hiya, thanks for getting back!

Here's the output of the version script:

Code: Select all

debian@beaglebone:~/Adafruit_Python_LED_Backpack/examples$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[31292bce1d4b35b497cc7a013d6d57e7e1f4f5c4]
eeprom:[A335BNLT00C04815BBBK0BA1]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-06-17]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2018.03-00002-gac9cce7c6a]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.03-00002-gac9cce7c6a]:[location: dd MBR]
kernel:[4.14.49-ti-r54]
nodejs:[v6.14.3]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.4.20180611.0-0rcnee0~stretch+20180611]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[roboticscape]:[0.4.4-git20180608.0-0rcnee0~stretch+20180609]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
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.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[    1.062655] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[    1.069381] gpio-of-helper ocp:cape-universal: ready
END
I've attached a photo of the setup; I believe I've wired the beaglebone to the display as in the diagram (pins 1, 5, 19, 20), the only other connectionsare the wires from pins 2 and 6 to a 5V bench supply to power the board:
IMG_1112r.jpg
IMG_1112r.jpg (615.62 KiB) Viewed 885 times
One thing I forgot to say earlier - the first time I ran the example I got an error

Code: Select all

ImportError: No module named Adafruit_PureIO.smbus
so I installed it using

Code: Select all

 git clone https://github.com/adafruit/Adafruit_Python_PureIO.git
Thanks again for your help,

Ben.

User avatar
TheGribble
 
Posts: 8
Joined: Wed Aug 29, 2018 8:34 am

Re: LED Backpack not working on beaglebone black with debian

Post by TheGribble »

I've been playing with it and I seem to be reading registers successfully from the backpack using i2cget:

Code: Select all

$ i2cget -y 2 0x70 0
0x98
I've watched the traffic with a logic analyser and it all looks as it should, so I'm pretty sure the wiring is correct. When I run the sample I don't see anything on the analyser at all.

Cheers,

Ben.

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

Re: LED Backpack not working on beaglebone black with debian

Post by drewfustini »

It would be helpful if you could run strace so that I can better understand what is happening.

Install strace (if it doesn't already exist):

Code: Select all

sudo apt-get install strace
Then run strace, replace test.py with the name of your test program:

Code: Select all

strace -f -o strace.log python sevensegment_test.py
Paste the contents of strace.log into a GitHub Gist and post the link in a reply here.

User avatar
TheGribble
 
Posts: 8
Joined: Wed Aug 29, 2018 8:34 am

Re: LED Backpack not working on beaglebone black with debian

Post by TheGribble »


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

Re: LED Backpack not working on beaglebone black with debian

Post by drewfustini »

Thanks for the strace output.

This seems like the relevant lines:

Code: Select all

4414  open("/dev/i2c-1", O_RDWR|O_LARGEFILE) = 3
4414  fstat64(3, {st_mode=S_IFCHR|0660, st_rdev=makedev(89, 1), ...}) = 0
4414  ioctl(3, _IOC(0, 0x07, 0x03, 0x00), 0x70) = 0
4414  write(3, "!", 1)                  = -1 EBUSY (Device or resource busy)
Python is trying to access /dev/i2c-1

Please run strace with i2cdetect as I would like to verify it is using the name device path:

Code: Select all

strace -f -o strace.log python i2cdetect -r 2

User avatar
TheGribble
 
Posts: 8
Joined: Wed Aug 29, 2018 8:34 am

Re: LED Backpack not working on beaglebone black with debian

Post by TheGribble »

Gist from strace i2cdetect is here: https://gist.github.com/TheGribble/e45c ... 27f637fb1c

Cheers,

Ben.

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

Re: LED Backpack not working on beaglebone black with debian

Post by drewfustini »

Thanks. Looking at the strace output:

Code: Select all

3347 open("/dev/i2c-2", O_RDWR) = 3
It looks like i2cdetect has opened /dev/i2c-2.

However, Python was trying to access /dev/i2c-1.

Could you post the code for sevensegment_test.py?

I think there should be a place to change the I2C bus that is being used.

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

Re: LED Backpack not working on beaglebone black with debian

Post by drewfustini »

I see the code located at https://github.com/adafruit/Adafruit_Py ... nt_test.py

I think that this should be commented out:

Code: Select all

# Create display instance on default I2C address (0x70) and bus number.
display = SevenSegment.SevenSegment()
And this should be uncommented:

Code: Select all

# Alternatively, create a display with a specific I2C address and/or bus.
# display = SevenSegment.SevenSegment(address=0x74, busnum=1)
Then try changing busnum=1 to busnum=2

User avatar
TheGribble
 
Posts: 8
Joined: Wed Aug 29, 2018 8:34 am

Re: LED Backpack not working on beaglebone black with debian

Post by TheGribble »

Got it, thank you!

The magic combination was:

Code: Select all

display = SevenSegment.SevenSegment(address=0x70, busnum=2)
so I'm all up and running now.

I'm now a bit surprised by the demo though - has this always been broken on the Beaglebone or have I not followed the wiring instructions correctly?

Either way, thanks for all of your help!

Ben.

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

Re: LED Backpack not working on beaglebone black with debian

Post by drewfustini »

Good to hear.

There was a change in the past in how the i2c devices are enumerated.

I'll take a look at creating a pull request.

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

Re: LED Backpack not working on beaglebone black with debian

Post by drewfustini »

fyi - I have created this pull request:
Adafruit_Python_LED_Backpack #26

User avatar
TheGribble
 
Posts: 8
Joined: Wed Aug 29, 2018 8:34 am

Re: LED Backpack not working on beaglebone black with debian

Post by TheGribble »

Excellent, thanks for all your help!

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”