SPI between two beaglebone Black

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
BobUS
 
Posts: 3
Joined: Tue Jun 21, 2016 3:54 pm

SPI between two beaglebone Black

Post by BobUS »

Hello everybody,

I try to have a transfer data between two beaglebone using SPI.
Here is my (simple) program to write in Python:

Code: Select all

from bbio import *
import time

cs=0

SPI0.begin()

SPI0.setMaxFrequency(cs, 1000000)
SPI0.setBitsPerWord(cs, 8)
SPI0.setClockMode(cs, 1)
SPI0.setCSActiveLow(cs)
SPI0.setMSBFirst(cs)


try:
  while True:
    SPI0.write(0, [1])
    time.sleep(0.01)
except KeyboardInterrupt:
 SPI0.close()
and to read data:

Code: Select all

from bbio import *
import time

cs=0

SPI0.begin()

SPI0.setMaxFrequency(cs, 1000000)
SPI0.setBitsPerWord(cs, 8)
SPI0.setClockMode(cs, 1)
SPI0.setCSActiveLow(cs)
SPI0.setMSBFirst(cs)

# Read a single 8-bit word from the device:
data = SPI0.read(cs, 1)
print "word received: {:x}".format(data[0])

SPI0.close()
The problem is that I always receive FF (255) and the master seems to send no data.
I followed this schematics (above): Image

Have you any idea to solve my problem?

User avatar
drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: SPI between two beaglebone Black

Post by drewfustini »

It looks like you are using the PyBBIO library:
https://github.com/graycatlabs/PyBBIO

Have you tried raising an issue there?

User avatar
BobUS
 
Posts: 3
Joined: Tue Jun 21, 2016 3:54 pm

Re: SPI between two beaglebone Black

Post by BobUS »

In fact, I hoped that someone could help me here (even by using the Adafruit library). But I see that BBB is consider as a master and master cannot talk each other in SPI (I2C too).

User avatar
drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: SPI between two beaglebone Black

Post by drewfustini »

This current Google Summer of Code project for BeagleBoard.org may be of interest to you:

SPI slave driver implementation

Student: Patryk Mężydło
Code: https://github.com/pmezydlo/SPI_slave_d ... ementation
Wiki: https://github.com/pmezydlo/SPI_slave_d ... ation/wiki
SPI slave driver implementation. The task is to create a driver controlling SPI hardware controller in slave mode, and to ensure optimal performance through the use of DMA and interrupt. Creating an easy to implement realization of SPI slave would definitely help the BeagleBone community members to write applications based on SPI much more easily.

User avatar
BobUS
 
Posts: 3
Joined: Tue Jun 21, 2016 3:54 pm

Re: SPI between two beaglebone Black

Post by BobUS »

OK, thank you. I will see that.

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”