i’m trying to use Circuits.SPI from the basic mix nerves.new
template. I can ssh in and then from the iex terminal I can open a SPI bus ({:ok, spi0} = Circuits.SPI.open("spidev0.0")
) . Then I can run a transfer: {:ok, resp} = Circuits.SPI.transfer(spi0, <<0xAA, 0xFF>>)
which returns {:ok, <<0, 0>>}
. So from a software perspective, everything seems like it’s working. But I can only get 0’s back, and when I look at the SPI pins with an oscilloscope I see no activity on any of them during when the transfers are supposed to happen.
I’ve noticed that if I check the status of the relevant GPIO, that pins that ought to be outputs are reported as inputs:
iex(15)> Circuits.GPIO.status("P9_22 [spi0_sclk]")
{:ok, %{pull_mode: :none, direction: :input, consumer: "P9_22"}}
Does that indicate something significant, and do I need to do something more to setup SPI? The last time I used nerves was several years ago and I remember stuff like this being very fluid - no extra setup required, so I’m suspicious that I’ve done something wrong…