Problem executing simple program on Thingy91

Hello,

I recently acquired a Thingy91 board in order to make a hardware prototype. I already have experience developing with the nRF52840 so I took inspiration from my working project.

First I flashed the straight out "Hello World" sample from the v2.9.0 SDK to the nRF9160 using a J-Link external probe and the "west flash" command with success. I could launch the program and read "Hello World" from a serial terminal.

Then I tried to create a basic setup project by copying what worked on my nRF52840 project. These basic functionalities includes:

_ Versionning

_ Using sysbuild with MCUBOOT

_ Signing firmware with an ECDSA 256 key.

The project successfully built and flashed, but unfortunately, didn't execute. No output can be read from the serial terminal anymore, not even the early logs from the bootloader.

What's a bit worrisome is that I can't manage to get back to a state where things worked. When I try to flash the basic "Hello World" sample again, the program doesn't launch anymore (no output on the serial terminal).

Any idea what could be going on and how to fix this ? I tried switching to the most recent v3.0.1 SDK but with no success.

I'm adding the .tar.gz of the project.

thingy_minimal.tar.gz

Here is my build configuration:

And the output when I flash:

Thank you for your time,

AdBee

Parents
  • Hello, 

    The Nordic Thingy:91 USB connector is connected to the USB interface of the nRF52840 SoC. This enables PC communication and battery charging. The nRF52840 comes preprogrammed with the Connectivity Bridge application which  acts as a USB composite device, exposing two UART interfaces to a USB host as two CDC ACM devices.

    Did you reprogram the nRF52840? I.e. build for thingy91/nrf52840?

    Also, I see that you are building you project for the thingy91/nrf9160 and not the thingy91/nrf9160/ns. The latter is needed in order to communicate with the nRF91 modem from the application core. See Developing with the Thingy:91 for more information.

    Kind regards,
    Øyvind

  • Hello,

    Thank you for your fast reply.

    I think by using the thingy91/nrf9160 board instead of the thingy/nrf9160/ns, I may have overwritten some useful default partitions.

    Following your link, I reinstalled all default images using the nRFConnect for Desktop, reflashed my own code with the thingy/nrf9160/ns board and it appears that it solved my problem.

    I have further questions though:

    1/ When I switch off/on the device using the SW1 switch, my program doesn't restart from scratch as expected, but rather seems to resume to where it was. How is it ? Is there a bootloader configuration that somehow saves PC and other registers ? Is it possible to change this behavior so that my program actually restarts at every power on ? It is unclear to me how the peripherals behave when their parameters are not explicitly set by my init functions.

    2/ With regards to the partitions: I am used to customize them in a pm_static file to enable features such as nvs or BLE settings. But with this "ns" setup it seems that a lot of things are done under the hood that I shouldn't break. How can I customize partitions in this environment ?

    Thank you for your time,

    AdBee

  • AdBee said:
    1/ When I switch off/on the device using the SW1 switch, my program doesn't restart from scratch as expected, but rather seems to resume to where it was. How is it ?

    Could you provide logs from the application of what you are describing? This does not sound correct. What program are you running on the device?

    AdBee said:
    How can I customize partitions in this environment ?

    The Thingy:91 uses its own partition layout, have a look at Partition layout. This uses e.g. nrf\boards\nordic\thingy91\thingy91_pm_static_lwm2m_carrier.yml

    You could have a look at nrf\boards\nordic\thingy91\thingy91_nrf9160_partition_conf.dts

    Let me know how that works for you.

    Kind regards,
    Øyvind

Reply
  • AdBee said:
    1/ When I switch off/on the device using the SW1 switch, my program doesn't restart from scratch as expected, but rather seems to resume to where it was. How is it ?

    Could you provide logs from the application of what you are describing? This does not sound correct. What program are you running on the device?

    AdBee said:
    How can I customize partitions in this environment ?

    The Thingy:91 uses its own partition layout, have a look at Partition layout. This uses e.g. nrf\boards\nordic\thingy91\thingy91_pm_static_lwm2m_carrier.yml

    You could have a look at nrf\boards\nordic\thingy91\thingy91_nrf9160_partition_conf.dts

    Let me know how that works for you.

    Kind regards,
    Øyvind

Children
  • Could you provide logs from the application of what you are describing? This does not sound correct. What program are you running on the device?

    Sure. I am running this very basic program which logs the version of the app and then logs "HI" forever.

    This is what I see when I first flash the program:

    And this is what I see when I switch the device off/on:

    In this version the early logs don't print.

    Now I am aware that log printing cannot be trusted 100% since they are not processed by the main thread but by the one that runs the default work_queue. On occasions there may be some delay/some loss (though I have CONFIG_LOG_MODE_IMMEDIATE=y in my .conf file which should somehow help a little). Still I have never witnessed an absence of early logs with a program that simple and that runs on such a low frequency when working with my previous nRF52840 project. So I am a bit surprised here.

    The Thingy:91 uses its own partition layout, have a look at Partition layout. This uses e.g. nrf\boards\nordic\thingy91\thingy91_pm_static_lwm2m_carrier.yml

    You could have a look at nrf\boards\nordic\thingy91\thingy91_nrf9160_partition_conf.dts

    From my understanding, the pm_static files override the partitions that are defined in .dts files. Does the existence of the later file means that pm_static files are not used by default, but only if configs such as CONFIG_THINGY91_STATIC_PARTITIONS_FACTORY are provided ?

    Say that I provide a custom pm_static file with CONFIG_THINGY91_NO_PREDEFINED_LAYOUT. Since I am using an external programmer and not the USB, I can overwrite the whole partition (size 0x100000) safely, right ? Won't this mess up the "connectivity bridge" that is deployed on the nRF52840 ? To what point does the "connectivity bridge" make assumptions about the partitions of the nRF9160 ?

    Thank you for your support,

    AdBee

  • I have an additional question.

    I am trying to interact with the LTE-M/GNSS module by using AT-commands.

    First I flashed the AT-Client module and verified that I could send AT command through the serial terminal.

    Now I am trying to send said AT-commands programmatically.

    Taking inspiration from the AT Client sample and this page here is what I have:

    Unfortunately I am having an error while linking the library:

    I am unfamiliar with the build pipeline in the nrf toolchain and how I am supposed to properly do this, but I assume I might as well compile the nrfxlib library myself and then reference it as an external library in the CMakeLists.txt. So I ran:

    And got:

    Since the command was not recognized, I though my cmake version might be outdated, but from my googling "add_directory_ifdef" isn't a native Cmake command but rather something defined by Zephyr/the NRF toolchain. I am a little puzzled at what to do. Any input ?

  • Any update ?

    EDIT: With regard to my last question, I found out that the nrfxlib library is already compiled in the packaged v2.9.0 SDK (as "west list" reveals). The correct way to import it is to call #include <nrf_model_at.h>. I would suggest updating this doc and this one which are misleading about it.

  • Hello, my apologies for the late reply. 

    AdBee said:
    The correct way to import it is to call #include <nrf_model_at.h>. I would suggest updating this doc and this one which are misleading about it.

    Yes, I see what you man, which can be somewhat confusing. The best way is often to look at our samples in our SDK, but of course the documentation should reflect the code base. I will report internally.

    AdBee said:
    I am trying to interact with the LTE-M/GNSS module by using AT-commands.

    Have you successfully been able to send AT commands programmatically? 

    AdBee said:

    Does the existence of the later file means that pm_static files are not used by default, but only if configs such as CONFIG_THINGY91_STATIC_PARTITIONS_FACTORY are provided ?

    The build system should pick up on the file automatically. Have a look at Configuring static partitions in the partition manager. This is a KConfig symbol defined in nrf/boards/nordic/thingy91/Kconfig

    Kind regards,
    Øyvind

  • Yes, I see what you man, which can be somewhat confusing. The best way is often to look at our samples in our SDK, but of course the documentation should reflect the code base. I will report internally.

    I don't think there is a sample to demonstrate this functionnality, or at least I didn't find it.

    Have you successfully been able to send AT commands programmatically? 

    Yes with the nrf_modem_at_printf() function and the correct include it appears to work.

    The only remaining question I have is about the absence of early logs. I assume it is because the hook that redirects outputs from the nRF9160 to the nRF52840 serial is set after some delay rather than at program start. Correct ?

    Thank you for your support,

    AdBee