Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dfu_version unexpected in manifest for pca10059? #4089

Open
aeijdenberg opened this issue Jan 17, 2024 · 5 comments
Open

dfu_version unexpected in manifest for pca10059? #4089

aeijdenberg opened this issue Jan 17, 2024 · 5 comments
Labels
nRF Nordic Semi

Comments

@aeijdenberg
Copy link

Hi, I've been trying to get the example flashing light working with tinygo and the nRF52840 USB Dongle.

When I run tinygo flash -target=pca10059 ./main.go I get the following output:

Traceback (most recent call last):
  File "nordicsemi/__main__.py", line 1555, in <module>
  File "click/core.py", line 1137, in __call__
  File "click/core.py", line 1062, in main
  File "click/core.py", line 1668, in invoke
  File "click/core.py", line 1668, in invoke
  File "click/core.py", line 1404, in invoke
  File "click/core.py", line 763, in invoke
  File "nordicsemi/__main__.py", line 1032, in usb_serial
  File "nordicsemi/__main__.py", line 982, in do_serial
  File "nordicsemi/dfu/dfu.py", line 69, in __init__
  File "nordicsemi/dfu/package.py", line 671, in unpack_package
  File "nordicsemi/dfu/manifest.py", line 200, in from_json
TypeError: Manifest.__init__() got an unexpected keyword argument 'dfu_version'
[85994] Failed to execute script '__main__' due to unhandled exception!

I'm running this version of nrfutil downloaded from https://www.nordicsemi.com/Products/Development-tools/nrf-util:

% nrfutil --version                   
nrfutil 7.6.0 (92ce3a0 2023-08-15)
commit-hash: 92ce3a0c1cc7e203326d85919d826009510dc631
commit-date: 2023-08-15
host: aarch64-apple-darwin
build-timestamp: 2023-08-23T08:22:36.822784Z
classification: nrf-external

and have installed the nrf5sdk-tools package:

% nrfutil list    
Command        Version  Description
nrf5sdk-tools  1.0.1    nRF5 SDK tools that were available in nRF Util 6
   dfu                  
   keys                 
   pkg                  
   settings             
   zigbee               

Found 1 installed command(s)

I noticed the manifest.json inside of the package ZIP file generated by Go includes the following content:

{
    "manifest": {
        "application": {
            "bin_file": "application.bin",
            "dat_file": "application.dat",
            "init_packet_data": {
                "application_version": 4294967295,
                "device_revision": 65535,
                "device_type": 82,
                "firmware_crc16": 10853,
                "softdevice_req": [
                    65534
                ]
            }
        },
        "dfu_version": 0.5
    }
}

whereas if I generate the package ZIP with the command that replaces, i.e. nrfutil pkg generate --hw-version 52 --sd-req 0x0 --application application.bin --application-version 1 package.zip then it generates much simpler manifest.json:

{
    "manifest": {
        "application": {
            "bin_file": "application.bin",
            "dat_file": "application.dat"
        }
    }
}

Note this does not include the dfu_version attribute that nrfutil complained about.

That ZIP then works and I've managed to flash my device for the first time!

It's my first time working in this space, happy to help try to fix this with a PR, but wanted to open the issue first in case I'm advertently using incorrect tooling.

The code that generates the manifest.json looks to be here

type jsonManifest struct {
Manifest struct {
Application struct {
BinaryFile string `json:"bin_file"`
DataFile string `json:"dat_file"`
InitPacketData nrfInitPacket `json:"init_packet_data"`
} `json:"application"`
DFUVersion float64 `json:"dfu_version"` // yes, this is a JSON number, not a string
} `json:"manifest"`
}

CC @deadprogram @aykevl who I think made the last change in this space?

@aeijdenberg
Copy link
Author

I reverted 6435f62 and built from source and verified that does resolve the issue in my environment.

@deadprogram
Copy link
Member

Hello @aeijdenberg just checking to see if this is still an issue for you?

@deadprogram deadprogram added the nRF Nordic Semi label Jan 13, 2025
@rednerd
Copy link

rednerd commented Jan 17, 2025

I'm encountering this problem with Tinygo 0.35 both using the .deb release and when built from source. My device is a PCA10059 with the Open DFU bootloader.

When I look at the source for https://github.com/tinygo-org/tinygo/blob/release/builder/nrfutil.go it seems to be generating maninfests for the Nordic Secure Bootloader which won't work with the Open DFU bootloader.

Looking at the docs for this board and the machine package, I don't seen anything that specifies what bootloader type is required.

https://tinygo.org/docs/reference/microcontrollers/pca10059/
https://tinygo.org/docs/reference/microcontrollers/machine/pca10059/

I'm not real familiar with the Nordic ecosystem yet. Can someone confirm this?

@kdochoa
Copy link

kdochoa commented Feb 20, 2025

Also happening to me. @aeijdenberg solution worked

@aeijdenberg
Copy link
Author

Hello @aeijdenberg just checking to see if this is still an issue for you?

Sorry for the late reply. And I'm not able to check if it's still an issue - I was playing with this a year ago but don't have the dev environment setup anymore.

From recent comments it looks like others still have the same or similar issue.

deadprogram added a commit that referenced this issue Feb 22, 2025
…t using nrf_open_dfu build tag. Intended to fix #4089

Signed-off-by: deadprogram <ron@hybridgroup.com>
deadprogram added a commit that referenced this issue Feb 22, 2025
…t using nrf_open_dfu build tag. Intended to fix #4089

Signed-off-by: deadprogram <ron@hybridgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nRF Nordic Semi
Projects
None yet
Development

No branches or pull requests

4 participants