This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

UNABLE TO GENERATE PRIVATE KEY

Hi,

I am following a tutorial in order to learn the procedure for DFU OTA . I installed the nrfutil but still unable to generate the private key.

I have tried several commands like :

nrfutil.exe keys generate private.key

nrfutil.exe keys generate priv.pem

but it did not work

I think i am using the latest version . 5.0.0

I am getting such errors : TypeError: write() argument must be str, not bytes
NameError: name 'raw_input' is not defined

Please suggest.
Could I be in wrong directory while writing these commands ?
C:\Users\ArshdeepMalik>nrfutil.exe keys generate private.key

Thanks much!

Parents
  • Hi.

    Please answer these questions:

    1. Which version of Python do you use? (You can check by typing python --version in cmd)

    2. Do you have the correct path in Environment Varables? (Check the path by typing where python in cmd)

    3. Can you check which version of nrfutil you have? (Check by typing nrfutil version in cmd)

    4. Have you also added the folder Python27\Scripts to the path in Environment Varables? 

    Best regards,

    Andreas

  • Hi Andreas,

    Which version of Python do you use? 3.7.2

    Do you have the correct path in Environment Varables?  Yes,

    Can you check which version of nrfutil you have? 5.0.0

     Have you also added the folder Python27\Scripts to the path in Environment Varables ? I did not have it before, but added after your comments but still getting error .

    NameError: name 'raw_input' is not defined

    Please suggest!!

    Thanks,

  • Hi.

    arshdeep said:
    Which version of Python do you use? 3.7.2

     You have to install Python 2.7 and use that, nrfutil requires Python 2.7.

    Best regards,

    Andreas

Reply Children
  • Thanks Andreas, It worked with Python2.7 

    i followed this tutorial:  https://devzone.nordicsemi.com/b/blog/posts/getting-started-with-nordics-secure-dfu-bootloader

    I tried sending DFU.zip file using nrfConnect app but the application was not able to send the file. 

    See the attached DFU.zip generated by me. 

    8270.DFU.zip

    can you suggest where i could have been wrong in the steps ? 

    Thanks, 

  • Hi.

    How did you generate the DFU.zip file? What command did you run?

    Could you please explain every step you took from start until you generated the DFU.zip file :-)

    Best regards,

    Andreas

  • Yes Of course. 

    A1. Generate your own private key : Generated 

    A2. Generate your public key based on your private key : Generated

    B1. Compile the uECC library : Compiled, looks like this :

    Then went inside folder \nRF5_SDK_15.0.0_a53641a\external\micro-ecc\nrf52nf_keil\armgcc and typed make.

    B2. Copy the public_key.c file : copied the public_key.c file here \nRF5_SDK_15.0.0_a53641a\examples\dfu\secure_bootloader and built the example successfully.

    Then created a zip folder in Desktop, DFU.zip . Copied the hex file from example SDK ble_app_blinky_pca10056_s140.hex into DFU.zip folder and also copied the private.key in the same folder. 

    Then tried to send this DFU.zip folder using nrfConnect app. 

    Thanks, 

  • Hi

    arshdeep said:
    Then created a zip folder in Desktop, DFU.zip . Copied the hex file from example SDK ble_app_blinky_pca10056_s140.hex into DFU.zip folder and also copied the private.key in the same folder. 

     Which command did you use in CMD? :-)

    You have to use nrfutil to generate a DFU packet.

    Best regards,

    Andreas

  • Thanks Andreas, I was able to generate the zip folder using the nrfutil but now i am running into 2 new issue ->

    1) After uploading the DFU.zip folder to nrf52840 DK from nrf Connect app, it does not run my application and kind of erases everything from board. The upload goes till 100% and seems like it did upload it successfully. 

    2) After I upload the DFU.zip folder, every time i try to flash another program using SES,  it keeps on going in DFU mode. I am unable to exit from DFU mode. 

    Please Suggest . 

    Regards, 

Related