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

How to disable +CEREG notifications

Hi,

I've got an application based off the asset tracker firmware that needs a UART. From the many threads on the topic, I've found a way to shut down the UARTs to save power but I cannot shut down the console UART since the +CEREG notifications are coming in periodially.

If a notification comes in with the console UART_0 shut off, the application crashes.

In my application prj.conf I've got:

# UART 2 
CONFIG_SERIAL=y
CONFIG_UART_NRFX=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_2_NRF_UARTE=y

# Console
CONFIG_STDOUT_CONSOLE=n
CONFIG_LOG=n
CONFIG_BOOT_BANNER=n
CONFIG_PRINTK=n
#CONFIG_CONSOLE_SUBSYS=y
#CONFIG_CONSOLE_HANDLER=y
#CONFIG_CONSOLE_GETCHAR=y

# LOG config:
CONFIG_LOG=n
CONFIG_LOG_IMMEDIATE=n
CCONFIG_AWS_FOTA_LOG_LEVEL=0
CONFIG_AWS_JOBS_LOG_LEVEL=0
CONFIG_LTE_LINK_CONTROL_LOG_LEVEL=0
CONFIG_AT_NOTIF_LOG_LEVEL=0
CONFIG_NRF_CLOUD_LOG_LEVEL=0
CONFIG_NRF9160_GPS_LOG_LEVEL=0
CONFIG_MODEM_INFO=n

# Modem info
#CONFIG_MODEM_INFO=y

And my SPM prj.conf is:

CONFIG_IS_SPM=y
CONFIG_FW_INFO=y
CONFIG_GPIO=n
CONFIG_STDOUT_CONSOLE=n
CONFIG_LOG=n
CONFIG_BOOT_BANNER=n
CONFIG_PRINTK=n

To shut the UARTs down, I'm calling these disable functions:

//  nrf_uarte_disable(NRF_UARTE0);
    nrf_uarte_disable(NRF_UARTE2);
    
    
    

Note: this other suggested method from older threads didn't lower the sleep power consumption. It was still at 1.5mA:

// Start the UART (stopped for reduced power consumption)
	NRF_UARTE1_NS->ENABLE = 8;
	NRF_UARTE1_NS->TASKS_STARTTX = 1;
	NRF_UARTE1_NS->TASKS_STARTRX = 1; 
	
<use uart>
	
// Stop the UART for reduced power consumption  
	NRF_UARTE1_NS->TASKS_STOPRX = 1;
	NRF_UARTE1_NS->TASKS_STOPTX = 1; 
	NRF_UARTE1_NS->ENABLE = 0;	

What else can I do to disable all console output so I can safely turn off UART_0?

Thanks,

Tim

Parents Reply Children
  • Hello Heidi,

    I added "CONFIG_AT_HOST_LIBRARY=n" to prj.config, reloaded/rebuilt the project, and still get the +CEREG notifications at start up:

    This seems to confirm that they're not coming from the AT_HOST library, in addition to the printk or console/log routes. Is there something in the modem firmware that is sending these?

    Thanks,

    Tim

  • Something compressed the screenshot in my above reply. Here's a repost that will hopefully be more legible.

    Thanks,

    Tim

  • In further testing today, I observed two additional +CEREG notifications after the two that occur at startup. It appears they were triggered by the Cell ID changing. I'm testing in a static setting, on a bench. If this is triggered by every tower change, it could really cause an issue if UART_0 is disabled. Here's the log with the timestamp data:

    2020-01-29T22:52:12.161Z DEBUG modem << ***** Booting Zephyr OS build v2.0.99-ncs1 *****\x0D\x0A
    2020-01-29T22:52:12.168Z DEBUG modem << [00:00:00.005,035] \x1B[0m<inf> mcuboot: Starting bootloader\x1B[0m\x0D\x0A
    2020-01-29T22:52:12.176Z DEBUG modem << [00:00:00.013,427] \x1B[0m<inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x1\x1B[0m\x0D\x0A
    2020-01-29T22:52:12.186Z DEBUG modem << [00:00:00.026,580] \x1B[0m<inf> mcuboot: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3\x1B[0m\x0D\x0A
    2020-01-29T22:52:12.192Z DEBUG modem << [00:00:00.039,062] \x1B[0m<inf> mcuboot: Boot source: primary slot\x1B[0m\x0D\x0A
    2020-01-29T22:52:12.199Z DEBUG modem << [00:00:00.050,384] \x1B[0m<inf> mcuboot: Swap type: none\x1B[0m\x0D
    2020-01-29T22:52:12.543Z DEBUG modem << [00:00:00.500,915] \x1B[0m<inf> mcuboot: Bootloader chainload address offset: 0xc000\x1B[0m\x0D\x0A
    2020-01-29T22:52:12.549Z DEBUG modem << [00:00:00.510,955] \x1B[0m<inf> mcuboot: Jumping to the first image slot\x1B[0m\x0D
    2020-01-29T22:52:14.662Z DEBUG modem << +CEREG: 2,"C00C","02F00103",7,0,0,"11100000","11100000"\x0D\x0A
    2020-01-29T22:52:15.733Z DEBUG modem << +CEREG: 1,"C00C","02F00103",7,,,"11100000","00100110"\x0D\x0A
    2020-01-29T22:53:32.758Z DEBUG modem << +CEREG: 1,"C00C","02EE9002",7,,,"11100000","00100110"\x0D\x0A
    2020-01-29T22:54:43.141Z DEBUG modem << +CEREG: 1,"C00C","02F00103",7,,,"11100000","00100110"\x0D
    

    And, here's the current state of my logging/serial related prj.conf settings:

    CONFIG_SERIAL=y
    CONFIG_UART_NRFX=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_UART_2_NRF_UARTE=y
    
    # Console
    CONFIG_STDOUT_CONSOLE=n
    CONFIG_BOOT_BANNER=n
    CONFIG_PRINTK=n
    #CONFIG_CONSOLE_SUBSYS=y
    #CONFIG_CONSOLE_HANDLER=y
    #CONFIG_CONSOLE_GETCHAR=y
    
    # LOG config:
    CONFIG_LOG=n
    CONFIG_LOG_IMMEDIATE=n
    CONFIG_AWS_FOTA_LOG_LEVEL_DBG=n		
    CONFIG_AWS_JOBS_LOG_LEVEL_DBG=n		
    CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=n		
    CONFIG_AT_NOTIF_LOG_LEVEL_DBG=n		
    CONFIG_NRF_CLOUD_LOG_LEVEL_DBG=n	
    CONFIG_NRF9160_GPS_LOG_LEVEL_DBG=n	
    CONFIG_MODEM_INFO=n
    CONFIG_NET_LOG=n
    CONFIG_MQTT_LOG_LEVEL_DBG=n
    CONFIG_AT_HOST_LIBRARY=n

    Thanks,

    Tim

  • Hi again, Tim. 

    After some digging, we found it. It is coming from the at_host library. In at_host.c, in response_handler there is the line 

    write_uart_string(response);

    which is writing these +CEREG updates. 

    But in the asset_tracker sample, to disable the AT Host library, you need to use the USE_AT_HOST config, which is found in the Kconfig file. 

    Best regards,

    Heidi

  • Thanks Heidi -- that did it!

    We wrapped the "write_uart_string():" function with #ifdefs to enable it only if logging or printk are enabled and it supresses the +CEREG notifications properly now.

    Tim

Related