1. Because RTX uses the RTC1 interrupt, it wakes up frequently and cannot enter the sleep state.
2. Idea: Before entering low power consumption, turn off the power of RTC1, and reconfigure RTC1 after waking up with a button.
pseudocode:
Before entering low power consumption
1. Turn off peripheral GPIO
nrf_gpio_cfg_default(N);
2. Close the serial port
NRF_UART0->ENABLE = 0;
NRF_UART0->POWER = 0;
app_uart_close();
3. Disable RTC1 interrupt
__disable_irq();
NVIC_DisableIRQ(RTC1_IRQn);
NRF_RTC1->POWER = 0; //Stop RTC
__enable_irq();
4. Set key interrupt
KEY_IRQn_INIT();
/*
Content Examples
NRF_GPIO->PIN_CNF[Config_Key1_PORT_PIN] |= (GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos);
NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Msk; //Enable interrupt
NVIC_SetPriority(GPIOTE_IRQn, 1); //Set the interrupt priority to 1
NVIC_EnableIRQ(GPIOTE_IRQn); //Enable general interrupt
*/
5. Go to sleep
sd_app_evt_wait();
Key interrupt function:
void GPIOTE_IRQHandler(void) //GPIOTE interrupt service function
{
unsigned int expected_time;
if (NRF_GPIOTE->EVENTS_PORT != 0)
{
NRF_GPIOTE->EVENTS_PORT = 0; //Interrupt clear
if (NRF_RTC1->POWER == 0)
{
NVIC_EnableIRQ(RTC1_IRQn);
NRF_RTC1->POWER = 1; //Start RTC
NRF_RTC1->EVENTS_TICK = 1; //Start counting
NRF_RTC1->TASKS_START = 1; //Start counting
NRF_RTC1->PRESCALER = 0x20; //Set clock reference 32768 0x20==32
}
if (nrf_gpio_pin_read(Config_Key5_PORT_PIN) == 0) //Check whether it is woken up by this button
{
}
}
}
Previous article:[nrf52832] [s332] Building a development environment and precautions
Next article:[nrf51][nrf52][MCU] ble bluetooth unlimited broadcast continuous broadcast
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- MSP430F6638 MCU interrupt, clock and low power consumption
- How to draw this circuit in dxp
- Raspberry Pi PICO and Firefly Jar
- Today is 520. As boys majoring in science and engineering, how do you surprise your significant other?
- A batch of new Bluetooth speakers are sent for free, and you only need to pay the ten yuan shipping fee
- BearPi HM Nano Introduction
- TI - MCU - MSP430 User Guide
- Class-D amplifier TAS5731M power-on timing analysis
- Award-winning review: Pingtouge RISC-V low-power board - RVB2601
- Wu Hanming: The future semiconductor production capacity gap may be equivalent to 8 SMICs