Rehan

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:

  1. What is the correct mapping between /dev/spidev0.0 and BeagleBone header pins when using Nerves?
  2. 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?
  3. Is there a recommended way to enable or switch pinmux for SPI pins under Nerves since config-pin is 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.

Where Next?

Popular in Questions Top

Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
ycv005
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
gazoon
I want to know absolute current module path. In python i could do that: os.path.abspath(__file__) Does elixir have anything similar?
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
alice
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
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New

Other popular topics Top

belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement