tobin

tobin

I’m working on an Elixir application that I’m deploying to a Raspberry Pi Model B using Nerves and nerves_system_rpi3.

I’m communicating with devices using Circuits.SPI and the standard /dev/spidev0.0 and /dev/spidev/0.1 channels. Now I’d like to talk to more devices, and use the second SPI interface to do so (info about SPI devices).

To do this, I am led to believe that I need to add the following line to /boot/config.txt:

dtoverlay=spi1-3cs

I have therefore followed the instructions for overwriting files in the boot partition. I copied fwup.conf and config.txt to my '/configdirectory and edited them andconfig.exs` to point to one another.

However, when I deploy to my RPi, the devices do not show up:

iex> Toolshed.cmd "ls /dev/spi*"
/dev/spidev0.1
/dev/spidev0.0

I was hoping for a /dev/spidev1.0! My change is definitely there:

iex> Toolshed.cmd "grep spi /boot/config.txt"
dtparam=spi=on
dtoverlay=spi1-3cs

Help! How do I troubleshoot this? is there something I’m missing? I would appreciate any pointers I can get!

Showing Posts 1 to 4

jsimmonds2

jsimmonds2

Hi @tobin

If you add dtdebug=on to config.txt the early boot that happens in the VideoCore 4 GPU will be logged.
To see the log after Linux is booted, use vcdbg log msg.

Also see this “freshman” question thread in this forum.

(caveat, I’ve not (yet) used any SPI devices)

[edit]
I just now tried this on my Rpi3B+ with latest Nerves etc. and got the log ::
Failed to load overlay 'spi1-3cs'
brfs: File read: /mfs/sd/overlays/spi1-3cs.dtb
and sure enough, /boot/overlays does not contain any spi1*.dt?
Drop the right .dtbo in there and things might work :slight_smile:

[edit++]
To "drop the right .dtbo . . " you need to edit fwup.conf to make sure the spi1-3cs.dtbo file is copied in all the correct places.

tobin

tobin OP

Fantastic! Thank you so much for that great answer.

I downloaded spi1-3cs.dtbo from the raspberrypi/firmware github and then added these lines to my fwup.conf:

file-resource spi1-3cs.dtbo {                                                                                                                 
    host-path = "${NERVES_APP}/config/spi1-3cs.dtbo"                                                                                          
}
...
on-resource spi1-3cs.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/spi1-3cs.dtbo") }  

… a quick mix firmware, and I’ve now got three more SPI channels to play with!

tobin

tobin OP

Addendum: There are a couple more lines of on-resource spi1-3cs.dtbo {...} I needed to add to my fwup.conf (I just copied what was there). Notably I had the BOOT_B_PART_OFFSET line but not the corresponding A line, which meant it only worked once every two times I deployed the firmware!

jsimmonds2

jsimmonds2

@tobin, Hey, good work !
Think you didn’t need to fetch that spi1-3cs.dtbo file . . that and many other overlays are already present in the nerves_system_rpi3 artifacts cached in your ~/.nerves folder.
Just change that file resource path to be like existing ones above coming from images/rpi-firmware/overlays/

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
bradley
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New
dillonoconnor
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews