AT Monitor always prints AT responses to logging UART

Hello,

To preface:

  • nRF Connect SDK 2.9.0
  • nRF9151 DK
  • Windows 11 PC

I have the following defined in my prj.conf file:

CONFIG_MODEM_INFO=y

Such that I can use modem_info_string_get() and similar functions to query information from the modem.
My issue is that I see AT command responses printed to my terminal regardless of whether I have logging enabled or not:
*** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
+CGEV: EXCE STATUS 0
+CEREG: 2,"7B2F","0126020C",7
%MDMEV: PRACH CE-LEVEL 0
+CSCON: 1
+CGEV: ME PDN ACT 0
%MDMEV: SEARCH STATUS 2
+CEREG: 1,"7B2F","0126020C",7,,,"11100000","11100000"
%XTIME: "69","52301112748569","01"
+CGEV: IPV6 0
+CSCON: 0

After a bit of investigation, I see them printing in the following function within at_host.c:

static inline void write_uart_string(const char *str)
{
	if (IS_ENABLED(CONFIG_LOG_BACKEND_UART)) {
		LOG_RAW("%s", str);
		return;
	}

	/* Send characters until, but not including, null */
	for (size_t i = 0; str[i]; i++) {
		uart_poll_out(uart_dev, str[i]);
	}
}

CONFIG_MODEM_INFO 'selects' CONFIG_AT_MONITOR:

https://docs.nordicsemi.com/bundle/ncs-latest/page/kconfig/index.html#CONFIG_MODEM_INFO

This seems wasteful to print these to the UART if I don't need this functionality. In addition, I need full control as to what goes out the UART. Setting CONFIG_LOG=n disables all logging except these AT responses. Setting CONFIG_LOG=y and CONFIG_AT_MONITOR_LOG_LEVEL_OFF=y and CONFIG_AT_HOST_LOG_LEVEL_OFF=y still doesn't disable logging of these AT responses.

Question: How do I disable the printing of these raw AT responses to the UART, regardless if logging is enabled or not?

It appears that LOG_RAW() ignores the logging level.

Thanks,

Derek

Parents Reply Children
  • Hey Dejan,

    Thanks for the info! CONFIG_AT_HOST_LIBRARY=y was set in my board configuration file (boards/nrf9151dk_nrf9151_ns.conf) as part of the https_client example. Setting this to 'n' removed the AT responses, so this works! I thought this was required to be enabled for this example because it was in the board configuration file by default. Now I know.

    I didn't realize the AT Host library gave you direct access to the modem's AT command interface via UART. When I type into my terminal, I never see any characters echoed, so I had no idea this was even enabled.

    Other modems I have worked with will echo characters I type on their AT interface and you must disable echo with the "ATE0" command. It seems with the Nordic modem that echo is disabled by default.

    Question: Can I enable echo on the modem's AT interface via the AT Host library?

    Thanks,

    Derek

Related