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

  • Brett said:

    Status is basically the same, whenever I load my code on the 52840, the 9160 is inaccessible.

    I can confirm the 52840 code is flashed correctly, as I can get some printf() logs on the debug terminal (NRF_LOG not working yet).

    Thanks a lot for the feedback! I honestly struggle a little bit with remembering all the details here, so I would appreciate if we could start all over again :-)

    Is the Thingy:91 setup you have according to the picture below?

    And are you in general able to successfully flash the nRF52840 with the Connectivity bridge and respectively the nRF9160 with one of the other applications included in this firmware package?

    Regards,

    Markus

  • Hi Markus,

    More than happy to start again, there is a whole lot of stuff above.

    Connection:
    * I am connected the same as the picture above and I also have a j-link edu mini that I am using, both give the same outcome.

    Project Objective:
    Receive Bike power data via ANT+ on the 52840 (soft device 340) transfer this data over UART to the 9160, so it can then send the data (with GPS) to an MQTT receiver.  All of the code works on the 9160DK, so it was now time to transfer it to the thingy 91, which is where I am stuck.

    Details:
    I can flash the 52840 with out a problem and the code I have appears to work.  I connected via Jlink and can see the NRF_LOG messages coming to the terminal window, that all looks good.  Appears to work means, I can receive ANT+ messages from my bike power meter and able to LOG them to the terminal - UART connection to the 9160 is not yet successful.

    I can flash the 9160 image, as long as I dont have any code on the 52840.  So, if I erase-all on the 52840, I can flash the image fine.  But, if I have my image on the 52840 first, I am unable to falsh the 9160. Today, I managed to get some debug messages on the RTT-Terminal window, but have not done enough testing to confirm if its actually getting the GPS co-ordinates correctly, or connecting to the network correctly - I will test that tomorrow.

    Issue:
    The real issue that I am faced with at the moment is, if I have my image flashed to the 52840, I cant flash the 9160.  If I flash the 9160 first, I can flash the 52840 - but have not then been able to connect back onto the 9160 - until I remove the image from the 52840. If I remove the 51840 image, I can then connect back onto the 9160 and see the image that I originally flashed.

    In reading the docs, I didnt see anything about an order in which you had to flash the images, so I am sure I am doing something wrong :).

    I can record a screen capture of what I am doing if that helps, or I have pushed my latest code to github if  you are interested.  If you would like a flow diagram of the project, I can easily draw one.

    9160 : github.com/.../gps_iot_thingy
    52840: github.com/.../ant_app_libUARTE

    regards
    -brett

  • Thanks a lot again for your detailed explanation of the issue, Brett!

    Brett said:
    In reading the docs, I didnt see anything about an order in which you had to flash the images, so I am sure I am doing something wrong :).

    Generally, the nRF9160 and nRF52840 should be able to operate independently from each other on the Thingy:91. So I’m a bit surprised that you are facing this issue.

    However, I do not have any experience with software from two different tool chains running on the Thingy:91. And unfortunately, I do not have my Thingy:91 available for at least this week. Anyway, let us see what we can do here.

    • Are you generally able to flash the Connectivity Bridge and a nRF9160 application from the firmware package mentioned in my previous post?

    • Which tool are you using respectively to flash your applications?

    • Can you once again provide me with a log showing the error you are facing while trying to flash the nRF9160?

    Thanks and regards,

    Markus

  • Hi Markus,

    • Are you generally able to flash the Connectivity Bridge and a nRF9160 application from the firmware package mentioned in my previous post?

    • Which tool are you using respectively to flash your applications?

    • Can you once again provide me with a log showing the error you are facing while trying to flash the nRF9160?

    * I have flashed the connectivity bridge to the 52840 - no problems and also the asset-tracker app to the 9160 - no problems

    * I generally use the nrf-connect programmer to flash images to 52840 and 9160 - as well as the soft device. But, I have also used nrfjprog to flash the soft device and west to flash the other image - same issue occurs.

    I have attached a log file to the case, of which it contains:

    * SW 9160 - erase all (successful)
    * SW 52840 - erase all (successful)
    * SW 52840 - write my image (successful)
    * SW 9160 - read (fails with the error you can see a the bottom of the log)

    `2021-11-24T10:35:26.001Z 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 like the theory of the different tool-chains, but how to get around this - as I need ANT+ which is only supported in the old SDK (or thats what I was told).

    regards
    -brett

  • 2021-11-24T04:00:30.332Z INFO Application data folder: /Users/bdunstan/Library/Application Support/nrfconnect/pc-nrfconnect-programmer
    2021-11-24T04:00:30.581Z INFO Using nrfjprog library 10.12.1, pc-nrfjprog-js 1.7.6
    2021-11-24T04:00:30.585Z DEBUG App pc-nrfconnect-programmer v1.4.11 official
    2021-11-24T04:00:30.585Z DEBUG App path: /Users/bdunstan/.nrfconnect-apps/external/3.7 compatible apps/node_modules/pc-nrfconnect-programmer
    2021-11-24T04:00:30.585Z DEBUG nRFConnect 3.7.1, required by the app is (^3.6.0)
    2021-11-24T04:00:30.585Z DEBUG nRFConnect path: /Applications/nRF Connect.app/Contents/Resources/app.asar
    2021-11-24T04:00:30.585Z DEBUG HomeDir: /Users/bdunstan
    2021-11-24T04:00:30.585Z DEBUG TmpDir: /var/folders/2c/gmmw_pdn0yd3v6wc1vj0d2mm0000gn/T/
    2021-11-24T04:00:31.341Z VERBOSE Could not fetch serial number for serial port at /dev/tty.Bluetooth-Incoming-Port
    2021-11-24T04:00:31.341Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseQuietComfort35-SPPD
    2021-11-24T04:00:31.341Z VERBOSE Could not fetch serial number for serial port at /dev/tty.BoseMicroSoundLink-SPPD
    2021-11-24T04:00:41.915Z INFO Using nrfjprog to communicate with target
    2021-11-24T04:00:51.497Z INFO Using J-Link Software version 6.88
    2021-11-24T04:00:52.270Z INFO Segger serial:  801036805
    2021-11-24T04:00:52.270Z INFO Segger speed:  2000  kHz
    2021-11-24T04:00:52.270Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T04:00:52.270Z INFO Core probed: 801036805
    2021-11-24T04:00:52.270Z INFO Core RAM: 256KiB
    2021-11-24T04:00:52.270Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T04:00:52.391Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-24T04:00:53.150Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T04:01:02.916Z INFO Core0: Non-volatile memory has been read. 1 non-empty memory blocks identified 
    2021-11-24T04:01:31.048Z INFO Using nrfjprog to communicate with target
    2021-11-24T04:01:31.953Z INFO Using J-Link Software version 6.88
    2021-11-24T04:01:32.804Z INFO Segger serial:  801036805
    2021-11-24T04:01:32.805Z INFO Segger speed:  2000  kHz
    2021-11-24T04:01:32.805Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T04:01:32.806Z INFO Core probed: 801036805
    2021-11-24T04:01:32.806Z INFO Core RAM: 256KiB
    2021-11-24T04:01:32.806Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T04:01:33.059Z INFO Model: NRF9160_xxAA_REV2.
    2021-11-24T04:01:33.826Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T04:01:44.147Z INFO Core0: Non-volatile memory has been read. 2 non-empty memory blocks identified 
    2021-11-24T04:03:14.916Z INFO Recovery procedure finished
    2021-11-24T04:03:14.924Z INFO Using nrfjprog to communicate with target
    2021-11-24T04:03:15.691Z INFO Using J-Link Software version 6.88
    2021-11-24T04:03:16.357Z INFO Segger serial:  801036805
    2021-11-24T04:03:16.357Z INFO Segger speed:  2000  kHz
    2021-11-24T04:03:16.357Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T04:03:16.357Z INFO Core probed: 801036805
    2021-11-24T04:03:16.358Z INFO Core RAM: 256KiB
    2021-11-24T04:03:16.358Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T04:03:16.598Z INFO Model: NRF9160_xxAA_REV2.
    2021-11-24T04:03:17.288Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T04:03:27.136Z INFO Core0: Non-volatile memory has been read. 1 non-empty memory blocks identified 
    2021-11-24T05:35:06.972Z INFO Target device closed.
    2021-11-24T07:53:13.431Z INFO Using nrfjprog to communicate with target
    2021-11-24T07:53:15.154Z INFO Using J-Link Software version 6.88
    2021-11-24T07:53:16.214Z INFO Segger serial:  801036805
    2021-11-24T07:53:16.214Z INFO Segger speed:  2000  kHz
    2021-11-24T07:53:16.214Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T07:53:16.216Z INFO Core probed: 801036805
    2021-11-24T07:53:16.216Z INFO Core RAM: 256KiB
    2021-11-24T07:53:16.216Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T07:53:16.355Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-24T07:53:17.404Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T07:53:27.325Z INFO Core0: Non-volatile memory has been read. 1 non-empty memory blocks identified 
    2021-11-24T07:54:22.456Z INFO Parsing HEX file:  /Users/bdunstan/Downloads/thingy91_fw_2021-10-20_d29f1dde/img_app_bl/thingy91_nrf52_connectivity_bridge_2021-10-20_d29f1dde.hex
    2021-11-24T07:54:22.496Z INFO File was last modified at  20/10/2021, 09:56:38
    2021-11-24T07:54:25.401Z INFO Does not need to be reloaded:  /Users/bdunstan/Downloads/thingy91_fw_2021-10-20_d29f1dde/img_app_bl/thingy91_nrf52_connectivity_bridge_2021-10-20_d29f1dde.hex
    2021-11-24T07:54:25.402Z INFO Writing procedure starts for core0
    2021-11-24T07:54:42.856Z INFO Write procedure finished
    2021-11-24T07:54:42.858Z INFO Using nrfjprog to communicate with target
    2021-11-24T07:54:43.661Z INFO Using J-Link Software version 6.88
    2021-11-24T07:54:44.431Z INFO Segger serial:  801036805
    2021-11-24T07:54:44.431Z INFO Segger speed:  2000  kHz
    2021-11-24T07:54:44.431Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T07:54:44.431Z INFO Core probed: 801036805
    2021-11-24T07:54:44.431Z INFO Core RAM: 256KiB
    2021-11-24T07:54:44.431Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T07:54:44.559Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-24T07:54:45.722Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T07:54:55.987Z INFO Core0: Non-volatile memory has been read. 5 non-empty memory blocks identified 
    2021-11-24T07:56:37.643Z INFO Using nrfjprog to communicate with target
    2021-11-24T07:56:38.824Z INFO Using J-Link Software version 6.88
    2021-11-24T07:56:39.664Z INFO Segger serial:  801036805
    2021-11-24T07:56:39.664Z INFO Segger speed:  2000  kHz
    2021-11-24T07:56:39.664Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T07:56:39.665Z INFO Core probed: 801036805
    2021-11-24T07:56:39.665Z INFO Core RAM: 256KiB
    2021-11-24T07:56:39.665Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T07:56:39.978Z INFO Model: NRF9160_xxAA_REV2.
    2021-11-24T07:56:40.819Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T07:56:50.817Z INFO Core0: Non-volatile memory has been read. 1 non-empty memory blocks identified 
    2021-11-24T07:57:34.254Z INFO Parsing HEX file:  /Users/bdunstan/Downloads/thingy91_fw_2021-10-20_d29f1dde/img_app_bl/thingy91_asset_tracker_ltem_2021-10-20_d29f1dde.hex
    2021-11-24T07:57:34.254Z INFO File was last modified at  20/10/2021, 09:56:56
    2021-11-24T07:57:39.941Z INFO Parsing HEX file:  /Users/bdunstan/Downloads/thingy91_fw_2021-10-20_d29f1dde/img_app_bl/thingy91_asset_tracker_ltem_2021-10-20_d29f1dde.hex
    2021-11-24T07:57:39.941Z INFO File was last modified at  20/10/2021, 09:56:56
    2021-11-24T07:57:46.991Z INFO Does not need to be reloaded:  /Users/bdunstan/Downloads/thingy91_fw_2021-10-20_d29f1dde/img_app_bl/thingy91_asset_tracker_ltem_2021-10-20_d29f1dde.hex
    2021-11-24T07:57:46.991Z INFO Writing procedure starts for core0
    2021-11-24T07:58:06.514Z INFO Write procedure finished
    2021-11-24T07:58:06.517Z INFO Using nrfjprog to communicate with target
    2021-11-24T07:58:07.296Z INFO Using J-Link Software version 6.88
    2021-11-24T07:58:07.996Z INFO Segger serial:  801036805
    2021-11-24T07:58:07.996Z INFO Segger speed:  2000  kHz
    2021-11-24T07:58:07.996Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T07:58:07.996Z INFO Core probed: 801036805
    2021-11-24T07:58:07.996Z INFO Core RAM: 256KiB
    2021-11-24T07:58:07.996Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T07:58:08.269Z INFO Model: NRF9160_xxAA_REV2.
    2021-11-24T07:58:09.010Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T07:58:19.002Z INFO Core0: Non-volatile memory has been read. 6 non-empty memory blocks identified 
    2021-11-24T10:33:19.511Z INFO Recovery procedure finished
    2021-11-24T10:33:19.539Z INFO Using nrfjprog to communicate with target
    2021-11-24T10:33:20.246Z INFO Using J-Link Software version 6.88
    2021-11-24T10:33:20.888Z INFO Segger serial:  801036805
    2021-11-24T10:33:20.888Z INFO Segger speed:  2000  kHz
    2021-11-24T10:33:20.888Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T10:33:20.888Z INFO Core probed: 801036805
    2021-11-24T10:33:20.888Z INFO Core RAM: 256KiB
    2021-11-24T10:33:20.888Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T10:33:21.132Z INFO Model: NRF9160_xxAA_REV2.
    2021-11-24T10:33:21.840Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T10:33:31.742Z INFO Core0: Non-volatile memory has been read. 1 non-empty memory blocks identified 
    2021-11-24T10:33:49.800Z INFO Using nrfjprog to communicate with target
    2021-11-24T10:33:51.175Z INFO Using J-Link Software version 6.88
    2021-11-24T10:33:52.341Z INFO Segger serial:  801036805
    2021-11-24T10:33:52.342Z INFO Segger speed:  2000  kHz
    2021-11-24T10:33:52.342Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T10:33:52.342Z INFO Core probed: 801036805
    2021-11-24T10:33:52.342Z INFO Core RAM: 256KiB
    2021-11-24T10:33:52.342Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T10:33:52.457Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-24T10:33:53.582Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T10:34:03.475Z INFO Core0: Non-volatile memory has been read. 5 non-empty memory blocks identified 
    2021-11-24T10:34:09.815Z INFO Recovery procedure finished
    2021-11-24T10:34:09.819Z INFO Using nrfjprog to communicate with target
    2021-11-24T10:34:10.575Z INFO Using J-Link Software version 6.88
    2021-11-24T10:34:11.337Z INFO Segger serial:  801036805
    2021-11-24T10:34:11.337Z INFO Segger speed:  2000  kHz
    2021-11-24T10:34:11.337Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T10:34:11.337Z INFO Core probed: 801036805
    2021-11-24T10:34:11.337Z INFO Core RAM: 256KiB
    2021-11-24T10:34:11.338Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T10:34:11.472Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-24T10:34:12.234Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T10:34:21.925Z INFO Core0: Non-volatile memory has been read. 1 non-empty memory blocks identified 
    2021-11-24T10:34:38.110Z INFO Parsing HEX file:  /Users/bdunstan/Downloads/ANT_s340_nrf52_7.0.1/ANT_s340_nrf52_7.0.1.hex
    2021-11-24T10:34:38.115Z INFO File was last modified at  25/06/2020, 16:25:50
    2021-11-24T10:34:38.205Z INFO SoftDevice detected, id 0xCE (S340 v7.0.1)
    2021-11-24T10:34:46.539Z INFO Parsing HEX file:  /Users/bdunstan/code/nRF5SDK1702/nRF5_SDK_17.0.2_d674dde/examples/MyProjects/ant_app_libUARTE/pca10056/s340/ses/Output/Release/Exe/ant_app__uart_pca10056_s340.hex
    2021-11-24T10:34:46.539Z INFO File was last modified at  23/11/2021, 06:46:50
    2021-11-24T10:34:46.553Z INFO SoftDevice detected, id 0xCE (S340 v7.0.1)
    2021-11-24T10:34:51.912Z INFO Does not need to be reloaded:  /Users/bdunstan/Downloads/ANT_s340_nrf52_7.0.1/ANT_s340_nrf52_7.0.1.hex
    2021-11-24T10:34:51.912Z INFO Does not need to be reloaded:  /Users/bdunstan/code/nRF5SDK1702/nRF5_SDK_17.0.2_d674dde/examples/MyProjects/ant_app_libUARTE/pca10056/s340/ses/Output/Release/Exe/ant_app__uart_pca10056_s340.hex
    2021-11-24T10:34:51.912Z INFO Writing procedure starts for core0
    2021-11-24T10:35:03.510Z INFO Write procedure finished
    2021-11-24T10:35:03.512Z INFO Using nrfjprog to communicate with target
    2021-11-24T10:35:04.420Z INFO Using J-Link Software version 6.88
    2021-11-24T10:35:05.170Z INFO Segger serial:  801036805
    2021-11-24T10:35:05.170Z INFO Segger speed:  2000  kHz
    2021-11-24T10:35:05.170Z INFO Segger version:  J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
    2021-11-24T10:35:05.171Z INFO Core probed: 801036805
    2021-11-24T10:35:05.171Z INFO Core RAM: 256KiB
    2021-11-24T10:35:05.171Z INFO Core ROM: 1024KiB in pages of 4KiB
    2021-11-24T10:35:05.291Z INFO Model: NRF52840_xxAA_REV2.
    2021-11-24T10:35:06.083Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
    2021-11-24T10:35:15.877Z INFO Core0: Non-volatile memory has been read. 4 non-empty memory blocks identified 
    2021-11-24T10:35:15.987Z INFO SoftDevice detected, id 0xCE (S340 v7.0.1)
    2021-11-24T10:35:15.990Z INFO SoftDevice detected, id 0xCE (S340 v7.0.1)
    2021-11-24T10:35:25.414Z INFO Using nrfjprog to communicate with target
    2021-11-24T10:35:26.001Z 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-24T10:38:39.050Z ERROR Unable to open log file: Could not find file at path: /Users/bdunstan/Library/Application Support/nrfconnect/pc-nrfconnect-programmer/logs/2021-11-24T04_00_30.042Z-log.txt
    2021-11-24T10:38:41.589Z ERROR Unable to open log file: Could not find file at path: /Users/bdunstan/Library/Application Support/nrfconnect/pc-nrfconnect-programmer/logs/2021-11-24T04_00_30.042Z-log.txt
    

    Sorry, but wasnt sure how to add attachments...

Related