Hello Everyone,
A part of my logic for the module i am developing requires to put the device (nRF52832) in low power mode for xx seconds. Once the timer expires, application wakes up and send the data over BLE and then again goes to low power and so on.
For this to happen, i am trying to make the BLE and timer work together first but so far i have not been able to achieve any success with that. When i try to run both, it throws an error.
I followed what was discussed in this page--> https://devzone.nordicsemi.com/f/nordic-q-a/16429/ble-not-working-with-timer-interrupt-rfduino/62864#62864
But changing the priorities also doesn't seem to work.
Here's my code that i am trying to run:
nrf_drv_timer_extended_compare(&POWER_TIMER, NRF_TIMER_CC_CHANNEL0, power_timer_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
nrf_drv_timer_enable(&POWER_TIMER);
nrf_drv_timer_extended_compare(&POWER_TIMER, NRF_TIMER_CC_CHANNEL0, power_timer_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true); nrf_drv_timer_enable(&POWER_TIMER); while(true) { if(timer2expired && bleConnected) {//timer2expired is true once timer2 expires, bleConnnected is true once connection is established do { length =10; err_code = ble_nus_string_send(&m_nus, data, &length); if ((err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_BUSY)) { APP_ERROR_CHECK(err_code); timer2expired = false; } }while (err_code == NRF_ERROR_BUSY); }
Could you please have a look at the code and suggest where i am going wrong with this. Any suggestions are welcome and will be of great help.
Thank you!
SK