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

from system on to system off

I am using the nRF5_SDK_11.0.0.

I want to state of the system off sleep after entering system on sleep.

For example, from the state of system on sleep, it becomes system off sleep after 5 seconds.

However, it did not escape from the state of system on sleep with the __SEV();__WFE(); __WFE();.

Could you give me some advice? main.c

Parents
  • I tried to use the RTC. The following is the code.

    void rtc_config1(void)
    
    {
    
      NRF_RTC1->TASKS_STOP = 1;	// Stop timer
    
      NRF_RTC1->PRESCALER = 4;	// 1us resolution
    
      NRF_RTC1->TASKS_CLEAR = 1; // Clear timer
    
      NRF_RTC1->CC[1] = TRIGGER_INTERVAL1 * 5000; 
    
      NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE1_Enabled << RTC_INTENSET_COMPARE1_Pos; 
    
      //attachInterrupt(RTC1_IRQn, RTC1_Interrupt);    // also used in variant.cpp to configure the RTC1 
    
      NVIC_EnableIRQ(RTC1_IRQn);
    
    NRF_RTC1->TASKS_START = 1;	// Start TIMER
    
    }
    
    void RTC1_IRQHandler(void)
    
    {
    
      if (NRF_RTC1->EVENTS_COMPARE[1] != 0)
    
      {
    
    NRF_POWER->SYSTEMOFF = 1;
    
    NRF_RTC1->EVENTS_COMPARE[1] = 0;
    		
      }
    
    }
    

    However, interruption is not performed. Could you give me some advice?

Reply
  • I tried to use the RTC. The following is the code.

    void rtc_config1(void)
    
    {
    
      NRF_RTC1->TASKS_STOP = 1;	// Stop timer
    
      NRF_RTC1->PRESCALER = 4;	// 1us resolution
    
      NRF_RTC1->TASKS_CLEAR = 1; // Clear timer
    
      NRF_RTC1->CC[1] = TRIGGER_INTERVAL1 * 5000; 
    
      NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE1_Enabled << RTC_INTENSET_COMPARE1_Pos; 
    
      //attachInterrupt(RTC1_IRQn, RTC1_Interrupt);    // also used in variant.cpp to configure the RTC1 
    
      NVIC_EnableIRQ(RTC1_IRQn);
    
    NRF_RTC1->TASKS_START = 1;	// Start TIMER
    
    }
    
    void RTC1_IRQHandler(void)
    
    {
    
      if (NRF_RTC1->EVENTS_COMPARE[1] != 0)
    
      {
    
    NRF_POWER->SYSTEMOFF = 1;
    
    NRF_RTC1->EVENTS_COMPARE[1] = 0;
    		
      }
    
    }
    

    However, interruption is not performed. Could you give me some advice?

Children
No Data
Related