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 Reply Children
  • 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

  • Hi, 

    Please provide the jfet_init.c file. Could you point me to where you get the library  ? (if it's public)

    You can see in the log it has /jfet_files/nextion/Serial.c:107. So there must be something to do with UART. You may want to look into the library and check how to turn any serial related off. 

    Another option to turn of UART is to dynamically turn it off. Have a look here: 
    How do I power off the UART

    By coincident the OP also had an issue with the jfet library. 

  • Hung

    I tried to use the second method in the example you gave but I get.

    fatal error: power_manager.h: No such file or directory

    the example is 2 years old. so how do I disable the power dynamically in V2.5.0

    the Serial.c file uses UART2. it has nothing to do with UART0.

    I have attached the jfet_init.c.

    jfet_init.c

  • Hi Timothy, 

    I didn't know that you use multiple UARTs in your code. When setting CONFIG_SERIAL=n all UARTs will be disabled so if you want to only disable UART0 when enable UART1 you will have to do approach #2. 


    From what I can see in your jfet_init.c code you did use UART0: 

    const struct device *const uart0_dev = DEVICE_DT_GET(UART0_DEV_NODE);

    You may want to consider remove those code. 


    And if you use UART1 actively don't think you can reduce a lot of power by disabling UART0. 

  • Hung

    I was able to disable UART0 dynamically using method 2 with no change in the code. I will test this for power levels and disable UART2 also if needed at the customer site.

Related