Alright.
Doing some more research on the web turned up one page where the user is 
referencing the original Molloy book and complaining about $SLOTs in chapter 
six not being relevant but using a current OS which doesn't have $SLOTS.  The 
new edition of the book does not mention $SLOTS but instead config-pin for GPIO 
management.
 
The sad thing is that Derek Molloy's book, only in passing refers to enabling 
the SPI port, and the book, in trying to also deal with the pocket beagle pins 
leaves out things where repetition is actually beneficial.  Maybe somewhere it 
says that you have to use config-pin to set up SPI.  I missed it.  I think in 
Chapter 8 page 363 needs a bit of work.
 
So here's what I did following part of that web page suggestion on the Buster 
image:
debian@beaglebone:~/exploringBB/chp08/spi/spidev_test$ config-pin  p9.17 spi_cs
Current mode for P9_17 is:     spi_cs
debian@beaglebone:~/exploringBB/chp08/spi/spidev_test$ config-pin  p9.22 
spi_sclk
Current mode for P9_22 is:     spi_sclk 
debian@beaglebone:~/exploringBB/chp08/spi/spidev_test$ config-pin  p9.21 spi
Current mode for P9_21 is:     spi
debian@beaglebone:~/exploringBB/chp08/spi/spidev_test$ config-pin  p9.18 spi
Current mode for P9_18 is:     spi
 
I hadn't realized that this was needed if the spi device was opened as a fille. 
 I assumed opening a /dev/spi0.0 would automatically claim the pins for SPI.  
So with MOSI connected to MISO and specifying the SPI0 port since SPI1 is used 
by HDMI I get:
 
debian@beaglebone:~/exploringBB/chp08/spi/spidev_test$ ./spidev_test -D 
/dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
 
FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD
F0 0D
 
And that data matches what the scope tells me in the attached photo.  Clock is 
yellow trace. MOSI is Blue.  Green is CS.
 
Oh and none of this explains why the ioctl regardless of C or Pascal can't 
handle more than 4096 data bytes while the Python code can when sending a large 
bitmap to the SPI port.  Nor why, according to this web site
https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/spi
nothing is said about config-pin operations so the python library must do this 
automatically?
 
Now to try this on the Stretch OS based Beagle.
John
 
From: [email protected] [mailto:[email protected]] On 
Behalf Of John Dammeyer
Sent: May-20-21 5:43 PM
To: [email protected]
Subject: RE: [beagleboard] ioctl messages to Beagle SPI port.
 
The latest version of Buster does this when I look for SPI bus ports.  The 
older Stretch version doesn't have the 0.0 and 0.1 and everything is scaled up 
by 1.  
 
On either system the scope doesn't show any activity on the SPI0 pins.  No CS, 
no CLK no Data Out.
 
The test program from Exploring Beaglebone with the DI connected to the DO does 
not behave with the table changed from the output stream to input which makes 
sense since there isn't any output on the MOSI or MISO pins.
 
Any suggestions on how to get SPI working?
 
debian@beaglebone:~$ uname -a
Linux beaglebone 4.19.94-ti-r63 #1buster SMP PREEMPT Fri May 14 16:42:32 UTC 
2021 armv7l GNU/Linux
 
debian@beaglebone:~$ ls -l /dev/spi*
crw-rw---- 1 root spi 153, 0 May 20 17:24 /dev/spidev0.0
crw-rw---- 1 root spi 153, 1 May 20 17:24 /dev/spidev0.1
crw-rw---- 1 root spi 153, 2 May 20 17:24 /dev/spidev1.0
crw-rw---- 1 root spi 153, 3 May 20 17:24 /dev/spidev1.1
debian@beaglebone:~$
 
 
debian@ebb:~$ uname -a
Linux ebb 4.14.108-ti-r136 #1stretch SMP PREEMPT Mon Jun 8 15:38:30 UTC 2020 
armv7l GNU/Linux
 
debian@ebb:~$ ls -l /dev/spi*
crw-rw---- 1 root spi  153, 0 May 20 16:45 /dev/spidev1.0
crw-rw---- 1 root spi  153, 1 May 20 16:45 /dev/spidev1.1
crw-rw---- 1 root spi  153, 2 May 20 16:45 /dev/spidev2.0
crw-rw---- 1 root spi  153, 3 May 20 16:45 /dev/spidev2.1
 
/dev/spi:
total 0
lrwxrwxrwx 1 root root 12 May 20 16:45 0.0 -> ../spidev1.0
lrwxrwxrwx 1 root root 12 May 20 16:45 0.1 -> ../spidev1.1
lrwxrwxrwx 1 root root 12 May 20 16:45 1.0 -> ../spidev2.0
lrwxrwxrwx 1 root root 12 May 20 16:45 1.1 -> ../spidev2.1
debian@ebb:~$
 
==================================================================================================
 
debian@beaglebone:~/exploringBB/chp08/spi/spidev_test$ ./spidev_test -D 
/dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
 
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
debian@beaglebone:~/exploringBB/chp08/spi/spidev_test$
-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/034801d74dda%2435a8c060%24a0fa4120%24%40autoartisans.com
 
<https://groups.google.com/d/msgid/beagleboard/034801d74dda%2435a8c060%24a0fa4120%24%40autoartisans.com?utm_medium=email&utm_source=footer>
 .

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/035b01d74de7%24af878f80%240e96ae80%24%40autoartisans.com.

Reply via email to