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

nrf9160 uart Pull-Up and power consumption

hi all,

i'm trying to disable uart for lower power consumption, i've disables it with:

NRF_UARTE1->TASKS_STOPTX = 1;
NRF_UARTE1->TASKS_STOPRX = 1;


but when i measure the voltage on the rx pin i see 1.8V  (this seems to consume current on the device on the other side of the uart interface - which is turned off )
i assume its in pulled up state, so i'm trying to change it's state to no-pull:
nrf_uarte_txrx_pins_disconnect(NRF_UARTE0);
gpio_pin_configure(uart_wifi, 18, GPIO_PUD_PULL_DOWN);
gpio_pin_configure(uart_wifi, 19, GPIO_PUD_PULL_DOWN);
gpio_pin_write(uart_wifi, 18,0);
gpio_pin_write(uart_wifi, 19,0);

 but it doesnt seem to have any effect.

how can i set this pin to 0, and back to 1 when I need it , on runtime?

Thanks

Moshe

Parents
  • Hi Moshe, 

    Is the external IC power gated? It should drive the RX line to 'high' when it's inactive and powered. So that may explain why you see the current draw when you set the output to 0. 

    Also, from your code snippets, it appears that you are stopping UART instance 1 while nrf_uarte_txrx_pins_disconnect() call takes instance 0 as an argument. Not sure if this is intended or not.

    Best regards,

    Vidar

  • Hi Vidar,

    Thanks for your answer, 

    1. I called `nrf_uarte_txrx_pins_disconnect()` on both UARTs (didnt copy it into the snippet).

    2. I test this while the external IC is powered off  (it is gated ) . 

    3. Just to be clear, even when I  disable UART from the SW, I still measure 1.8v on the TX pin . I guess it is still pulled up . 

    Thanks and BR

  • Hi,

     

    When the UART is disabled, the RXD is left as an input, and TXD is left as an output (with high level).

    This is the routine that I have tested your scenario with:

    #include <zephyr.h>
    #include <misc/printk.h>
    #include <uart.h>
    
    #define TXD_PIN 19
    
    static u8_t uart_buf[1024];
    
    void uart_cb(struct device *x)
    {
    	uart_irq_update(x);
    	int data_length = 0;
    
    	if (uart_irq_rx_ready(x)) {
    		data_length = uart_fifo_read(x, uart_buf, sizeof(uart_buf));
    		uart_buf[data_length] = 0;
    	}
    	printk("%s", uart_buf);
    }
    
    void main(void)
    {
    	struct device *uart = device_get_binding("UART_1");
    
    	uart_irq_callback_set(uart, uart_cb);
    	uart_irq_rx_enable(uart);
    	printk("UART loopback start!\n");
    	while (1) {
    		static u32_t wakeup_cnt;		
    		k_cpu_idle();
    		wakeup_cnt++;
    		if (wakeup_cnt > 40) {
    			wakeup_cnt = 0;
    			NRF_UARTE1->TASKS_STOPRX=1;
    			while(NRF_UARTE1->EVENTS_RXTO == 0);
    			NRF_UARTE1->EVENTS_RXTO = 0;
    
    			NRF_UARTE1->TASKS_STOPTX = 1;
    			while(NRF_UARTE1->EVENTS_TXSTOPPED == 0);
    			NRF_UARTE1->EVENTS_TXSTOPPED = 0;
    			
    			NRF_UARTE1->ENABLE = 0;
    			NRF_UARTE1->PSEL.TXD = 0xFFFFFFFF;
    			NRF_P0_NS->OUTCLR = (1 << TXD_PIN);
    		}
    	}
    }
    

     

    This code assumes that I loopback UART0:TXD to UART1:RXD, and when it has gotten 40 chars, it disconnects the UART1 interface completely.

    If I do not clear the GPIO, it is held high. When I run NRF_P0_NS->OUTCLR = 1<<19;, the pin goes low again after disconnecting it from the UARTE1 peripheral.

    Could you try this and see if that works at your end?

     

    Kind regards,

    Håkon

  • Hi,

    Could this be in any way interfering with low power (PSM) mode ? 

    although the pin is now down,  the current draw is 2.5ma. 

  • Hi, 

    just to be clearer:

    1. the pin is actually pulled down right now.

    2. working in power optimmization mode (PSM), Nordic now consumes 2.5ma  (not on Vio).

    3. before applying what suggested here, nordic consumed 70ua on power optimization mode.

  • Hi,

     

    This should not affect the PSM mode, but it might affect the application in terms of sleep routines.

    Is there anything specific that happens when you have disabled the UART? Are you able to see if the nRF9160 is awoken from sleep by anything unpredictable?

     

    Kind regards,

    Håkon

Reply Children
Related