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

some question of nrf51822 timer

I am developing using a nrf51822.I need delay timer that can be substitued for nrf_delay_ms(). in other words,need a task delay that can be taken some event from another side during delay time. Is nrf_timer_delay_ms() possible ? If so,please tell me how to use and attention point regarding sw side and hw side. BR

Parents
  • I seems to find the good solution. I use app timer and app timer use the rtc1 timer. so I made the delay like below. void nrf_delay_ms(uint32_t volatile number_of_ms) { while(number_of_ms != 0) {

    number_of_ms--; #if 1 for(uint8_t i=0;i<30;i++) { RTC1_IRQHandler(); nrf_delay_us(30); } #else nrf_delay_us(999); #endif } } because RTC1_IRQHandler will be expired every 31us. 32khz = 31us. Could you inspect my code?

Reply
  • I seems to find the good solution. I use app timer and app timer use the rtc1 timer. so I made the delay like below. void nrf_delay_ms(uint32_t volatile number_of_ms) { while(number_of_ms != 0) {

    number_of_ms--; #if 1 for(uint8_t i=0;i<30;i++) { RTC1_IRQHandler(); nrf_delay_us(30); } #else nrf_delay_us(999); #endif } } because RTC1_IRQHandler will be expired every 31us. 32khz = 31us. Could you inspect my code?

Children
Related