Hey guys,
I'm working with SES, nRF52832 and SDK14.2.0.
I have a timing problem and would like to describe the problem from the beginning.
I have a 1-wire temperature sensor that is read by the slave and then the slave sends the sensor data to the master via BLE every second. (That is my goal.)
1) First I measured the "temperature conversion time" of the sensor with the project: peripheral / uart, which I modified with a timer for the interval transmission (of 1 second) and with a timer for measuring the time.
Timer for sending in intervals:
Timer for measuring:
And I get the measured time around 702 milliseconds (with small deviations in the microsecond range). And this value is ok.
When I measure all the code that is triggered by the timer (case NRF_TIMER_EVENT_COMPARE1), I get a measured value of approx. 720 milliseconds.
Everything fits up to here.
2) Now I would like to send the sensor data via BLE and have selected the following programs for the slave and the master:
Slave: ble_peripheral/ble_app_uart
Master: ble_central/ble_app_uart_c
I set the timer for sending after every second exactly as in the "peripheral / uart" project. I have installed the timer for measuring in "case NRF_NRF_TIMER_EVENT_COMPARE1":
But here I get totally random values like: 140.000 ticks, 69.000 ticks or 12.000 ticks, although the temperature conversion alone takes about 702.000 ticks (702 milliseconds). Is that because of the softdevice (ble)? If so, what can I change? I'm a bit baffled here...
For this reason, I configured the measurement timer in the master-program in "ble_nus_c_evt_handler":
Here I get values in 1 second intervals, but the values fluctuate very strongly (up to 200 ms) ... That means the master gets values in an interval between 0.8 and 1.2 seconds, but I need an accurate interval of 1 second... Does anyone know what I can do? I would be very happy about any help ..
Best regards,
Christoph