Nerves on Raspberry Pi Zero 2 W does not boot

Shame to get hung up on the most basic of steps here but I am struggling to find the solution last few nights

Started off with

$ export MIX_TARGET=rpi0
$ mix deps.get
$ mix firmware
$ mix burn

Which all complete without error but the Pi does not boot up. That lead me to this thread

Where @fhunleth suggested rpi3a

But trying export MIX_TARGET=rpi3a results in same hang with the green LED goes off once then solid green

Then tried the rpi0_2 option also in the same reply

And that fails with a different LED output where it flashes once and then goes DED

I think that is a “card read error” but I do not think it can be that as I did manage to get the Pi to boot with Raspberry Pi OS and on two separate SD cards

So I am not sure if I am still burning wrong MIX_TARGET or missing some simple step or what

I also tried these but they just hung with solid green LED also

Any suggestions would be great


What have you tried after seeing the green LED? I think there might be some misconception here:

  • For this target, HDMI is disabled by default. You will most likely not get any output from there
  • These do not follow the LED patterns defined by Raspian OS. A solid green is the expected output on startup
  • You should be able to ping nerves.local or see that the device is connected over network if you are using the middle USB port of the rpi0 or USB A port of rpi3a

Can you take a look over Connecting to a Nerves target and try some of the suggestions there to see if maybe the device is actually working properly?

Or if needed, you can configure WiFi when burning the circuits quickstart image to an SD card. You could try that as well and see if the new device joins your network

1 Like

Dam thanks for quick reply.

So doing the circuits quickstart image just now

$ export NERVES_WIFI_SSID='FreshTomato24'
$ export NERVES_WIFI_PASSPHRASE='password'

$ sudo fwup circuits_quickstart_rpi3a.fw
Use 15.93 GB memory card found at /dev/sdb? [y/N] y
100% [====================================] 25.07 MB in / 27.76 MB out
Elapsed time: 3.902 s

popped it in the Pi and the green LED did exaclty this

  • Green for about a second
  • Off half a second say
  • Green for about seven seconds
  • Then just off permanently

So this probably is not expected to work

$ ping nerves.local
ping: nerves.local: Name or service not known

$ ssh nerves.local
ssh: Could not resolve hostname nerves.local: Name or service not known

It is not listed in the WiFi devices dashboard

Other notes I do not really have access to a USB to TTL cable for serial connection at the moment and it is definitely plugged into middle USB port and not “pwr in” one

Am I missing something glaringly obvious here?

Are you able to confirm that your USB cable supports data and power? It’s really common now to have power only USB cables (especially if from a cheap bin or off the shelf grab) - so much so that I invested in a USB tester just for this purpose.

Trying several different USB cables might be the next step. You can also enable the HDMI output temporarily if you have an adapter

Are you able to confirm that your USB cable supports data and power?
so much so that I invested in a USB tester just for this purpose.

Can not really confirm I guess… Though I definitely agree with the second part because I simply can not find a way to easily identify one from the other visually or by sense of smell

However, I have tried three separate cables ( pretty much all I could find around the house ) and one of which actually transfers images from an old android phone so I have to believe that one is at least data sensitive

In fact… I am basically only working through

And they recommend a ( seemingly ) data USB capable cable in the notes that I bought specifically to avoid lame ass problems like this

Because I just want to tool around with nerves and IoT.

I am even questioning whether or not I bought or received a Pi zero 2 W at this point but it looks like it is. It is printed on the board

You can also enable the HDMI output temporarily if you have an adapter

I did do this with rpi0 and it hung at the rainbow splash screen. Obviously the wrong MIX_TARGET

How would you recommend going about this HDMI output otherwise?

Still use the circuit quickstart image?

An update…

In config.txt I set


For both export MIX_TARGET=rpi3a and $ sudo fwup circuits_quickstart_rpi3a.fw

And both just keep rebooting over and over.

  • Splashes the rainbow image
  • Cursor in upper left corner
  • Repeat

Yea so no idea

There a debug mode?

What host OS are you using to build and burn firmware?

I just tried the rpi3a firmware from your original post and it successfully booted. Once running, the green LED turns completely off.

I also did not have success using export for the WiFi settings and sudo burn task. It needed to be within the same command and I needed to force the WiFi settings

NERVES_WIFI_SSID="test" NERVES_WIFI_PASSPHRASE="somepass" NERVES_WIFI_FORCE="true" fwup circuits_quickstart_rpi3a.fw

Trying that again with NERVES_WIFI_FORCE is worth a try. Depending on your host, you might need a driver installed to see a device over OTG.

Investing in a simple USB TTY serial cable is also very useful for these smaller devices. If you want the output on the HDMI, then you’ll need to enable it in erlinit.config instead of the UART pins

Not saying this is the case, but that could be a power supply issue.

How are you powering the board?

The “official” rpi zero-2 W PSUs are rated at 5V 2.5A.

I was having a similar problem with connecting to a raspberry pi with a Nerves project.

Raspberry Pi Zero 2 W
Windows 11 running WSL2
MIX_TARGET = rpi3a
Using the instructions from the “Build a Weather Station with Elixir and Nerves”

The main issue was that I was unable to ping or ssh to the device over USB. I tried multiple USB cables, confirmed I was using the gadget port (not the power only port), tried another firmware file (circuits_quickstart_rpi3a.fw) from GitHub - elixir-circuits/circuits_quickstart: Try out Elixir Circuits on Nerves!, all unsuccessfully.

I also tried several attempts at getting mDNS/zeroconf/Bonjour working on both WSL2 and Windows 11, which I thought might be part of the problem. I learned some things, but didn’t solve the problem.

One solution proposed here seemed promising, which was to set the NERVES_WIFI_SSID and _PASSWORD as env variables or pass them as arguments to fwup. However, due to how WSL2 works, with limited access to MicroSD cards, mix burn passes this off to fwup.exe on the Windows side, so the arguments and env vars are not honored, as far as I can tell.

My solution was to configure WiFi in advance, before creating the firmware file, by updating config/target.exs in the project. By adding my wireless ssid and psk to the wlan0 section, the RPi pulled an address through dhcp and I could ssh/ping it over WiFi.

This is basically the instructions from the book mentioned above and the VintagetNetDirect site (GitHub - nerves-networking/vintage_net_wifi: WiFi networking for VintageNet), doing it before you burn the firmware.

To be more explicit, assuming you have the “sensor_hub” project from the book all set up, edit the config/target.exs file ensuring it has a section that looks like this (there might be other interfaces in there, like usb0 and eth0, that’s fine:

config :vintage_net,
  config: [
        type: VintageNetWiFi,
        vintage_net_wifi: %{
          networks: [
              key_mgmt: :wpa_psk,
              ssid: "my_network_ssid",
              psk: "a_passphrase_or_psk",
        ipv4: %{method: :dhcp},

Then run mix firmware and mix burn as usual. Swap the SD card to the pi. In my case it has a steady green LED. I checked my router for devices pulling addresses and after a tense few moments, “nerves-8821” showed up on my network, and was able to ssh to the device.

I hope that helps someone else.