Cross posting from seeed forums, no responses there.

If anyone has had any success whatsoever using spi0 on a beagle bone green 
wireless, would love to hear about it.


tldr: clocking in data on spi0 looks cattywompus, spi1 ok


Was noticing an issue with some custom hardware/software that utilizes both 
spi channels, was working on beaglebone black prior.  Wanted to make it 
easily reproducible so flashed a bbgw and used adafruit bbio library as an 
example. 

steps:

1.) flash BBGW with latest production image 4.4.15-ti-r37 (tested on 4.1 
kernel, and some other images that I forgot to document as well)

2.) prevent sound drivers from loading, as they conflict with spi1:

      cd /lib/modules/4.4.15-ti-r37/kernel/sound/core
      mv snd.ko snd.ko.bkp

3.) install adafruit library from source (need latest greatest, pip upgrade 
didn't work)

      cd ~
      git clone 
https://github.com/adafruit/adafruit-beaglebone-io-python.git
      cd adafruit-beaglebone-io-python
      python setup.py install
      cd ..

4.) use wires to loopback MOSI to MISO, both channels

      short P9.18 and P9.21 with a piece of wire (SPI0)

      short P9.29 and P9.30 with a piece of wire (SPI1)

5.) put the following into a file and run it

from Adafruit_BBIO.SPI import SPI
def run(x,y):

  print 'running spi {} {}'.format(x,y)
  spi = SPI(x,y)
  spi.mode=2
  spi.msh=4000000
  bytes2send = range(20)
  print 'sending {}'.format(bytes2send)
  print spi.xfer2(bytes2send)
  spi.close()

run(0,0)
run(1,0)

result:
sending [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 
19]
[128, 7, 28, 31, 112, 231, 124, 127, 192, 135, 156, 159, 240, 231, 252, 
255, 0, 7, 28, 31]
running spi 1 0
sending [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 
19]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]

so, spi1 works in loopback.  spi0...wtf? there are places where it looks 
like it's double clocking MISO (like a 0x00000001 becomes a 0x00000011), 
some of it just looks random. Works fine on beaglebone black.

Thoughts?

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/c34759e0-e2c3-4c99-a3c3-8160b89a4ff9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to