In order to get started with using SPI on the Edison, I have wired up one of Adafruit's OLED boards (Monochrome 128x32 SPI OLED graphic display ID: 661 - $17.50 : Adafruit Industries, Unique & fun DIY electronics and kits) to my edison on the Intel Arduino breakout board.
I am using the linux 64 bit weekly 68 SDK (http://downloadmirror.intel.com/24271/eng/edison-sdk-linux64-weekly-68.zip)
I am using http://downloadmirror.intel.com/24271/eng/arduino-linux64-1.0.3.tgz for my IDE.
I have attached a log of my boot sequence output; it shows what versions of the kernel, etc I am using. I am just using the Yocto image from http://downloadmirror.intel.com/24271/eng/edison-image-ww36-14.zip.
I started with Adafruit's arduino sample code for the oled (adafruit/Adafruit_SSD1306 · GitHub) and Adafruit_SSD1306/ssd1306_128x32_spi.ino at master · adafruit/Adafruit_SSD1306 · GitHub.
Depending on which Adafruit_SSD1306 constructor is used, one can choose from software SPI (where CLK and MOSI are twiddled as GPIOs) or hardware SPI (where the Arduino SPI object is used).
When I use the software SPI constructor, all is good. Basically, this version just uses pins 13 (clk), 11 (mosi), 10 (slave select), plus a couple of oled-specific lines as gpios.
When I use the hardware SPI constructor, I have no success.
In the process of debugging my problem I have determined that the current version of arduino-1.5.3-Intel.1.0.3//hardware/arduino/edison/variants/edison_fab_c/variants.cpp has problems in the mux structures with respect to SPI.
First of all, MuxDesc13's entry for the SPI MODE gpio is:
{ 109, PIN_MODE_1, FN_GPIO }, // SPI mode |
instead of
{ 109, PIN_MODE_1, FN_SPI }, // SPI mode |
Next, g_APinDescription[] does not contain any entries for the GPIOs (109, 114, 115) referenced in MuxDesc11, MuxDesc12, and MuxDesc13.
I fixed these issues in my local version of variant.cpp, and that still did not get hardware SPI working.
I am watching pins 13, 11, and 10 (with LEDs) to see if they ever go high when I run my oled sketch mentioned above, and I see that the clk (13) does go high, the slave select seems to be working, but that's just a plain old gpio, and most importantly, pin 11 (mosi) never goes high, indicating no data is being sent over the wire.
By the way, with the same hardware configuration, if I switch to "software spi" and just use pins 13 and 11 as gpio pins, I see these pins go high as expected.
So my question is, has anybody gotten hardware spi working on the Edison using the Arduino breakout board?
If so, how?
Clik here to view.