How do I power off the UART

I have a nRF9160 board that is running off batteries. I need to conserve power and I would like to power off the UART. In the field I do not need any printouts or listening to keystrokes. How do I completely power off the UART? There will not be a terminal connected in the field. The terminal would only be used at the factory for configuring the boards and saving the configuration to Flash.

Parents
  • Hi Timothy

    I agree with the suggestions from Achim. 

    For further reading this blog has a lot of good input on power management in general. It is targeted for nRF5340 designs specifically, but a lot of the information in the blog will be relevant for other devices as well. 

    Best regards
    Torbjørn

  • Achim

    if I put this at the start of main

    void main(void)
    {
    int err;

    #if 1
    /*Option 3: by chosen node*/
    #define MY_SERIAL DT_CHOSEN(zephyr_console)
    const struct device *uart_dev = device_get_binding(DT_LABEL(MY_SERIAL));
    pm_device_state_set(uart_dev,PM_DEVICE_STATE_OFF);
    #endif
    LOG_INF("asset_tracker AWS V2 WSSC Started");

    *******************************

    I get the following repeated. I am not able to upgrade to a later version. There is a lot of customer and device driver code that would have to be ported.. so a lot of the printout is disabled but it is not running my program. it is just continually rebooting.

    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    I: Starting bootloadert image slot
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    I: Starting bootloadert image slot
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none

Reply
  • Achim

    if I put this at the start of main

    void main(void)
    {
    int err;

    #if 1
    /*Option 3: by chosen node*/
    #define MY_SERIAL DT_CHOSEN(zephyr_console)
    const struct device *uart_dev = device_get_binding(DT_LABEL(MY_SERIAL));
    pm_device_state_set(uart_dev,PM_DEVICE_STATE_OFF);
    #endif
    LOG_INF("asset_tracker AWS V2 WSSC Started");

    *******************************

    I get the following repeated. I am not able to upgrade to a later version. There is a lot of customer and device driver code that would have to be ported.. so a lot of the printout is disabled but it is not running my program. it is just continually rebooting.

    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    I: Starting bootloadert image slot
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    I: Starting bootloadert image slot
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none

Children
Related