how to disable UART0 for low power

I have a custom nRF9160 board running a modified asset_tracker program. I am using UART0 as a command line interface for testing and debugging. I can enter commands to setup and test the hardware. All is working perfectly. When the nRF9160 board is deployed in the field I need to run on batteries and no longer need the command line interface. Is there a simple or preferred way to disable the UART0 in order to reduce the power without making a completely new code base. The lower power is critical to the application.

Parents
  • Hei Timothy, 
    You should be able to turn off UART by 
    CONFIG_SERIAL=n
    You may turn off CONSOLE as well, just in case it's enabled somewhere: 
    CONFIG_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_STDOUT_CONSOLE=n
    CONFIG_PRINTK=n
    CONFIG_EARLY_CONSOLE=n


    If you have MCUBoot enabled, you would need to turn off UART log for MCUBoot as well.  You can add CONFIG_SERIAL=n into mcuboot.conf file in child_image folder. 

  • Hung

    thank you for your quick response. I changed the "CONFIG_SERIAL=y" to "CONFIG_SERIAL=N" and was not able to build. I got the following errors. what else am I missing? 

  • c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: C:\Users\Owner\AppData\Local\Temp\ccpgnr1C.ltrans0.ltrans.o: in function `main':
    C:\Nordic1\test_n160\data_logger_reve_9160\build_no_uart0/../src/jfet_files/jfet_init.c:2120: undefined reference to `__device_dts_ord_115'

  • I assume you set CONFIG_SERIAL=n not CONFIG_SERIAL=N ? 
    Please try disable AT library. 

    CONFIG_AT_HOST_LIBRARY=n

    If that doesn't help, you may want to check what at line 2120 in jfet_init.c. Which library is that ? 

     

  • this is what I get now. I have attached my prj_no_uart0.conf file. I think I am getting close. what am I missing now? I added the #warning so I know  which build I am running.

    line 2129 in jfet_init.c is shown below. It is a call to a display driver.
    It has nothing to do with UART0. I am confused.
    I must be missing something simple. do you need my jfet_init.c file also?

        CreateNexObject(probe2LowAlarm0, probe2LowAlarm0PageID, probe2LowAlarm0ID, "Home.probeAlarmLow2");

    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: C:\Users\Owner\AppData\Local\Temp\cc6wvcL5.ltrans0.ltrans.o: in function `main':
    C:\Nordic1\test_n160\data_logger_reve_9160\build_no_uart0/../src/jfet_files/jfet_init.c:2129: undefined reference to `__device_dts_ord_117'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: C:\Users\Owner\AppData\Local\Temp\cc6wvcL5.ltrans2.ltrans.o: in function `Serial_Write.constprop.0.isra.0':
    C:/Nordic1/v2.5.0/zephyr/include/zephyr/drivers/uart.h:586: undefined reference to `__device_dts_ord_117'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: C:\Users\Owner\AppData\Local\Temp\cc6wvcL5.ltrans2.ltrans.o: in function `sendCommand':
    C:\Nordic1\test_n160\data_logger_reve_9160\build_no_uart0/../src/jfet_files/nextion/Serial.c:107: undefined reference to `__device_dts_ord_117'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    prj_no_uart0.conf

Reply
  • this is what I get now. I have attached my prj_no_uart0.conf file. I think I am getting close. what am I missing now? I added the #warning so I know  which build I am running.

    line 2129 in jfet_init.c is shown below. It is a call to a display driver.
    It has nothing to do with UART0. I am confused.
    I must be missing something simple. do you need my jfet_init.c file also?

        CreateNexObject(probe2LowAlarm0, probe2LowAlarm0PageID, probe2LowAlarm0ID, "Home.probeAlarmLow2");

    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: C:\Users\Owner\AppData\Local\Temp\cc6wvcL5.ltrans0.ltrans.o: in function `main':
    C:\Nordic1\test_n160\data_logger_reve_9160\build_no_uart0/../src/jfet_files/jfet_init.c:2129: undefined reference to `__device_dts_ord_117'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: C:\Users\Owner\AppData\Local\Temp\cc6wvcL5.ltrans2.ltrans.o: in function `Serial_Write.constprop.0.isra.0':
    C:/Nordic1/v2.5.0/zephyr/include/zephyr/drivers/uart.h:586: undefined reference to `__device_dts_ord_117'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: C:\Users\Owner\AppData\Local\Temp\cc6wvcL5.ltrans2.ltrans.o: in function `sendCommand':
    C:\Nordic1\test_n160\data_logger_reve_9160\build_no_uart0/../src/jfet_files/nextion/Serial.c:107: undefined reference to `__device_dts_ord_117'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    prj_no_uart0.conf

Children
Related