Rehan
SPI not working on beaglebone
Hi all,
I’m running Nerves on a BeagleBone Black and trying to use SPI from Circuits.SPI.
I can see the devices in /dev:
/dev/spidev0.0
/dev/spidev0.1
/dev/spidev1.0
/dev/spidev1.1
But I’m having trouble confirming which header pins (P9/P8) are actually mapped to these devices under Nerves.
Questions:
- What is the correct mapping between
/dev/spidev0.0and BeagleBone header pins when using Nerves? - How can I verify from the Nerves IEx console (using only
File.read!,/proc/device-tree, or/sys/devices) that a given pin is really configured for SPI mode? - Is there a recommended way to enable or switch pinmux for SPI pins under Nerves since
config-pinis not available?
So far, I’ve opened SPI in IEx like this:
iex(1)> {:ok, ref}=Circuits.SPI.open("spidev0.0", speed_hz: 1_000_000, mode: 3)
{:ok, #Reference<0.2697461337.148504581.45500>}
iex(2)> Circuits.SPI.transfer(ref, <<0x80, 0x00>>)
{:ok, <<0, 0>>}
I’m not getting any response from the SPI slave. I’m using ADXL345 sensor expecting 0xE5 for above read operation
Example wiring to ADXL345 (3.3V SPI sensor)
- P9_17 (CS0)** → **ADXL345 CS
- P9_22 (SCLK)** → **ADXL345 SCL
- P9_18 (MOSI)** → **ADXL345 SDA (data in)
- P9_21 (MISO)** → **ADXL345 SDO (data out)
Am I Connecting to correct pins? Or pin mapping is different for spidev0.0
Thanks in advance.
Popular in Questions
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Hi all,
I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I'm trying to use Postg...
New
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
Other popular topics
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
I have followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New







