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

How to decrease current consumption in sleep at nrf v1.3.0 tag?

I could decrease current consumption at v1.2.0, but couldn't at 1.3.0. 520uA flows in k_cpu_idle(); 

How can you do that?

Also, in v1.3.0, CONFIG_UART_0_NRF_UARTE is depricated. How can you disable UART 0 in prj.conf?

Any tip? Thanks

<environment>
- Windows10
- DK v0.9.0
- modem fw v1.2.0
- nrf v1.3.0
- Segger IDE 4.52

<prj.conf>

# General config
CONFIG_ASSERT=y

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_OFFLOAD=y

# BSD library
CONFIG_BSD_LIBRARY=y

# AT host library
CONFIG_AT_HOST_LIBRARY=n
CONFIG_UART_INTERRUPT_DRIVEN=n

# Stacks and heaps
CONFIG_MAIN_STACK_SIZE=3072
CONFIG_HEAP_MEM_POOL_SIZE=16384

<main.c>

/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
 */

#include <zephyr.h>
#include <stdio.h>
#include <drivers/uart.h>
#include <string.h>

/**@brief Recoverable BSD library error. */
void bsd_recoverable_error_handler(uint32_t err)
{
	printk("bsdlib recoverable error: %u\n", err);
}

void disable_uart0(){
	NRF_UARTE0->TASKS_STOPTX = 1;
	while(NRF_UARTE0->EVENTS_TXSTOPPED == 0);
	NRF_UARTE0->EVENTS_TXSTOPPED = 0;
	
	NRF_UARTE0->TASKS_STOPRX = 1;
	while(NRF_UARTE0->EVENTS_RXTO == 0);
	NRF_UARTE0->EVENTS_RXTO = 0;
	
	NRF_UARTE0->ENABLE = 0;
}

void main(void)
{
    disable_uart0();
    k_cpu_idle();

}

Parents Reply Children
  • sleep_only.zip

    This is a sleep only app. 

    <nrf9160dk_nrf9160ns.overlay>

    &uart0 {
        status = "disabled";
    };
    
    &uart1 {
        status = "disabled";
    };

    <prj.conf>

    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_NATIVE=n
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_SOCKETS_OFFLOAD=y
    
    # BSD library
    CONFIG_BSD_LIBRARY=y
    
    # AT host library
    CONFIG_AT_HOST_LIBRARY=n
    CONFIG_UART_INTERRUPT_DRIVEN=n
    
    # Stacks and heaps
    CONFIG_MAIN_STACK_SIZE=3072
    CONFIG_HEAP_MEM_POOL_SIZE=16384
    
    CONFIG_SERIAL=n
    CONFIG_LOG=n

    <main.c>

    #include <zephyr.h>
    #include <stdio.h>
    #include <drivers/uart.h>
    #include <string.h>
    
    /**@brief Recoverable BSD library error. */
    void bsd_recoverable_error_handler(uint32_t err)
    {
    	printk("bsdlib recoverable error: %u\n", err);
    }
    
    void disable_uart0(){
    	NRF_UARTE0->TASKS_STOPTX = 1;
    	while(NRF_UARTE0->EVENTS_TXSTOPPED == 0);
    	NRF_UARTE0->EVENTS_TXSTOPPED = 0;
    	
    	NRF_UARTE0->TASKS_STOPRX = 1;
    	while(NRF_UARTE0->EVENTS_RXTO == 0);
    	NRF_UARTE0->EVENTS_RXTO = 0;
    	
    	NRF_UARTE0->ENABLE = 0;
    }
    
    void main(void)
    {
        disable_uart0();
        k_cpu_idle();
        // k_sleep(K_SECONDS(60));
    
    }
    

    >And setting it in prj.conf doesn't work either?

    I can't configure UART_0 in prj.conf in v1.3.0. I could do it in v1.2.0.

    In v1.2.0, the current drops to 9uA on DK 0.9.0.

    In v1.3.0, some function killing uart_0 may be added, which I don't know.

    Could you try to reproduce this issue? This is a simple app.

  • I tweaked parameters in nrf9160dk_nrf9160 folder

    I disabled i2c2 and spi3 in overlay file as well as main.c

    However, nothing changed.

  • >You' re right, UARTE0 is enabled while it should be disabled by overlay file.

    This was wrong. UARTE0 was off. I'm sorry

    This works out. I don't add overlay file

    <prj.conf>

    CONFIG_MAIN_STACK_SIZE=3072
    CONFIG_HEAP_MEM_POOL_SIZE=16384
    CONFIG_SERIAL=y
    

    <main.c>
    #include <zephyr.h>
    #include <stdio.h>
    #include <drivers/uart.h>
    #include <string.h>
    
    void disable_uart(){
    	NRF_UARTE0->ENABLE = 0;
        NRF_UARTE1->ENABLE = 0;
    }
    
    void main(void)
    {
    	disable_uart();
    	k_cpu_idle();
    }
    
Related