Thingy91: Process to flash s340 and 52840

Hi,

I have been doing my development on the 9160DK and now its time to move the code over to the thingy 91.  I managed to get the 9160 flashed by following (https://devzone.nordicsemi.com/guides/cellular-iot-guides/b/getting-started-cellular/posts/how-to-program-any-project-to-the-thingy-91-with-dfu), but the 52840 and s340 softdevice seem to be a different story.

I  tried to follow, without success:
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_thingy91_gsg%2FUG%2Fthingy91_gsg%2Fupdating_fw.html

What I am not sure or have tried:
* Do I need to have the SWD-Select on nRF52, before I power-up (whilst holding sw4) ?  I saw one document indicating you needed to, but the above doesnt indicate you need to.  (I tried both)

* The image starts to load, but then I get the `Image Upload Failed: Bad response from device`.  I got the same error with the 9160, but by following the DFU link above, got around the problem - I am not sure how to get around it with the 52840, since I am not using zephyr.

* My 52840 software is using ANT+ therefore, I require the s340 softdevice and am using the legacy nRF5 SDK - since its not supported in zephyr.  The original way to load the s340 was with `nrfjprog` but that doesnt seem to work.

* For the 52840, do I need to use an external connection - say the 9160dk to be able to flash it ?

regards
-brett

Parents
  • * For the 52840, do I need to use an external connection - say the 9160dk to be able to flash it ?

    Yes, then you have full control over the firmware you program (and not limited to DFU over a serial interface that may not allow update of for instance softdevice out of the box), so please follow this setup:
    https://infocenter.nordicsemi.com/topic/ug_thingy91_gsg/UG/thingy91_gsg/updating_fw_ext_probe.html

    It should be possible to use an j-link programmer or nRF DK to program the nRF52840 on the thingy91. Then you can also program using nrfjprog.

    Kenneth

  • Hi Kenneth,

    Sorry for the slow response, I was waiting for a cable to arrive to test this process...

    I was able to flash the 52840 with out a problem, however, when I tried to flash the 9160 I get the following error on the programmer:

    2021-11-11T19:34:37.975Z INFO Using nrfjprog to communicate with target
    2021-11-11T19:34:39.005Z INFO Using J-Link Software version 6.88
    2021-11-11T19:34:39.794Z INFO Segger serial:  960048905
    2021-11-11T19:34:39.794Z INFO Segger speed:  2000  kHz
    2021-11-11T19:34:39.794Z INFO Segger version:  J-Link OB-K22-NordicSemi compiled Apr 29 2021 15:10:52
    2021-11-11T19:34:39.797Z INFO Core probed: 960048905
    2021-11-11T19:34:39.797Z INFO Core RAM: 256KiB
    2021-11-11T19:34:39.797Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-11T19:34:39.916Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-11T19:34:40.742Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-11T19:34:41.520Z INFO Core0: UICR has been read. Click read button to read full non-volatile memory.
    2021-11-11T19:34:51.571Z INFO Using nrfjprog to communicate with target
    2021-11-11T19:34:52.350Z INFO Using J-Link Software version 6.88
    2021-11-11T19:34:53.102Z INFO Segger serial:  960048905
    2021-11-11T19:34:53.103Z INFO Segger speed:  2000  kHz
    2021-11-11T19:34:53.103Z INFO Segger version:  J-Link OB-K22-NordicSemi compiled Apr 29 2021 15:10:52
    2021-11-11T19:34:53.103Z INFO Core probed: 960048905
    2021-11-11T19:34:53.103Z INFO Core RAM: 256KiB
    2021-11-11T19:34:53.103Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-11T19:34:53.230Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-11T19:34:54.013Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-11T19:35:03.590Z INFO Core0: Non-volatile memory has been read. 4 non-empty memory blocks identified
    2021-11-11T19:35:03.710Z INFO SoftDevice detected, id 0xCE (S340 v7.0.1)
    2021-11-11T19:36:02.413Z INFO Using nrfjprog to communicate with target
    2021-11-11T19:36:02.991Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    2021-11-11T19:36:45.354Z INFO Target device closed.
    2021-11-11T19:36:50.987Z INFO Using nrfjprog to communicate with target
    2021-11-11T19:36:51.549Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    When I try from the CLI, I get:
    nrfjprog --eraseall
    ERROR: JLinkARM DLL reported an error. Try again. If error condition
    ERROR: persists, run the same command again with argument --log, contact Nordic
    ERROR: Semiconductor and provide the generated log.log file to them.

    I have tried

    * restarting all boards but it still doesnt seem to be able to see or write to the 9160,

    * confirmed SW2 set to nrf91 (on the thingy91)

    * tried the Prog/DEBUG switch on the 9160 to nrf52 and nrf91

    Since I was able to update the 52840 on the thingy, I assume the cable and connection is all good, but any other thoughts ?

    cheers
    -brett

  • I also tried the original way of flashing the 9160 (on the thingy), via the USB and MCUBoot method, but I cant even get the USB to work.

    * Connect USB
    * Hold down SW3 whilst turning on the thingy
    * I dont see the device in the pulldown of the programmer, and I dont see any usb devices in /dev (I am on a mac)

  • It may seem like an issue with nrf connect v3.8/3.9 and/or jlink at the moment, from the log I can see it is not able to switch from the nRF52840  to nRF9160. Can you try to install JLink til v6.88a from https://www.segger.com/downloads/jlink (uninstall possible newer version first) and try again?

    If still is no luck, then you may need to downgrade to nrf connect v3.7 and install apps that is compatible with that release.:

    1. Download the latest 3.7 version of nRF Connect for Desktop from https://www.nordicsemi.com/Products/Development-tools/nRF-Connect-for-desktop/Download?lang=en#infotabs (for macOS this is 3.7.2, for Windows and Linux 3.7.1).
    2. After starting nRF Connect for Desktop 3.7 a prompt will come up about the 3.8 upgrade. Click “No” on this.
    3. In the Settings, click on “Add source”, enter the URL http://developer.nordicsemi.com/.pc-tools/nrfconnect-apps/3.7-apps/apps.json and click “Add”.
    4. Back in the list of all apps, all apps should show up twice now, one with “official” below them and one with “3.7 compatible apps” below them. If you want to hide the incompatible versions, click on “Filter” and deselect “Official”.
    5. Install the apps you need in the old versions and use them.
  • Hi Kenneth,

    I have installed 6.88.a

    nrfjprog --version
    nrfjprog version: 10.12.2
    JLinkARM.dll version: 6.88a

    I am also running 3.7.1 as per your details above. 

    I can still see the 52840 fine, so know its all connected, but same issue with the 9160:

    Error:
    2021-11-18T05:45:10.886Z INFO Application data folder: /Users/bdunstan/Library/Application Support/nrfconnect/pc-nrfconnect-programmer
    2021-11-18T05:45:10.978Z INFO Using nrfjprog library 10.12.1, pc-nrfjprog-js 1.7.6
    2021-11-18T05:45:11.022Z DEBUG App pc-nrfconnect-programmer v1.4.11 official
    2021-11-18T05:45:11.022Z DEBUG App path: /Users/bdunstan/.nrfconnect-apps/external/3.7 compatible apps/node_modules/pc-nrfconnect-programmer
    2021-11-18T05:45:11.022Z DEBUG nRFConnect 3.7.1, required by the app is (^3.6.0)
    2021-11-18T05:45:11.022Z DEBUG nRFConnect path: /Applications/nRF Connect.app/Contents/Resources/app.asar
    2021-11-18T05:45:11.022Z DEBUG HomeDir: /Users/bdunstan
    2021-11-18T05:45:11.022Z DEBUG TmpDir: /var/folders/2c/gmmw_pdn0yd3v6wc1vj0d2mm0000gn/T/
    2021-11-18T05:45:11.899Z VERBOSE Could not fetch serial number for serial port at /dev/tty.Bluetooth-Incoming-Port
    2021-11-18T05:45:11.899Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseQuietComfort35-SPPD
    2021-11-18T05:45:11.899Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseMicroSoundLink-SPPD
    2021-11-18T09:24:54.062Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:24:55.458Z INFO Using J-Link Software version 6.88
    2021-11-18T09:24:56.328Z INFO Segger serial:  960048905
    2021-11-18T09:24:56.328Z INFO Segger speed:  2000  kHz
    2021-11-18T09:24:56.328Z INFO Segger version:  J-Link OB-K22-NordicSemi compiled Apr 29 2021 15:10:52
    2021-11-18T09:24:56.329Z INFO Core probed: 960048905
    2021-11-18T09:24:56.329Z INFO Core RAM: 256KiB
    2021-11-18T09:24:56.329Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-18T09:24:56.450Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-18T09:24:57.216Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-18T09:24:57.967Z INFO Core0: UICR has been read. Click read button to read full non-volatile memory.
    2021-11-18T09:25:11.347Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:25:11.955Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    I have also connected it to a j-link edu mini, I can see the 52840 - but unable to see the 9160:

    Error:
    2021-11-18T09:31:14.124Z INFO Application data folder: /Users/bdunstan/Library/Application Support/nrfconnect/pc-nrfconnect-programmer
    2021-11-18T09:31:14.196Z INFO Using nrfjprog library 10.12.1, pc-nrfjprog-js 1.7.6
    2021-11-18T09:31:14.254Z DEBUG App pc-nrfconnect-programmer v1.4.11 official
    2021-11-18T09:31:14.254Z DEBUG App path: /Users/bdunstan/.nrfconnect-apps/external/3.7 compatible apps/node_modules/pc-nrfconnect-programmer
    2021-11-18T09:31:14.254Z DEBUG nRFConnect 3.7.1, required by the app is (^3.6.0)
    2021-11-18T09:31:14.255Z DEBUG nRFConnect path: /Applications/nRF Connect.app/Contents/Resources/app.asar
    2021-11-18T09:31:14.255Z DEBUG HomeDir: /Users/bdunstan
    2021-11-18T09:31:14.255Z DEBUG TmpDir: /var/folders/2c/gmmw_pdn0yd3v6wc1vj0d2mm0000gn/T/
    2021-11-18T09:31:15.132Z VERBOSE Could not fetch serial number for serial port at /dev/tty.Bluetooth-Incoming-Port
    2021-11-18T09:31:15.132Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseQuietComfort35-SPPD
    2021-11-18T09:31:15.132Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseMicroSoundLink-SPPD
    2021-11-18T09:31:29.251Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:31:29.654Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: LOW_VOLTAGE (fffffff4)

    2021-11-18T09:31:38.214Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:31:39.001Z INFO Using J-Link Software version 6.88
    2021-11-18T09:31:39.734Z INFO Segger serial:  801036805
    2021-11-18T09:31:39.734Z INFO Segger speed:  2000  kHz
    2021-11-18T09:31:39.735Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-18T09:31:39.738Z INFO Core probed: 801036805
    2021-11-18T09:31:39.738Z INFO Core RAM: 256KiB
    2021-11-18T09:31:39.738Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-18T09:31:39.871Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-18T09:31:40.611Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-18T09:31:50.357Z INFO Core0: Non-volatile memory has been read. 4 non-empty memory blocks identified
    2021-11-18T09:31:50.479Z INFO SoftDevice detected, id 0xCE (S340 v7.0.1)
    2021-11-18T09:32:02.244Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:32:02.762Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    2021-11-18T09:33:21.963Z INFO Target device closed.
    2021-11-18T09:33:26.730Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:33:27.222Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    Is there something fundamental I am missing ?

    I assume with the j-link or 9160DK, I dont need to press any other buttons on the thingy91 to get it to work, reset or ??

    Is there an option to do a full/hardware reset ?

    regards
    -brett

Reply
  • Hi Kenneth,

    I have installed 6.88.a

    nrfjprog --version
    nrfjprog version: 10.12.2
    JLinkARM.dll version: 6.88a

    I am also running 3.7.1 as per your details above. 

    I can still see the 52840 fine, so know its all connected, but same issue with the 9160:

    Error:
    2021-11-18T05:45:10.886Z INFO Application data folder: /Users/bdunstan/Library/Application Support/nrfconnect/pc-nrfconnect-programmer
    2021-11-18T05:45:10.978Z INFO Using nrfjprog library 10.12.1, pc-nrfjprog-js 1.7.6
    2021-11-18T05:45:11.022Z DEBUG App pc-nrfconnect-programmer v1.4.11 official
    2021-11-18T05:45:11.022Z DEBUG App path: /Users/bdunstan/.nrfconnect-apps/external/3.7 compatible apps/node_modules/pc-nrfconnect-programmer
    2021-11-18T05:45:11.022Z DEBUG nRFConnect 3.7.1, required by the app is (^3.6.0)
    2021-11-18T05:45:11.022Z DEBUG nRFConnect path: /Applications/nRF Connect.app/Contents/Resources/app.asar
    2021-11-18T05:45:11.022Z DEBUG HomeDir: /Users/bdunstan
    2021-11-18T05:45:11.022Z DEBUG TmpDir: /var/folders/2c/gmmw_pdn0yd3v6wc1vj0d2mm0000gn/T/
    2021-11-18T05:45:11.899Z VERBOSE Could not fetch serial number for serial port at /dev/tty.Bluetooth-Incoming-Port
    2021-11-18T05:45:11.899Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseQuietComfort35-SPPD
    2021-11-18T05:45:11.899Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseMicroSoundLink-SPPD
    2021-11-18T09:24:54.062Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:24:55.458Z INFO Using J-Link Software version 6.88
    2021-11-18T09:24:56.328Z INFO Segger serial:  960048905
    2021-11-18T09:24:56.328Z INFO Segger speed:  2000  kHz
    2021-11-18T09:24:56.328Z INFO Segger version:  J-Link OB-K22-NordicSemi compiled Apr 29 2021 15:10:52
    2021-11-18T09:24:56.329Z INFO Core probed: 960048905
    2021-11-18T09:24:56.329Z INFO Core RAM: 256KiB
    2021-11-18T09:24:56.329Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-18T09:24:56.450Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-18T09:24:57.216Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-18T09:24:57.967Z INFO Core0: UICR has been read. Click read button to read full non-volatile memory.
    2021-11-18T09:25:11.347Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:25:11.955Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    I have also connected it to a j-link edu mini, I can see the 52840 - but unable to see the 9160:

    Error:
    2021-11-18T09:31:14.124Z INFO Application data folder: /Users/bdunstan/Library/Application Support/nrfconnect/pc-nrfconnect-programmer
    2021-11-18T09:31:14.196Z INFO Using nrfjprog library 10.12.1, pc-nrfjprog-js 1.7.6
    2021-11-18T09:31:14.254Z DEBUG App pc-nrfconnect-programmer v1.4.11 official
    2021-11-18T09:31:14.254Z DEBUG App path: /Users/bdunstan/.nrfconnect-apps/external/3.7 compatible apps/node_modules/pc-nrfconnect-programmer
    2021-11-18T09:31:14.254Z DEBUG nRFConnect 3.7.1, required by the app is (^3.6.0)
    2021-11-18T09:31:14.255Z DEBUG nRFConnect path: /Applications/nRF Connect.app/Contents/Resources/app.asar
    2021-11-18T09:31:14.255Z DEBUG HomeDir: /Users/bdunstan
    2021-11-18T09:31:14.255Z DEBUG TmpDir: /var/folders/2c/gmmw_pdn0yd3v6wc1vj0d2mm0000gn/T/
    2021-11-18T09:31:15.132Z VERBOSE Could not fetch serial number for serial port at /dev/tty.Bluetooth-Incoming-Port
    2021-11-18T09:31:15.132Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseQuietComfort35-SPPD
    2021-11-18T09:31:15.132Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseMicroSoundLink-SPPD
    2021-11-18T09:31:29.251Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:31:29.654Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: LOW_VOLTAGE (fffffff4)

    2021-11-18T09:31:38.214Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:31:39.001Z INFO Using J-Link Software version 6.88
    2021-11-18T09:31:39.734Z INFO Segger serial:  801036805
    2021-11-18T09:31:39.734Z INFO Segger speed:  2000  kHz
    2021-11-18T09:31:39.735Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-18T09:31:39.738Z INFO Core probed: 801036805
    2021-11-18T09:31:39.738Z INFO Core RAM: 256KiB
    2021-11-18T09:31:39.738Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-18T09:31:39.871Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-18T09:31:40.611Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-18T09:31:50.357Z INFO Core0: Non-volatile memory has been read. 4 non-empty memory blocks identified
    2021-11-18T09:31:50.479Z INFO SoftDevice detected, id 0xCE (S340 v7.0.1)
    2021-11-18T09:32:02.244Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:32:02.762Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    2021-11-18T09:33:21.963Z INFO Target device closed.
    2021-11-18T09:33:26.730Z INFO Using nrfjprog to communicate with target
    2021-11-18T09:33:27.222Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    Is there something fundamental I am missing ?

    I assume with the j-link or 9160DK, I dont need to press any other buttons on the thingy91 to get it to work, reset or ??

    Is there an option to do a full/hardware reset ?

    regards
    -brett

Children
No Data
Related