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

HIGH CONSUMPTION UARTE1

Hello,

I'm using NRF52840 module to make a customer device. This device send message by UART. My device is powered with a battery, for this reason I would like reduce the current consumption due to serial comunication.

 

I'm configuring serial port this way:

 

 

NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uarte1_drv_config,

                      RX_PIN_NUMBER, TX_PIN_NUMBER,

                      RTS_PIN_NUMBER, CTS_PIN_NUMBER,

                      NRF_UART_HWFC_DISABLED, NRF_UART_PARITY_EXCLUDED,

                      NRF_UART_BAUDRATE_115200,

                      UART_DEFAULT_CONFIG_IRQ_PRIORITY);

 

 

#define SERIAL_FIFO_TX_SIZE 1024

#define SERIAL_FIFO_RX_SIZE 1024

 

NRF_SERIAL_QUEUES_DEF(serial1_queues, SERIAL_FIFO_TX_SIZE, SERIAL_FIFO_RX_SIZE);

 

 

#define SERIAL_BUFF_TX_SIZE 1

#define SERIAL_BUFF_RX_SIZE 1

 

NRF_SERIAL_BUFFERS_DEF(serial1_buffs, SERIAL_BUFF_TX_SIZE, SERIAL_BUFF_RX_SIZE);

 

NRF_SERIAL_CONFIG_DEF(serial1_config, NRF_SERIAL_MODE_IRQ,

                      &serial1_queues, &serial1_buffs, rec_uart_handler, sleep_handler);

 

NRF_SERIAL_UART_DEF(serial1_uarte, 1);

 

 

 

What I use is '"nrf_serial_init', and, after reading, then '"nrf_serial_uninit' to close the serial port. I am working in IRQ mode. Before and after the FIRST 'init', the current is lower than 100uA. But after the first 'read' the current is about 1.5mA. And it never goes back to 100uA even if I 'uninit' the serial port.

 

I had tried also: 

 

          NRF_UARTE1->TASKS_STOPRX = 1:

          NRF_UARTE1->TASKS_STOPTX = 1;

          NRF_UARTE1->ENABLE = 0;

 

But with no success.

 

 

Is there any function or macro, to get back to low power (<100uA) after the reading process?

Any help is wellcome. Thank you in advance.

 

 

Thank you!!!

Parents
  • Hi Edward

    The SDK you are using is very old (older than the workaround I proposed), so first of all, I suggest you update to the newest Thread SDK v3.0.0, as I suspect just updating your SDK might be enough to solve the problem for you.

    Best regards,

    Simon

  • Hi Simonr,

    At the end I updated the SDK and now I'm using nRF5 SDK for Thread and Zigbee v3.0.0 but I have the same problem more or less...

    I did three tests using UARTE1 (mode DMA):

    1º  When I write by UARTE1 but never read, the current is 0.3mA

    My code:

               ret = nrf_serial_init(&serial1_uarte, &m_uarte1_drv_config, &serial1_config);
         APP_ERROR_CHECK(ret);


         ret = nrf_serial_write(&serial1_uarte,&tx[2],tx[1],NULL,NRF_SERIAL_MAX_TIMEOUT);

        (void)nrf_serial_flush(&serial1_uarte, 0);


     //   memset(buffer_uartRx,0,sizeof(buffer_uartRx));
     //  while(nrf_serial_read(&serial1_uarte, &buffer_uartRx[tam_buffer_uartRx], 1, NULL, 10)==NRF_SUCCESS)
     //     tam_buffer_uartRx++; 
        nrf_serial_uninit(&serial1_uarte);


      *(volatile uint32_t *)0x40028FFC = 0; // Power down UARTE1
      *(volatile uint32_t *)0x40028FFC;
      *(volatile uint32_t *)0x40028FFC = 1; // Power on UARTE1 so it is ready

    2º When I write and read without power down UARTE1, the current is 2.4mA

    My code:  

       ret = nrf_serial_init(&serial1_uarte, &m_uarte1_drv_config, &serial1_config);
         APP_ERROR_CHECK(ret);


         ret = nrf_serial_write(&serial1_uarte,&tx[2],tx[1],NULL,NRF_SERIAL_MAX_TIMEOUT);

        (void)nrf_serial_flush(&serial1_uarte, 0);


        memset(buffer_uartRx,0,sizeof(buffer_uartRx));
       while(nrf_serial_read(&serial1_uarte, &buffer_uartRx[tam_buffer_uartRx], 1, NULL, 10)==NRF_SUCCESS)
          tam_buffer_uartRx++;
        nrf_serial_uninit(&serial1_uarte);

       THE CURRENT IS 2.4mA

    3º When I write and read with power down UARTE1, the current is 1.7mA

    My code:

               ret = nrf_serial_init(&serial1_uarte, &m_uarte1_drv_config, &serial1_config);
         APP_ERROR_CHECK(ret);


         ret = nrf_serial_write(&serial1_uarte,&tx[2],tx[1],NULL,NRF_SERIAL_MAX_TIMEOUT);

        (void)nrf_serial_flush(&serial1_uarte, 0);


        memset(buffer_uartRx,0,sizeof(buffer_uartRx));
       while(nrf_serial_read(&serial1_uarte, &buffer_uartRx[tam_buffer_uartRx], 1, NULL, aux_tmp)==NRF_SUCCESS)
          tam_buffer_uartRx++; 
        nrf_serial_uninit(&serial1_uarte);


      *(volatile uint32_t *)0x40028FFC = 0; // Power down UARTE1
      *(volatile uint32_t *)0x40028FFC; 
      *(volatile uint32_t *)0x40028FFC = 1; // Power on UARTE1 so it is ready

      THE CURRENT IS 1.7mA

      Also I tried to read only once at the beginning of my program and never read again but the current did'nt go down.   (1.7mA)

     

    So, when initiating the UARTE, writing to it, BUT not reading from it, the current is really low.

    But, just reading a single byte, the current increases more than 1mA. And never goes down again. 

    How can we fix this, in our opinion, erroneous behaviour?

    Any help is wellcome.

    Best regards

     

     

    Thank you!!!

     

Reply
  • Hi Simonr,

    At the end I updated the SDK and now I'm using nRF5 SDK for Thread and Zigbee v3.0.0 but I have the same problem more or less...

    I did three tests using UARTE1 (mode DMA):

    1º  When I write by UARTE1 but never read, the current is 0.3mA

    My code:

               ret = nrf_serial_init(&serial1_uarte, &m_uarte1_drv_config, &serial1_config);
         APP_ERROR_CHECK(ret);


         ret = nrf_serial_write(&serial1_uarte,&tx[2],tx[1],NULL,NRF_SERIAL_MAX_TIMEOUT);

        (void)nrf_serial_flush(&serial1_uarte, 0);


     //   memset(buffer_uartRx,0,sizeof(buffer_uartRx));
     //  while(nrf_serial_read(&serial1_uarte, &buffer_uartRx[tam_buffer_uartRx], 1, NULL, 10)==NRF_SUCCESS)
     //     tam_buffer_uartRx++; 
        nrf_serial_uninit(&serial1_uarte);


      *(volatile uint32_t *)0x40028FFC = 0; // Power down UARTE1
      *(volatile uint32_t *)0x40028FFC;
      *(volatile uint32_t *)0x40028FFC = 1; // Power on UARTE1 so it is ready

    2º When I write and read without power down UARTE1, the current is 2.4mA

    My code:  

       ret = nrf_serial_init(&serial1_uarte, &m_uarte1_drv_config, &serial1_config);
         APP_ERROR_CHECK(ret);


         ret = nrf_serial_write(&serial1_uarte,&tx[2],tx[1],NULL,NRF_SERIAL_MAX_TIMEOUT);

        (void)nrf_serial_flush(&serial1_uarte, 0);


        memset(buffer_uartRx,0,sizeof(buffer_uartRx));
       while(nrf_serial_read(&serial1_uarte, &buffer_uartRx[tam_buffer_uartRx], 1, NULL, 10)==NRF_SUCCESS)
          tam_buffer_uartRx++;
        nrf_serial_uninit(&serial1_uarte);

       THE CURRENT IS 2.4mA

    3º When I write and read with power down UARTE1, the current is 1.7mA

    My code:

               ret = nrf_serial_init(&serial1_uarte, &m_uarte1_drv_config, &serial1_config);
         APP_ERROR_CHECK(ret);


         ret = nrf_serial_write(&serial1_uarte,&tx[2],tx[1],NULL,NRF_SERIAL_MAX_TIMEOUT);

        (void)nrf_serial_flush(&serial1_uarte, 0);


        memset(buffer_uartRx,0,sizeof(buffer_uartRx));
       while(nrf_serial_read(&serial1_uarte, &buffer_uartRx[tam_buffer_uartRx], 1, NULL, aux_tmp)==NRF_SUCCESS)
          tam_buffer_uartRx++; 
        nrf_serial_uninit(&serial1_uarte);


      *(volatile uint32_t *)0x40028FFC = 0; // Power down UARTE1
      *(volatile uint32_t *)0x40028FFC; 
      *(volatile uint32_t *)0x40028FFC = 1; // Power on UARTE1 so it is ready

      THE CURRENT IS 1.7mA

      Also I tried to read only once at the beginning of my program and never read again but the current did'nt go down.   (1.7mA)

     

    So, when initiating the UARTE, writing to it, BUT not reading from it, the current is really low.

    But, just reading a single byte, the current increases more than 1mA. And never goes down again. 

    How can we fix this, in our opinion, erroneous behaviour?

    Any help is wellcome.

    Best regards

     

     

    Thank you!!!

     

Children
No Data
Related