[SOLVED] Programming nRF52832 with j-link BASE Compact using command line interface

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Programming nRF52832 with j-link BASE Compact using command line interface

    Dear all,

    I wanted to automate programming of my microcontroller nRF52832 with j-link BASE Compact using Command Line Interface (JLink.exe), calling the script from LabVIEW. I have to automate some operations, currently done with nRFgo Studio:
    - selection of "nRF5x Programming"
    - selection of a file to program in region "Program SoftDevice", click on "Program" then "Verify"
    - selection of a file to program in region "Program Application", click on "Program" then "Verify"

    First, I'm testing the commands from Command Prompt And I've some difficulties... This is what I've done (in Bold, commands I've typed):

    Microsoft Windows [version 10.0.18362.476]
    (c) 2019 Microsoft Corporation. Tous droits réservés.

    C:\Users\fmi>"C:\Program Files (x86)\SEGGER\JLink\JLink.exe"
    SEGGER J-Link Commander V6.62d (Compiled Mar 2 2020 09:23:14)
    DLL version V6.62d, compiled Mar 2 2020 09:22:41

    Connecting to J-Link via USB...O.K.
    Firmware: J-Link V10 compiled Jan 7 2020 16:51:47
    Hardware version: V10.10
    S/N: 820102851
    License(s): GDB
    VTref=3.290V


    Type "connect" to establish a target connection, '?' for help
    J-Link>Device NRF52832_XXAA
    J-Link>connect
    Please specify target interface:
    J) JTAG (Default)
    S) SWD
    T) cJTAG
    TIF>SWD
    Specify target interface speed [kHz]. <Default>: 4000 kHz
    Speed>
    Device "NRF52832_XXAA" selected.


    Connecting to target via SWD
    InitTarget() start
    InitTarget() end
    Found SW-DP with ID 0x2BA01477
    DPIDR: 0x2BA01477
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011)
    AP[1]: JTAG-AP (IDR: 0x02880000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Core found
    AP[0]: AHB-AP ROM base: 0xE00FF000
    CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    Found Cortex-M4 r0p1, Little endian.
    FPUnit: 6 code (BP) slots and 2 literal slots
    CoreSight components:
    ROMTbl[0] @ E00FF000
    ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
    ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    Cortex-M4 identified.
    J-Link>erase
    Erasing device...
    J-Link: Flash download: Total time needed: 0.396s (Prepare: 0.251s, Compare: 0.000s, Erase: 0.142s, Program: 0.000s, Verify: 0.000s, Restore: 0.003s)
    Erasing done.
    J-Link>loadfile C:\AppSBZ\Sources\SoftDevice_s132.hex
    Downloading file [C:\AppSBZ\Sources\SoftDevice_s132.hex]...
    J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (126976 bytes)
    J-Link: Flash download: Total time needed: 2.287s (Prepare: 0.037s, Compare: 0.029s, Erase: 0.000s, Program: 2.193s, Verify: 0.003s, Restore: 0.023s)
    O.K.
    J-Link>loadfile C:\AppSBZ\Sources\nrf52832_02122019.hex
    Downloading file [C:\AppSBZ\Sources\nrf52832_02122019.hex]...
    J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (57344 bytes)
    J-Link: Flash download: Total time needed: 1.081s (Prepare: 0.030s, Compare: 0.020s, Erase: 0.000s, Program: 1.009s, Verify: 0.003s, Restore: 0.016s)
    O.K.?


    When loading, a windows appears with a pogression bar.
    - how to send the command "Verify"?
    - how to make the difference under flashing Program SoftDevice and Program Application? I'm not sure, but maybe the second load crushes the first one...

    Finally, I've tried to create a file "script.jlink" with those commands:
    erase
    loadfile C:\AppSBZ\Sources\SoftDevice_s132.hex
    loadfile C:\AppSBZ\Sources\nrf52832_02122019.hex
    r


    I wanted to call it like this:
    "C:\Program Files (x86)\SEGGER\JLink\JLink.exe" -Device NRF52832_XXAA -if SWD -speed 4000 -CommanderScript C:\AppSBZ\Sources\script.jlink


    But I definitively doesn't work, I don't understand why...
    I work with a Windows 10 Enterprise Computer (version 1903), a programmer j-link BASE Compact (Version 10.10, Date 19-44, Part 8.19.00, S/N: 820102851), SEGGER J-Link Commander V6.62d, Firmware J-Link V10 and nRFgo Studio 1.21.2.10

    Is it possible to help me to find a way to solve my problems? Thank you per advance!

    Regards,

    Francis Millerot
  • Hi Francis,
    Thank you for your inquiry.

    Regarding "verify":
    A verify is part of "loadfile", so no need to do it manually.

    Regarding your command line:
    The commandline looks good to me and works when I use it.
    What exactly do you mean by "does not work"? What does not work exactly?

    Could you please send us a J-Link log file? How to enable:
    wiki.segger.com/J-Link_DLL#Enable_J-Link_Log_File

    Best regards,
    Fabian
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Fabian,

    Thank you for your response. I've tried again, and now it's running... :)
    I think it was because I still was inside JLINK.exe when I've tried to call my command line.
    Sorry for the disturbance, all is in order.

    Regards,
  • Hi Francis,
    Good to hear that you are up and running again. :)

    We will consider this thread as closed now.

    Best regards,
    Fabian
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.