How to execute >sudo sh -c "echo BB-SPIDEV0 > $SLOTS" from bash?

44 views
Skip to first unread message

Ram Kanhirotentavida

unread,
Aug 10, 2019, 4:30:38 AM8/10/19
to BeagleBoard
Hi,

I am setting up SPI0 for read and write from an ADC. To start I tried the loopback spidev_test found in chp08. This test is not working. When debugged found that the device overlay step is not running as expected.

Details:
.profile is set to run in bash shell with exporting SLOTS variable.

export SLOTS=/sys/devices/platform/bone_capemgr/slots

root@beaglebone:/lib/firmware# source ~/.profile
root@beaglebone:/lib/firmware# 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,cape-universaln
root@beaglebone:/lib/firmware#

Above shows the BB-SPIDEV0 is missing hence run the below step. It generates sh: echo: I/O error
>sudo sh -c "echo BB-SPIDEV0 > $SLOTS"

How can I set the SPIDEV0 overlay to use SPI0?

SPI loopback result shows 0's. Suppose to match the TX buffer.

root@beaglebone:~/exploringBB/chp08/spi/spidev_test# ./spidev_test
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
Debug message: Return value = 38

00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00

OS Details:
>uname -a
Linux beaglebone 4.1.15-ti-rt-r43 #1 SMP PREEMPT RT Thu Jan 21 20:13:58 UTC 2016 armv7l GNU/Linux

>cat /etc/dogtag
BeagleBoard.org Debian Image 2016-01-24

>cat /etc/debian_version
8.3


Appreciate if you can help to resolve the issue.

Thanks,
Ram

Ram Kanhirotentavida

unread,
Aug 10, 2019, 5:17:07 AM8/10/19
to BeagleBoard
Hi,

Please ignore my support request. I could resolve it by keeping the env variable after sudo su. 

Regards,
Ram

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/c1b19a5f-8ec5-44a9-8dbe-bc0e71f07d96%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages