This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Logging

Hi all,

I'm a little blown away by the complexity of logging for this application (its highly likely I'm missing a few key elements to my understanding).

I'm under the impression that by default, the device logs to LTE Link Monitor. I can't seem to get that to happen whatsoever, although my modem is offline if that is important. Furthermore, I've tried following some resources regarding RTT logging with Segger, but to no avail. It seems that whenever I run my project through segger ( Build > Build & Debug), I run into `Unknown function at 0xFFFFFFFE`. I've tried disabling all of the VBM exceptions. If I instead run (Build > Build & Run), I get no output at all from anything, and I'm unable to connect the RTT terminal using the window on the right.

For some samples, my code:

#include <zephyr.h>
#include <logging/log.h>

LOG_MODULE_REGISTER(main);

void main(void)
{
	while (1) {
            LOG_INF("looped loginf");
            k_sleep(K_MSEC(150));
	}
}



My prj.conf

CONFIG_SERIAL=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_MAIN_STACK_SIZE=4096

CONFIG_STDOUT_CONSOLE=y

#CONFIG_GPIO=y

#debug
CONFIG_DEBUG=y
CONFIG_LOG=y

# Segger RTT
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

Is there a comprehensive guide I can follow somewhere to just connect printk to RTT and get logging working?

Overall, I'm trying to upskill and familiarize myself with one of our contractor's work, and logging + trial and error goes a huge way for me in understanding whats going on Slight smile

Thanks in advance, team.

  • Hi,

     

    I took your sample src, and prj.conf, and pasted it into the "hello_world" sample.

    When opening JLinkRTTViewer, it shows the log:

    00> [00:00:15.459,381] <inf> main: looped loginf
    
    00> [00:00:15.609,466] <inf> main: looped loginf
    
    00> [00:00:15.759,552] <inf> main: looped loginf
    
    00> [00:00:15.909,637] <inf> main: looped loginf
    
    00> [00:00:16.059,753] <inf> main: looped loginf
    
    00> [00:00:16.209,838] <inf> main: looped loginf
    
    00> [00:00:16.359,924] <inf> main: looped loginf
    
    00> [00:00:16.510,009] <inf> main: looped loginf
    
    00> [00:00:16.660,095] <inf> main: looped loginf
    
    00> [00:00:16.810,180] <inf> main: looped loginf

    I run into `Unknown function at 0xFFFFFFFE`.

    Could you try to erase the device, then program it again? This can be done via "nrfjprog -e -f nrf91" from the command line.

    I'm under the impression that by default, the device logs to LTE Link Monitor.

     This is true for UART devices, but there's currently no RTT support, unfortunately. For RTT, you have to use JLink RTT Viewer.

    This is my configuration when opening the session:

     

    Could you try this and see if it runs?

      

    Kind regards,

    Håkon

  • Hi Håkon,

    I've erased the nrf91 using the nRF Connect programmer. I'm able to establish a connection using JLink RTT Viewer with the same connection settings as you, but the unknown function error remains.

    If the command line part is important, could you clarify that a little? nrfjprog isn't defined in Bash/PowerShell/CMD (windows). I've seen where it is in the west_commands folder, but attempting to run it with python doesn't succeed either.

    I'll try running it in the hello world sample like you have next and see if theres something else going on.

    Thanks!

  • To provide a little more insight, the "Unknown function" error occurs when I click the green play button in Segger after running Build & Run.

    Regardless, nothing shows in the RTT Viewer.

  • Hi,

     

    I suspect this is because SES-NordicEdition flashes only the application, while you actually have a multi-image setup, where you should download the merged.hex file.

    You can specify the file under "Target -> Download file".

    Or you can use the Programmer application in nrf for desktop to program the merged.hex manually.

    A third option: you can use nrfjprog, which you can install from the nRF command line tools:

    https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download

    path/to/nrfjprog --program <merged.hex location> -f nrf91 --sectorerase

     

    Could you try this and see if you get any output in RTT viewer?

     

    Kind regards,

    Håkon

  • Hi Håkon,

    Ok, I think I'm missing something here.




    I'm pretty sure I'm entirely missing a whole bunch of stuff in here. I'm not sure where this merged.hex file comes from, or what I'm supposed to do in "Target -> Download File". The prompt opened is expecting me to give it a hex file, but I have no idea where from.

    I followed a bunch of guides a while back, and I have no idea what I've removed/added/changed.

    Sorry to be so difficult, I'm just really struggling to understand.

    Thanks

Related