How to program the nRF9160 with the segger j-link and the jlink.exe

Hello,

this is the first time I work with this device and the device is not for me or for my company.

I have to do an automatic test application, which should program the device and measure some voltage on a customer layout.

From the customer I get 3 modem firmware files and an application file.

Now the big question is, where do I have to put the hex files on the device.

The modem files has the names:

72xxxxx.ipc_dfu.signed_1.1.0.ihex - 14kB

firmware.update.image.segments.0.hex - 7kB

firmware.update.image.degments.1.hex - 5491kB

and then there is the application file:

Firmware_V1.0.4.hex - 612kB

The first question is how to do the correct connection to the device.

At the moment I have connect the segger j-link over SWD and it looks like it works fine with the connection:

J-Link>connect
Device "NRF9160_XXAA" selected.


Connecting to target via SWD
ConfigTargetSettings() start
---Setting ROM table---
ConfigTargetSettings() end - Took 107us
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[7]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x84770001, ADDR: 0x00000000)
AP[1]: AHB-AP (IDR: 0x24770011, ADDR: 0x01000000)
AP[2]: JTAG-AP (IDR: 0x12880000, ADDR: 0x02000000)
AP[3]: APB-AP (IDR: 0x54770002, ADDR: 0x03000000)
AP[4]: JTAG-AP (IDR: 0x12880000, ADDR: 0x04000000)
AP[5]: JTAG-AP (IDR: 0x12880000, ADDR: 0x05000000)
AP[6]: MEM-AP (IDR: 0x128800A1, ADDR: 0x06000000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FD212. Implementer code: 0x41 (ARM)
Feature set: Mainline
Cache: No cache
Found Cortex-M33 r0p2, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
Security extension: implemented
Secure debug: enabled
CoreSight components:
ROMTbl[0] @ E00FF000
[0][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33
[0][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT
[0][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB
[0][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM
[0][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM
[0][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI
Memory zones:
Zone: "Default" Description: Default access mode
Cortex-M33 identified.
J-Link>

The question is now, where do I have to put the different hex files?

I think the application should be placed on the adress 0x00000000 is that right?

I hope you can get my problem.

I have been searching for a solution now about 3 hours, but I don't find a hind where to put the hex, maybe I have over looked it.

Hope you can help me

Best regards

Michael

Parents
  • Let me start with, there are two MCU on the nRF9160, one is the modem itself, and one is the application/zephyr MCU.

    And there are a couple of additional tools around zephyr and the NCS (Nordic Connect SDK), which helps.

    For the modem mcu itself I mainly use the "nRF Connect For Desktop" application and the "Programmer" inside of that. There are also some CLI tools, bit I have never been able to used them with success. If you need to update the modem, the mfw is contained in a .zip (e.g. mfw_nrf9160_1.3.7.zip), which for best you never touch. Just load that into the "Programmer".

    For the application/zephyr it's easier. There you may use "west flash", or

    nrfjprog --program build/zephyr/merged.hex --sectorerase --verify -r

    (you need to download nrfjprog.

    The next thing to understand is the organization of the firmware and partitions.

    When the device starts up, the first part is the "bootloader", if that has no job (no pending image to activate, no serial rescue console requested by the user on restart), then zephyr starts and after that finished to boot, you applications starts. That is reflected in the used files. A "west build" usually generates:

    "merged.hex" that's the "bootloader + zephyr/application".

    "app_signed.hex" that's the "zephyr/application" in intelhex (without bootloader)

    and

    "app_update.bin" that's the "zephyr/application" in binary, sometimes required for alternative updates (e.g. FOTA).

    Usually not this general names of the west build are used, but at least you should know, which .hex should be used.

    From your description I guess, you have a JLink, so with that, and downloaded and installed (there may be some more dependencies to install) nrfjprog, I guess you need.

    nrfjprog --program Firmware_V1.0.4.hex --sectorerase --verify -r

    Cross the fingers ;-).

Reply
  • Let me start with, there are two MCU on the nRF9160, one is the modem itself, and one is the application/zephyr MCU.

    And there are a couple of additional tools around zephyr and the NCS (Nordic Connect SDK), which helps.

    For the modem mcu itself I mainly use the "nRF Connect For Desktop" application and the "Programmer" inside of that. There are also some CLI tools, bit I have never been able to used them with success. If you need to update the modem, the mfw is contained in a .zip (e.g. mfw_nrf9160_1.3.7.zip), which for best you never touch. Just load that into the "Programmer".

    For the application/zephyr it's easier. There you may use "west flash", or

    nrfjprog --program build/zephyr/merged.hex --sectorerase --verify -r

    (you need to download nrfjprog.

    The next thing to understand is the organization of the firmware and partitions.

    When the device starts up, the first part is the "bootloader", if that has no job (no pending image to activate, no serial rescue console requested by the user on restart), then zephyr starts and after that finished to boot, you applications starts. That is reflected in the used files. A "west build" usually generates:

    "merged.hex" that's the "bootloader + zephyr/application".

    "app_signed.hex" that's the "zephyr/application" in intelhex (without bootloader)

    and

    "app_update.bin" that's the "zephyr/application" in binary, sometimes required for alternative updates (e.g. FOTA).

    Usually not this general names of the west build are used, but at least you should know, which .hex should be used.

    From your description I guess, you have a JLink, so with that, and downloaded and installed (there may be some more dependencies to install) nrfjprog, I guess you need.

    nrfjprog --program Firmware_V1.0.4.hex --sectorerase --verify -r

    Cross the fingers ;-).

Children
  • So these means there is no known way to do an installation of the the modem firmware with the segger j-link allone?

    The problem I have to solve is, to do an automatisation, so there will be no user to work with the "Programmer" application.

    Is there no documentation where I have to put the hex and ihex files?

    Maybe the positions will be shown in the programmer tool?

    With the Jlink.exe tool I'm able to program the application, I think.

    Connecting to target via SWD
    ConfigTargetSettings() start
    ---Setting ROM table---
    ConfigTargetSettings() end - Took 68us
    Found SW-DP with ID 0x6BA02477
    DPIDR: 0x6BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[7]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x84770001, ADDR: 0x00000000)
    AP[1]: AHB-AP (IDR: 0x24770011, ADDR: 0x01000000)
    AP[2]: JTAG-AP (IDR: 0x12880000, ADDR: 0x02000000)
    AP[3]: APB-AP (IDR: 0x54770002, ADDR: 0x03000000)
    AP[4]: JTAG-AP (IDR: 0x12880000, ADDR: 0x04000000)
    AP[5]: JTAG-AP (IDR: 0x12880000, ADDR: 0x05000000)
    AP[6]: MEM-AP (IDR: 0x128800A1, ADDR: 0x06000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Core found
    AP[0]: AHB-AP ROM base: 0xE00FF000
    CPUID register: 0x410FD212. Implementer code: 0x41 (ARM)
    Feature set: Mainline
    Cache: No cache
    Found Cortex-M33 r0p2, Little endian.
    FPUnit: 8 code (BP) slots and 0 literal slots
    Security extension: implemented
    Secure debug: enabled
    CoreSight components:
    ROMTbl[0] @ E00FF000
    [0][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33
    [0][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT
    [0][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB
    [0][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM
    [0][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM
    [0][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI
    Memory zones:
    Zone: "Default" Description: Default access mode
    Cortex-M33 identified.
    J-Link>loadfile "C:\PROJECTS\ELPRO\PAB Libero Gx\Software\PAB Libero Gx\PAB Libero Gx\LIBERO G - FT1 V1.0.5A\dev-fw\LIBERO G - FT1 Firmware V1.0.5.hex" , 0x0000
    'loadfile': Performing implicit reset & halt of MCU.
    Reset type: NORMAL (wiki.segger.com/J-Link_Reset_Strategies)
    Reset: ARMv8M core with Security Extension enabled detected. Switch to secure domain.
    Reset: Halt core after reset via DEMCR.VC_CORERESET.
    Reset: Reset device via AIRCR.SYSRESETREQ.
    Downloading file [C:\PROJECTS\ELPRO\PAB Libero Gx\Software\PAB Libero Gx\PAB Libero Gx\LIBERO G - FT1 V1.0.5A\dev-fw\LIBERO G - FT1 Firmware V1.0.5.hex]...
    J-Link: Flash download: Bank 2 @ 0x00000000: Skipped. Contents already match
    O.K.
    J-Link>

    Is there a documentation for the modem firmware 1.3.7 to get the needed addresses?

    Best regards

    Michael

  • I'm not an employee of Nordic, I can't tell you, if there is no way. It's only no way in my experience (I remember, that the circuit dojo, but that's related to a nRF9160 feather only).

    The modem firmware update, AFAIK, works by using a special application loaded into RAM, which then does the real mfw update.

    But from the files above you don't update the modem itself, you update the application MCU.

Related