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

nrf_delay_ms would deadlock my program

Hi , 

I'm use TWI scanner in  nRF5 SDK v17.0.2 . I want to read the value of BM1383AGLV via TWI.

Now I could read the value in a infinite loop , but it is so fast . So I want to add the delay function in the loop.

When I add the delay function , it will read value once , then the program will stop.

My code is below. I also try to use timer. but it can't work too.

How should I do ?

Thank you for your kind assistance.

while(1){

      //if(timer0_timeout){
        //timer0_timeout =0;
        rc = BM1383AGLV_getval(&press , &temp);
        if(rc == NRF_SUCCESS){
          printf("BM1383AGLV (PRESS) = %f [hPa]\r\n" , press);
          printf("BM1383AGLV (TEMP)  = %f [degrees Celsius]\r\n" , temp);
  
        //}
        //app_timer_start(m_single_shot_timer_id, APP_TIMER_TICKS(200), NULL);
      }
      nrf_delay_ms(200);
}

  • Hi.

    Where does the program stop? Does it enter the error handler somewhere? I suggest using the debugger in SEGGER SES and see where the program goes after the delay has elapsed. Also, the app timer call isn't a blocking call, the execution of the rest of the program will continue and will only be transferred over to the callback handler once the time has elapsed. 

    regards

    Jared

Related