Thingy 91 nRF9160 printing messages to console

I have ordered Thingy 91 in order to practise with nRF9160.

Some important information:

I am using:

  1. Thingy 91
  2. Segger J-Link programmer to program nRF9160 and nRF52840 on the Thingy 91
  3. NCS v2.5.0

When I want to flash the nRF9160, I just put the SW2 in the nRF91 position and flash it with segger J-Link via vscode.

When I want to flash the nRF52840, I just put the SW2 in the nRF52840 position and flash it with segger J-Link via vscode.


About my project:
I am aware  that the Thingy 91 comes with a preflashed Asset tracker v2 application. In my case, I am not interested in none of that. I have reflashed the nRF52840 with connectivity bridge application and reflashed the nRF9160 with simple "hello world" application. I have just modified it slightly to print hello world in an infinite loop. The first thing I want to test is if I am able to see the printk messages on the console as that is always the first thing I setup when working on a project.

void main(void)
{	
	while (1) {
        k_msleep(1000);
		printk("Hello world\n");
	}
}

Problem:

After I power the device, I can see 2 Serial ports appear. That is expected for the Connectivity Bridge application. I have opened both serial ports via serial terminal but I am not able to see any logs. I was under the impression that Conncetivity bridge application running on nRF52840 should forward all the printk messages of the nRF9160 device to one of the serial ports that appeared. Is that not the case?

I have also tried to monitor of messages from the nRF9160 (hello world) are printing on the RTT but that is also not the case:

I have also checked the following video:

https://www.youtube.com/watch?v=0xl45L2tdcc&ab_channel=drselim

On the video above, a guy just programs a simple program to nRF9160 and he is able to see the serial messages on the serial console. The only thing that is not fully clear - what is running on the nRF52840?

I have also looked at hardware files (schematic) of the Thingy 91 and could not find anything regarding UART.

I would appreciate if someone could help me understand how to get any printk messages to show from nRF9160 and whether I need to use special firmware on nRF52840 to get this to work because connectivity bridge does not seem to work. If there is anything else you would like me to clarify, feel free to ask! Thanks in advance.

Parents
  • The messages in the RTT logger seems to indicate, that the "SWD selecting switch" selects the nRF52. (That's the small black switch between the usb and 10 pin swd, see Thingy:91 - Programming and debugging interface.)

    With that, your JLINK flashs the nRF52840 of the thingy. Please flash the Connectivity bridge you find in the thingy91_fw_2023-10-26_1fae141f.zip (thingy91_fw_2023-10-26_1fae141f/img_app_bl/thingy91_nrf52_connectivity_bridge_2023-10-26_1fae141f.hex). The nRF Connect for Desktop / Programmer App may be used for that.

    Afterwards, switch the "SWD selecting switch" to select the nRF91. Then apply your sample and check, what happens.

  • As I have mentioned in my initial post, I have the connectivity bridge application running on the nRF52840 board. I have took it from the latest NCS v.2.5.0 and flashed it to nRF52840 via external programmer (Segger J-Link) using 10 pin SWD.

    See my setup below:



    I have tried to flash it via Programmer but for some reason I am not able to put it in MCUboot mode:

    I am holding the SW3 button pressed while switching ON the Thingy91. After it is turned ON, I release the SW3 but that does not seem to do anything. However, I am able to program the device with the following HEX:
    \thingy91_fw_2023-10-26_1fae141f\img_fota_dfu_hex


    Anyways, I prefer flashing the device using external Segger programmer via 10 pin SWD directly from the VSCode nRF Connect.

    Afterwards, switch the "SWD selecting switch" to select the nRF91. Then apply your sample and check, what happens.

    When selecting the SWD switch to the nRF52 position and monitoring RTT logs:

    When selecting the SWD switch to the nRF91 position and monitoring RTT logs:

    So to summarise everything up:

    1. I have Connectivity Bridge application running on the nRF52840 and simple printk hello world in a loop on the nRF9160. My goal is to be able to forward the nRF9160 over to the console via nRF52840.

Reply
  • As I have mentioned in my initial post, I have the connectivity bridge application running on the nRF52840 board. I have took it from the latest NCS v.2.5.0 and flashed it to nRF52840 via external programmer (Segger J-Link) using 10 pin SWD.

    See my setup below:



    I have tried to flash it via Programmer but for some reason I am not able to put it in MCUboot mode:

    I am holding the SW3 button pressed while switching ON the Thingy91. After it is turned ON, I release the SW3 but that does not seem to do anything. However, I am able to program the device with the following HEX:
    \thingy91_fw_2023-10-26_1fae141f\img_fota_dfu_hex


    Anyways, I prefer flashing the device using external Segger programmer via 10 pin SWD directly from the VSCode nRF Connect.

    Afterwards, switch the "SWD selecting switch" to select the nRF91. Then apply your sample and check, what happens.

    When selecting the SWD switch to the nRF52 position and monitoring RTT logs:

    When selecting the SWD switch to the nRF91 position and monitoring RTT logs:

    So to summarise everything up:

    1. I have Connectivity Bridge application running on the nRF52840 and simple printk hello world in a loop on the nRF9160. My goal is to be able to forward the nRF9160 over to the console via nRF52840.

Children
  • > My goal is to be able to forward the nRF9160 over to the console via nRF52840.

    Sure, and that's what works for the very most I know. Unfortunately I don't know, what you did to break it ;-).

    > As I have mentioned in my initial post, 

    The RTT log, which you mention to show the nRF9160 log , shows the nRF52840 log. Even if you aware of the "SWD select mode", you need to put that in the right position, or?

    > I am holding the SW3 button pressed while switching ON the Thingy91. 

    SW3 => nRF9160

    SW4 => nRF52840

    Anyway, if the JLINK works that's a good first step. (it would also do with the Programmer app, just select the JLINK not the Thingy.)

    So, according your comment, you now have the "Connectivity Bridge application running on the nRF52840 ". That's perfect.

    > and simple printk hello world in a loop on the nRF9160. 

    I guess, you setup a project from the scratch and there is something missing. Though I work from the "other side" (take a working sample and try to reduce it), I have no experience, what went wrong in your case.

    Is that the stuff in krupis/thingy91_learning ? There the prj.conf is empty. I have no experience with the defaults, I prefer to have my settings always in the "prj.conf".  From your nRF52840 training project:

    CONFIG_SERIAL=y
    CONFIG_LOG=y

    Maybe you try that, to see, if the defaults are different?

  •   

    Thank you for your help. While I was replying back to your comment I have realized the stupid mistake I have done. In my nrf9160DK code , I do the following:

    printk("Hello world\n");
    However, in the serial terminal I used the following settings:
    Nottice "Append CR" setting. This setting makes the serial terminal to only print data when it is \r terminated....
    After replacing my initial hello world print with the following:
    printk("Hello world\n\r");
    I can confirm that it works as expected:
    Thank you  :)
Related