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:
-
uname -a
Linux beaglebone 4.9.59-ti-r74 #1 SMP PREEMPT Thu Nov 2 06:20:31 UTC 2017 armv7l GNU/Linux
-
cat /etc/dogtag
BeagleBoard.org Debian Image 2017-11-05
-
cat /etc/debian_version
9.2
-
cat /sys/devices/platform/bone_capemgr/slots
cat: /sys/devices/platform/bone_capemgr/slots: No such file or directory
-
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
-
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
- 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.
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
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
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
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
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)