6 Replies Latest reply on Jul 14, 2018 11:05 PM by mrkcass

    Unable to Access SPI on Edison SOC+Custom Board When Connected to Arduino Breakout Board / How to Disconnect Arduino Breakout board SPI

    D.Sync

      This may sound arkward, but I'm currently trying to connect Edison with a custom made board that uses SPI interface to connect with an ADC, and then connect these together with Arduino Breakout board. The plan is to use the SPI that connect directly with the SOC (not the SHIELD PIN), and use the Arduino breakout board to control shield-pin-compatible i2c sensor. Using mraa, it always failed to initiate any SPI transfer with my custom board, e.g. reading and writing always result in 0x00. The surprising thing is I'm able to get the SPI interface working when connecting Edison with just the custom board. So I suspect that mraa multiplex the pins using Arduino breakout pins and route the SPI pins to the SHIELD pin instead.

       

      By default, mraa will automatically mux the pin according to the carrier board that it is currently connected to, e.g. Mini breakout board or Arduino board. I've even modify the mraa so that it always multiplex using mini breakout board pinouts, but to no avail. SPI transfer still return 0x00 whenever I connect these boards with Arduino Breakout board. I've even remove the sketch and disable clloader service to prevent any pin muxing done by Edison using Arduino breakout board pinouts.

       

      Not sure whether there could be any solution to this.

       

      ---

      In other words,

      Is it possible to bypass the Edison Compute Module to connect its SPI pinout to my custom board SPI instead of the SPI pins on the Arduino breakout board shield pins. I've tried to revert all shield pins to non-SPI function but to no avail as well.

       

      ```

      echo 111 > /sys/class/gpio/export

      echo 115 > /sys/class/gpio/export

      echo 114 > /sys/class/gpio/export

      echo 109 > /sys/class/gpio/export

      echo 263 > /sys/class/gpio/export

      echo 240 > /sys/class/gpio/export

      echo 262 > /sys/class/gpio/export

      echo 241 > /sys/class/gpio/export

      echo 242 > /sys/class/gpio/export

      echo 243 > /sys/class/gpio/export

      echo 258 > /sys/class/gpio/export

      echo 259 > /sys/class/gpio/export

      echo 260 > /sys/class/gpio/export

      echo 261 > /sys/class/gpio/export

      echo 226 > /sys/class/gpio/export

      echo 227 > /sys/class/gpio/export

      echo 228 > /sys/class/gpio/export

      echo 229 > /sys/class/gpio/export

      echo 214 > /sys/class/gpio/export

      echo low > /sys/class/gpio/gpio214/direction

       

      echo low > /sys/class/gpio/gpio263/direction

      echo low > /sys/class/gpio/gpio240/direction

      echo low > /sys/class/gpio/gpio262/direction

      echo low > /sys/class/gpio/gpio241/direction

      echo low > /sys/class/gpio/gpio242/direction

      echo low > /sys/class/gpio/gpio243/direction

       

      echo low > /sys/class/gpio/gpio258/direction

      echo low > /sys/class/gpio/gpio259/direction

      echo low > /sys/class/gpio/gpio260/direction

      echo low > /sys/class/gpio/gpio261/direction

       

      echo out > /sys/class/gpio/gpio226/direction

      echo out > /sys/class/gpio/gpio227/direction

      echo out > /sys/class/gpio/gpio228/direction

      echo out > /sys/class/gpio/gpio229/direction

       

      echo mode0 > /sys/kernel/debug/gpio_debug/gpio111/current_pinmux

      echo mode0 > /sys/kernel/debug/gpio_debug/gpio115/current_pinmux

      echo mode0 > /sys/kernel/debug/gpio_debug/gpio114/current_pinmux

      echo mode0 > /sys/kernel/debug/gpio_debug/gpio109/current_pinmux

       

      echo mode0 > /sys/kernel/debug/gpio_debug/gpio41/current_pinmux

      echo mode0 > /sys/kernel/debug/gpio_debug/gpio43/current_pinmux

      echo mode0 > /sys/kernel/debug/gpio_debug/gpio42/current_pinmux

      echo mode0 > /sys/kernel/debug/gpio_debug/gpio40/current_pinmux

      echo high > /sys/class/gpio/gpio214/direction

      ```