12 Replies Latest reply on Dec 17, 2014 1:01 PM by KurtE

    Intel Edison Arduino Breakout SPI


      Is there any example for the Arduino IDE on how to properly use the SPI functionality with this breakout board?
      I'm a little confused on how to do this.

        • 1. Re: Intel Edison Arduino Breakout SPI

          Hi Aaru;


          Have you already checked the examples in the IDE?  Take a look at the Shield Tests Report you could find some examples, codes, shields and results.

          Also, take a look at the schematic and the hardware guide of the Edison Breakout Board.

          Let me know if this helps or if you already have tried this.




          • 2. Re: Intel Edison Arduino Breakout SPI

            I did take a look at that, I was sort of confused about the swizzler pins.. Out of the box do I need to change anything to use the SPI functionality?

            • 3. Re: Intel Edison Arduino Breakout SPI

              Works for me.  I have done some stuff with the Adafruit 2.8" tft display which uses SPI.  I have done it using the IO pins 11-13 (actually 10 as well for CS ...)



              • 4. Re: Intel Edison Arduino Breakout SPI

                Swizzler are only for PWM and are only to be used if you have an issue with the physical location of the PWM pins. SPI should work out of the box.

                • 5. Re: Intel Edison Arduino Breakout SPI

                  The problem is not resolved. I use the same code on my Arduino Uno, same pins and everything works like a charm. However, once i run the code on the edison, it just doesnt work.

                  • 6. Re: Intel Edison Arduino Breakout SPI

                    Need more info, like what display, what code base, what does not work...

                    • 7. Re: Intel Edison Arduino Breakout SPI

                      Its an ADC. Specifically the PmodAD5 from digilent. I'm using their supplied arduino drivers from here:


                      There is code on that page for arduino. I have run it successfully on my UNO. The code initializes the registers on the adc. The problem is that it fails initialization on the edison for some reason.

                      • 8. Re: Intel Edison Arduino Breakout SPI

                        Out of curiosity I took a quick look through.  From what I saw, the main file, works through a secondary file (communication.c (.h)) for a few functions (SPI_Init, SPI_Read, SPI_Write), which look like they are hardware dependent on the Arduino.  That is they are talking directly to the hardware registers, instead of using something like the SPI library. It probably would not be too hard to convert the file to use the spi library.   Alternatively someone could try to do some similar c++ hacks like Paul of PJRC did for the Teensy and setup c++ classes with operator overloads and the like such that doing stuff to the SPI registers is converted into appropriate calls to SPI...



                        • 9. Re: Intel Edison Arduino Breakout SPI

                          I made a mistake and sent you the wrong link. Someone already made the drivers to run purely on the SPI arduino library (link)

                          and it works on the UNO. ADConverter


                          So not sure why it does not want to function properly.

                          • 10. Re: Intel Edison Arduino Breakout SPI

                            Yes, that makes a little more sense.


                            Sorry I don't have the time to dig here.  But I am wondering some about how that sketch handles the MOSI pin as well as the CS pin.


                            It might not be necessary, but In the case of the CS pin, I would probably add a pinMode(SS, OUTPUT);  probably in the init() function.


                            As for MOSI pin - It uses that define in:

                            #define AD7193_RDY_STATE  MOSI //define pin MOSI( MISO is automaticaly defined)

                            It then has function that is checking for this state to go low...

                            void AD7193_WaitRdyGoLow(void)




                            But the MOSI pin will be in a different MUX mode so I don't think that will work. 


                            I am not sure if it is trying to stretch out the time?  Not sure...  Might comment comment it out and see if it helps...   Or may have to see if other method to see when device is ready, having to switch pin mode do read, switch pin mode back...

                            1 of 1 people found this helpful
                            • 11. Re: Intel Edison Arduino Breakout SPI

                              Awesome! That was it. adding "pinMode(SS, OUTPUT); " after initializing the SPI library got it going! Ugh so happy now.

                              Out of intellectual curiosity. Why did I need to do that?

                              • 12. Re: Intel Edison Arduino Breakout SPI

                                Because by default IO pins default to be input pins. Maybe the Arduino did this as a side effect in their SPI library.  I just usually make sure by setting pins to the state I want and not rely on hopefully something else did so...


                                Glad it is now working for you