Beaglebone black SPI0 transfer issue

180 views
Skip to first unread message

kaar.ku...@gmail.com

unread,
Jan 17, 2018, 10:27:43 AM1/17/18
to BeagleBoard

I am working with a beaglebone black and I want to transfer data to my potentiometer (AD 8403). BBB is the master and pot is the slave.

My beaglebone settings:

1) uname -a
Linux beaglebone 4.9.59-ti-r74 #1 SMP PREEMPT Thu Nov 2 06:20:31 UTC 2017 armv7l GNU/Linux

2) cat /etc/dogtag
BeagleBoard.org Debian Image 2017-11-05

3) cat /etc/debian_version
9.2

4) cat /sys/devices/platform/bone_capemgr/slots
cat: /sys/devices/platform/bone_capemgr/slots: No such file or directory

5) ls -al /dev/spi*
crw-rw---- 1 root spi 153, 1 Nov  3  2016 /dev/spidev1.0
crw-rw---- 1 root spi 153, 0 Nov  3  2016 /dev/spidev1.1
crw-rw---- 1 root spi 153, 3 Nov  3  2016 /dev/spidev2.0
crw-rw---- 1 root spi 153, 2 Nov  3  2016 /dev/spidev2.1

6) Pins are configured through config pin

config-pin P9_17 spi_cs
config-pin P9_18 spi  
config-pin P9_21 spi
config-pin P9_22 spi_sclk

7) cat /etc/default/capemgr
# Default settings for capemgr. This file is sourced by /bin/sh from
# /etc/init.d/capemgr.sh

# Options to pass to capemgr
CAPE=BB-SPIDEV0


Loopback test is working fine but when I try to transfer any data to my pot, I am receiving [255] as the result. How to solve this issue?
Loopback test example:

spi = SPI(0, 0)
print spi.xfer2([0, 0])
[0, 0]
spi.close()

When connected to pot:


spi = SPI(0, 0)
print spi.xfer2([0, 0])
[255, 255]  --> This is where the issue is.
spi.close()



Thanks in advance.

-Regards,
Kaarkuzhali Murugan.

Kaarkuzhali Murugan

unread,
Feb 1, 2018, 12:02:47 AM2/1/18
to BeagleBoard
Beaglebone black setings:

 sudo /opt/scripts/tools/version.sh

git:/opt/scripts/:[a5d5f437baeaa7f8e14d5ae037268abf7a67e88e]
eeprom:[A335BNLT00C00415BBBK046D]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2017-11-05]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2017.09-00002-g0f3f1c7907]
kernel:[4.9.59-ti-r74]

uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-SPI0-01-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg:[bb-cape-overlays]:[4.4.20171101.0-0rcnee1~stretch+20171101]
pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee1~stretch+20170829]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830]

-Regards,
Kaarkuzhali Murugan

pierric...@gadz.org

unread,
Feb 7, 2018, 4:09:31 PM2/7/18
to BeagleBoard
I maybe of the track, but the AD 8403 seems to be a 3 wire SPI, then I do not understand why your setting up 4 pins on the BBB

Thanks

Pierrick

Kaarkuzhali Murugan

unread,
Feb 8, 2018, 8:48:48 AM2/8/18
to BeagleBoard
Hi,

AD8403 has a SDO pin (Pin 13).
And my issue is in transferring the data to the pot. I meant to say, whatever value I pass to the pot, resistance is not changing. But when I use an arduino board, resistance is changing.


Regards,
Kaarkuzhali Murugan

pierric...@gadz.org

unread,
Feb 8, 2018, 3:28:53 PM2/8/18
to BeagleBoard
Hi,

OK, I missed it when reading the pot's documentation, my bad.
Could you tell me what is the code for the SPI(x,y) function/library you are using on the BeagleBone ? I used SPI between PRUs and an accelerometer once, and I encourtered a similar problem, which finally came form the SPI phases. However I never used it directly from the ARM.
Thanks

Pierrick

Kaarkuzhali Murugan

unread,
Feb 9, 2018, 12:45:14 AM2/9/18
to BeagleBoard
Hi,

I am using the adafruit's BBIO library.
Sample code:

from Adafruit_BBIO.SPI import SPI
from time import sleep

spi = SPI(0, 0)
for i in range(255):
     print i, spi.xfer2([i, 0])
     sleep(5)
Reply all
Reply to author
Forward
0 new messages