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

nRF24LE1-32 deep sleep mode high current around 10-20uA.How to get the typical current 0.5uA on deep sleep mode?

Hello,

        I use the nRF24LE1-32 develop a product. It has strict requirements for low power consumption.Now I get 10-20uA current on deep sleep mode referring to the article "nRF24LE1 deep sleep high current".But it still can't satisfy our requirements.So,I need you guys's help to achieve the 0.5uA current  on deep sleep mode.Look forward to your reply!My code is as follows:

#include <stdio.h> 
#include <reg24le1.h>
#include <stdint.h>
#include <stdbool.h>
#include "config.h"
#include "hal_nrf.h"
#include "hal_nrf_hw.h"
#include "hal_clk.h"
#include "hal_delay.h"
#include "hal_rtc.h"
#include "hal_uart.h"
#include "hal_adc.h"
#include "hal_wdog.h"
#include "hal_flash.h"
#include "HAL_FLASH_HW.h"
#include "hal_rng.h"

#define  MAX_TX_PAYLOAD                  17      
#define  RF_CHANNEL        10    
#define  RX_PAYLOAD_LEN    18    
xdata uint8_t  rx_payload[32];
xdata uint8_t  TxPayload[32]={0};
xdata bool  radio_busy;
uint8_t RF_Recv_Flag;
uint16_t PipeAndLen;

void IOInit(void)
{ 
        uint8_t i;
        for(i=0;i<8;i++)
        {
                P0CON=0x70+i;
                P1CON=0x70+i;
                P2CON=0x70+i;
                P3CON=0x70+i;
        }
        P0DIR &= ~0xA4;           //P0.2,P0.5,P0.7,output
   
        P1DIR |= 0x35;     //P10,P12,P14,P15:input
        P0CON=0x00+2;
        P0CON=0x00+5;
        P0CON=0x00+7;
        P1CON=0x10+0;
        P1CON=0x10+2;
        P1CON=0x10+4;
        P1CON=0x10+5;
        
        OPMCON=0x00;

}

void uart_init(uint16_t baud)
{        
  S0CON = 0x50;     //8bit UART
  PCON |= 0x80;                 // SMOD = 1
  ADCON |= 0x80;    //         

  S0RELL = (uint8_t)baud;  //
  S0RELH = (uint8_t)(baud >> 8);
}

void mcu_init(void)
{
        hal_rtc_start(false); 
  hal_clklf_set_source(HAL_CLKLF_RCOSC32K);   
        hal_rtc_set_compare_mode(HAL_RTC_COMPARE_MODE_0);   // Use 32 KHz timer mode 0
        //set_timer_period(TAG_TIME);                                // Set the RTC2 time,card sleep time
        //hal_clk_set_16m_source(HAL_CLK_XOSC16M);  //
        hal_clk_regret_xosc16m_on(false);         //
  hal_rtc_start(true);              
  while((CLKLFCTRL&0x80)==0x80);                 
  while((CLKLFCTRL&0x80)!=0x80);
}

void SetWakeUpPin(void)
{
  OPMCON=0x00;               /* open latch,High level wake up*/ 
  WUOPC0=0x00;              
  WUOPC1=0x04;               /* set to P12    */
  
  P1DIR|=0x04;               /* set P12 input      */
  P12   =0;                              
}

void RfCofig(void)
{
  RFCKEN = 1;             //enable RF clock
        
  hal_nrf_close_pipe(HAL_NRF_ALL);          
        hal_nrf_open_pipe(HAL_NRF_PIPE0,false);           
        
        hal_nrf_set_operation_mode(HAL_NRF_PRX);        
  hal_nrf_set_rf_channel(RF_CHANNEL);                   
  hal_nrf_set_datarate(HAL_NRF_250KBPS);          
  hal_nrf_set_output_power(HAL_NRF_0DBM);         
  hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT);      
  hal_nrf_set_rx_payload_width(HAL_NRF_PIPE0, RX_PAYLOAD_LEN); 
  hal_nrf_set_power_mode(HAL_NRF_PWR_UP);            
  
        RF = 1;      
  EA = 1;             
        
        CE_HIGH(); 
}

void RF_SendDat(void)
{
        CE_LOW();
        hal_nrf_set_operation_mode(HAL_NRF_PTX);  
        hal_nrf_write_tx_payload(TxPayload,MAX_TX_PAYLOAD); 
        CE_PULSE();                   
  radio_busy = true;    
  while(radio_busy);
        hal_nrf_set_operation_mode(HAL_NRF_PRX);  
        CE_HIGH();
}

void main()
{                        
        IOInit();  
  SetWakeUpPin(); 
  mcu_init();
  hal_uart_init(UART_BAUD_57K6);                 
  while(hal_clk_get_16m_source() != HAL_CLK_XOSC16M);                  
        while(1)
        {                
                        RfCofig();
                        RF_SendDat();
                        hal_nrf_set_power_mode(HAL_NRF_PWR_DOWN);
                        OPMCON|=0x02;
                  PWRDWN = 0x01; 
        }
}

void rf_irq() interrupt INTERRUPT_RFIRQ
{
  uint8_t irq_flags;
   
  irq_flags = hal_nrf_get_clear_irq_flags();//
  
 
        
        if(irq_flags & (1<<HAL_NRF_RX_DR)) //
   {
      while(!hal_nrf_rx_fifo_empty()) //
      {
         PipeAndLen = hal_nrf_read_rx_payload(rx_payload);
      }
                        hal_nrf_flush_rx();
             RF_Recv_Flag = 1;  //
   } 
         if(irq_flags & ((1<<HAL_NRF_TX_DS)))                                 //transimmter finish 
  {
    radio_busy = false;                        
  }

  if(irq_flags & ((1<<HAL_NRF_MAX_RT)))                                 //re-transimmter
  {
    radio_busy = false;
    hal_nrf_flush_tx();
  }
}

Parents Reply Children
No Data
Related