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

sleep w memory rentention problem

hi,

i'm not able to have the nRF24LE1 go to sleep. I'm using the example at the link below, to which I've added code for UART and ADC usage. Is there a way to end the UART (the opposite of the hal_uart_init() function)?

I need the LE1 to wake up, take an analog reading, write it to the UART, then go to sleep for x seconds. I'd like it to sleep for 10 seconds but it seems 2 is the maximum I can get with this MUP.

code example:

www.nordicsemi.com/.../How-to-setup-memory-retention-timers-on-on-the-nRF24LE1

In the example, what do these lines do?

IEN1 = 0x20; EA = 1;

// Go to standby mode and wait for RTC interrupt

PWRDWN = 0x07; // Clear power down

PWRDWN = 0x00;

Thanks!

Mahesh

Parents
  • Hi,

    These two lines will enable the RTC interrupt.

    IEN1 = 0x20;

    EA = 1;

    These two lines is a bit more magic.

    PWRDWN = 0x07; // Clear power down

    PWRDWN = 0x00;

    The first line will put the chip in standby mode, while the second line will put the chip in low power mode. The reason for the first line is that the MCU will actually wakeup 1.5ms prior to the RTC interrupt, the reason for this is to startup the 16MHz crystal so it is running by the time the actual RTC interrupt occurs. A >1.5ms delay would have the same effect, but with higher power consumption. The reason the 16MHz crystal is started is to ensure the radio can be used when the RTC interrupt occurs.

    To disable the UART when not in use you can clear the REN0 bit in S0CON register.

    Best regards,

    Kenneth

Reply
  • Hi,

    These two lines will enable the RTC interrupt.

    IEN1 = 0x20;

    EA = 1;

    These two lines is a bit more magic.

    PWRDWN = 0x07; // Clear power down

    PWRDWN = 0x00;

    The first line will put the chip in standby mode, while the second line will put the chip in low power mode. The reason for the first line is that the MCU will actually wakeup 1.5ms prior to the RTC interrupt, the reason for this is to startup the 16MHz crystal so it is running by the time the actual RTC interrupt occurs. A >1.5ms delay would have the same effect, but with higher power consumption. The reason the 16MHz crystal is started is to ensure the radio can be used when the RTC interrupt occurs.

    To disable the UART when not in use you can clear the REN0 bit in S0CON register.

    Best regards,

    Kenneth

Children
No Data
Related