FATAL ERROR: command exited with status 1: /opt/SEGGER/JLink_V770e/JLinkExe -nogui 1 -if swd -speed 4000 -device nrf52 -CommanderScript /tmp/tmp9lqsoklajlink/runner.jlink -nogui 1

Hello, 

I am getting an error when I try to flash my device with j-link (see capture I attach) and this is some information I have:

-I can flash correctly with zephyr 3.2.0 vanila but now that I am working with NCS 2.2.0 I get this error.

-I can flash other devices with the same microcontroller (nrf52840) and NCS 2.2.0, so I just get this error in one of the devices I have.

I hope you can help me and I can provide you all information you need.

Best regards

Parents
  • Hi Ruben,

    Thank you for contacting DevZone at NordicSemi.

    As you are using a nordic soc (nrf52840) and the ncs 2.2.0, may I ask you to build and flash using VS Code and see if error persists, or if you get any other information.

    As you mentioned that you can build and flash other nrf52840 devices and experiencing error with one of the device:

    1) May I ask to check that you are building / flashing it correctly (using same command as for other devices and correct parameters)?

    2) Were you able to program this device previously?

    3) Were there any changes to the jlink (updation etc. recently)?

    4) When you connect this device, does it get recognized? Can you please test with the VS Code. 

    Also, make sure the device is in correct mode (switches etc in the correct position if it is the DK, or any other related configurations).

    I am not sure about jlink commander (though under the hood our solutions are using jlink), we recommend uisng VS Code with NRF Extensions and/or using the nrfjprog and other nrf-standalone tools (nrfconnect for desktop and nrfutils).

    BR,

    Naeem

  • Hello, thanks for answering, maybe I don't express myself well, I have two projects with ncs 2.2.0, I can flash one of them, but the other returns the error that I showed you, so it seems that the error is in the code.

    I've been trying to figure it out all morning and seems that the problem is lack of memory since I can flash without debug but I can not with debug options, this is my memory partitions:

     

    and I would like to be able to debug in order to find bugs and test correctly, I tried to comment bootloader and mcumgr but seems is not enough

  • Yes, seems the same but also seems that Nordic did not find a solution yet?

  • Hi Ruben,

    I think it is not the issue related to the Nordic hardware including SoC and the DK, or the Nordic software including drivers and the SDK, but rather the user application (code and the size using different required libraries etc) and the partitions.

  • Hi Naeem, the thing is that I tried to reduce the size and just now my flash says 77% and It stills not working I realized It just fails when the flash is larger than 50% and I do not know why this behaviour, I though this was because I have 2 images for dfu upgrade so I decided to erase slot1_partition and increase slot0_partition but It still not working, I do not understand... I do not know if this is a bug of v2.2.0 or I am doing something wrong...

  • Hi Ruben,

    Sorry for the delayed response.
    Your experiment seems interesting to figure out if this really is the issue. However, I am not able to conclude that. Have you done these experiments with nordic samples as well?

    I understand that enabling debug options could result into flash overflown error, but the numbers you are reporting seems too much.

    Can you produce any such case with NCS built-in samples?

    I also recommend you to use latest version of the NCS SDK that is currently v2.4.0. You may also like to visit known issues (under release notes) of concerned SDK version.

    BR,
    Naeem

  • Hi Naeem,

    I was trying to flash with another projects which flash memory used was larger than 50% and It worked good so seems the problem is only for that project and not hardware. 

    -In the past I was working with zephyr vanila and everything was working fine but now that I work with nrf 2.2.0 I have troubles, you can see that is not allocating correctly the application when I use west flash



    -I only get to flash with the next comand correctly nrfjprog -f nrf52 --debugreset && nrfjprog -f nrf52 --program build/zephyr/zephyr.hex --sectorerase --verify && nrfjprog -f nrf52 --debugreset.

    -This error just happens when my memory flash used is larger than 50% so seems maybe is something related to partitions but I do not understand because I have other project that I can flash correctly so the problems seems is just related to this project.

    ¿maybe the bootloader is not working correctly? I am going to try to install NCS for VScode and try if that fixs the problem, but all this seems like a nordic bug that is not able to allocate memory correctly.

Reply
  • Hi Naeem,

    I was trying to flash with another projects which flash memory used was larger than 50% and It worked good so seems the problem is only for that project and not hardware. 

    -In the past I was working with zephyr vanila and everything was working fine but now that I work with nrf 2.2.0 I have troubles, you can see that is not allocating correctly the application when I use west flash



    -I only get to flash with the next comand correctly nrfjprog -f nrf52 --debugreset && nrfjprog -f nrf52 --program build/zephyr/zephyr.hex --sectorerase --verify && nrfjprog -f nrf52 --debugreset.

    -This error just happens when my memory flash used is larger than 50% so seems maybe is something related to partitions but I do not understand because I have other project that I can flash correctly so the problems seems is just related to this project.

    ¿maybe the bootloader is not working correctly? I am going to try to install NCS for VScode and try if that fixs the problem, but all this seems like a nordic bug that is not able to allocate memory correctly.

Children
  • I could share you my code in case you need it.

  • Hi Ruben,

    I was on vacations for last two weeks, that's why could not respond.

    Can you let me know how to reproduce the issue using Nordic Sample (or their modification) using VS Code?

  • Hi Naeem,

    no worries I hope your vacation were good, I have no problem when I try to flash a sample but I observed the proces when I use the comand west flash is not the same for a sample of nrf than for my application:

    This is for an nrf sample, seems that flash a ile called merge.hex

    This is for my aplication, I think just flashes zephyr.hex:

    Maybe I added my project incorrectly? This is the structure of my project (watchman):

    This is how I add watchman to the project, adding those lines in the file west.yml of nrf repository

  • Hi Ruben,

    Appreciate your patience.

    I would highly recommend you to use latest version of NCS (2.4.0) along with VS Code extension. It is very easy to get started with NCS. You have to install NCS Desktop which would allow you to get and update Nordic apps like Programmer, ToolChain Manager, Cellular Monitor, Power Profiler and many others.
    This might help in installing different tools 

    Once you have installed and successfully built samples (confirming everything is correct and in place), then build your project.

    There could be a lot of differences in projects and samples, and it really depends on what you are using and building for using zephyr that will generate different files.
    For example:
    zephyr.hex is generated for each image
    merged.hex is generated for each core (by combining all images [zephyr.hex] for a single core)
    merged_domain.hex is generated for all cored (by combining all merged.hex)
    Then the more complexity could be added depending upon:
    whether you are building for secure domain or non-secure domain
    whether you are using DFU / FOTA or not
    you can check about output files here for building firmware 

    Now as you have successfully complied the samples or other projects that are larger than 50% flash memory, the issue seems to be in the project itself. As you are using the bootloader, I suggest you to base your project on official / supported (Nordic / Zephyr) samples.

    For example, I see you have shared your folder structure. Below, I started with a sample project in NCS and then added mcuboot to it, and just sharing output of building with and without mcuboot

    1) Building peripheral uart in ncs 2.4.0

    2) Building the same sample with MCUboot:

    I have built both cases for the same build target (nrf52840). We can see the increase in flash usage and generation of different output files.

    For official MCUboot sample please refer to SMP Server, and for unofficial samples in NCS please have a look at this repo.

    BR, Naeem

Related