"Permission denied" on the file adafruit-nrfutil

I’m receiving the following message when I try to build and download a simple project (blinky) to an Adafruit nRF52840 Express board:

sh: /Users/chrisgr/.platformio/packages/framework-arduinoadafruitnrf52/tools/adafruit-nrfutil/macos/adafruit-nrfutil: Permission denied

The file “adafruit-nrfutil” in the .platformio directory does exist and is accessible because I’m able to open it with a text editor.

What is the problem?

Are you able to execute the binary in a shell without problems?

What are the permissions on the file? (ls -la /Users/chrisgr/.platformio/packages/framework-arduinoadafruitnrf52/tools/adafruit-nrfutil/macos/adafruit-nrfutil)

The permissions are -rw-r–r-- .

I’m not able to execute it because it’s not an executable file. However am able to open it in a text editor and see that it contains ascii hex.

I’m not sure why platformio is saying permission denied when it’s a text file and the permissions give read access.

Read but somehow not execute. x is missing.

Can you chmod +x /Users/chrisgr/.platformio/packages/framework-arduinoadafruitnrf52/tools/adafruit-nrfutil/macos/adafruit-nrfutil the file manually?

1 Like

I changed the permissions and it did build successfully this time, but did not upload successfully. This is the log:

Configuring upload protocol…
AVAILABLE: jlink, nrfjprog, nrfutil, stlink
CURRENT: upload_protocol = nrfutil
Looking for upload port…
Auto-detected: /dev/cu.usbmodemC19DBF8ED7C01
Forcing reset using 1200bps open/close on port /dev/cu.usbmodemC19DBF8ED7C01
Waiting for the new upload port…
Uploading .pio/build/adafruit_feather_nrf52840/firmware.zip
Upgrading target on /dev/cu.usbmodemC19DBF8ED7C01 with DFU package /Users/chrisgr/Documents/PlatformIO/Projects/feather/.pio/build/adafruit_feather_nrf52840/firmware.zip. Flow control is disabled, Single bank, Touch disabled

Timed out waiting for acknowledgement from device.
Failed to upgrade target. Error is: No data received on serial port. Not able to proceed.
Traceback (most recent call last):
File “nordicsemi/main.py”, line 294, in serial
File “nordicsemi/dfu/dfu.py”, line 235, in dfu_send_images
File “nordicsemi/dfu/dfu.py”, line 200, in _dfu_send_image
File “nordicsemi/dfu/dfu_transport_serial.py”, line 179, in send_start_dfu
File “nordicsemi/dfu/dfu_transport_serial.py”, line 243, in send_packet
File “nordicsemi/dfu/dfu_transport_serial.py”, line 282, in get_ack_nr
nordicsemi.exceptions.NordicSemiException: No data received on serial port. Not able to proceed.

Possible causes:

  • Selected Bootloader version does not match the one on Bluefruit device.
    Please upgrade the Bootloader or select correct version in Tools->Bootloader.
  • Baud rate must be 115200, Flow control must be off.
  • Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.

The board had been previously programed with J-LINK and the Nordic SDK. I tried to reflash the Arduino firmware using a hex file from the Adafruit site however it was not clear which was the version for this board. This may not the correct version.

Are you able to upload sketches using the Arduino IDE normally? That would rule out a PlatformIO issue and it would be more of a bootloader issue.

Also maybe nRF52840 Express Stuck on Upgrading target on... · Issue #224 · adafruit/Adafruit_nRF52_Arduino · GitHub is relevant, there seems to be a double-reset mechanism.

Also, the bootloader seems to be linked in the Adafruit Products page.

1 Like

It’s working now. I used nrfjprog to reflash the Feather.

I had mistakenly downloaded the hex file rom the Adafruit github page but had incorrectly reflashed using the J-LINK programming software (not nrfjprog). This seemed to work but apparently did not fully load the firmware. Now that I reflashed using nrfjprog the board is fully restored and I can program it with Platformio.

Thanks for the help.

1 Like

@chrisgr99
Can you please share your platformio.ini? I am trying to set up the toolchain for the bluefruit as well.

1 Like