I'm developing a battery powered BLE sensor application where I need some basic guidance on how to implement this:
The sensor action consists of a measurement process where a PWM signal is generated and some analog values are continuously sampled with the ADC module of the nRF52. The total processing time of this sensor measurement takes about 2ms. One important requirement for the (2ms) PWM/ADC measurement is that it is not interrupted by softdevice/BLE events, because this sensor measurement is highly sensitive to interruptions and power supply variations.
My first question is:
1) Could this be implemented with a read characteristic from the central?
I tried this, but when I handled the read request in the nRF52 firmware, the device got disconnected while measuring and I think it might be because the read command might have some timing requirements. So I wonder...
2) What are the timing requirements for processing a read characteristic event? (How long can the peripheral wait to deliver data to the central after receiving a read event?)
I think that the measurement could also be done with a "notify" event. So after the central performs a read event, the peripheral could start the measurement and once the measurement is complete, it could notify the central with the measured sensor values. This might also be better in terms of measurement sensitivity. Maybe there are other strategies?
3) Which strategy would you recommend for such an uninteruptible and sensitive measurement with 2ms measurement duration?
Sorry for asking such a general and unspecific question, but some opinion and basic guideance would help me a lot with not heading into the wrong direction right at project start.
Thanks in advance,
Stefan