Its been a while, but I think I should post my solution to my problem (3 posts up):
You not only have to set the clock as Input, but also deactivate Pullup/-down
I am new to the Beaglebone Black, and am not having any luck with getting SPI working.
I have used SPI before, so I understand how it should work, but the existing documentation for getting it working with device tree on BBB is not working for me.
(When I use a jumper between input and output and run spidev_test I see all 00s instead of desired pattern.)
Is there a single, step by step description somewhere that is based on a current software image that can be downloaded?
I.E. I am looking for something I can download a new image to flash to my BBB, and follow step by step directions to get SPI0 and SPI1 working for read and writes.
Thanks,
-Arlen
Hi Arlen,
The coverage for setup up a device overlay tree here is pretty good:
http://learn.adafruit.com/introduction-to-the-beaglebone-black-device-tree/overview
With that and glancing at some other samples, we were able to get
writing to work. We did not get reading working in time for our
deadline, and resorted to bitbanging from userspace code. I have not
had a chance to try Rafael's advice (clock as input, deactivate pull
up / pull down).
Cheers,
Andrew
Just for clearence: Deactivate Pullup/-down is only needed at clock.
I got spidev working on my BBB, I can do simultaneous reads and writes via c.
For testing, I would like to use one BBB to be a test data source via SPI, with another consuming this data stream.
Currently, I am unable to do this as with my configuration the BBB is always providing clock, never consuming it.
This seem strange to me, since it is configured as an input. To check that the clock pin is actually being driven I placed a 10k resistor to ground on the clock line, and did a series of reads from the SPI device.
The clock line was driven.
Is there a way to configure the BBB SPI to behave as a slave, where it expects to be receiving a clock from an external device?
Thanks,
-Arlen
Rafael, Would you mind posting you DTS file??? I have been trying to make the SPI clocl work, but I haven’t had any luck!
Thank you,
Laura
Have you had any luck getting the spi0 clock working on the BBB (rev A6) using Ubuntu (3.8.13-bone30) ? I’ve done all the following
- Added “capemgr.enable_partno=BB-SPIDEV0” to uEnv.txt in boot/uboot . This is the right uEnv.txt file as its in the FAT boot portion.
- checking with “cat /sys/devices/bone_capemgr.9/slots” I see the SPIDEV override
- checking “ls -al /dev/spi*” I get the expected “/dev/spidev1.0 and /dev/spidev1.0” files
- I added Adafruit_BB library and the CS pin (P9_17) can be toggled from here
- Shorting pins 21 and 18 I can see data transfer so internally the spi clock works as expected.
However connected SPI_CLK(P9_22) to a logic analyzer I see no clock signal! I am certain the logic analyzer is ok since with hdmi enabled I can see clock signals on pins 25 and 31. I don’t know why I am not getting a clock signal for SPI0. I just get the clock ‘low’. The same thing happens when I disable hdmi and enable spidev1 instead; I get no clock signal on SPI1 clock (pin 31).
Any suggestions on what I may be missing?
Hello Sam,
We never did get SPI working though the device file in Angstrom and ended up just bitbanging the same pins as GPIO. Our bitbanged clock signal is wack, but the spi slave we’re reading from doesn’t seem to mind. Unless someone has submitted some changes to the spi driver in between what I was using and the most recent kernel, I’d recommend you just try bitbanging.
You might try changing the direction of the clock pin to be the opposite of what it should; I think we were at least able to get a clock out, but couldn’t read the data correctly.
I recently spent some time trying out bare metal, but I didn’t even manage to get an LED to blink with TI starterware (BBB is not officially supported yet).
Just today I was able to boot into the most recent ubuntu 12.04 image from armhf; I had some stupid hardware problems where the hdmi plug was too big and I could either connect to a monitor or a keyboard but not both I will probably not want to mess with the BBB we’re bitbanging SPI on again, but if I do, I’ll let you know.
Cheers,
Andrew