Hi,
I had a temperature adc reading accuracy issue in lower temperature such as -40.
It is similar to this post issue (https://devzone.nordicsemi.com/f/nordic-q-a/80859/nrf52840-at-low-temperatures-i-can-t-achieve-the-specified-accuracy-for-the-internal-temperature-sensor)
So I fixed the issue by using sd_clock_hfclk_request + waiting for the ramp-up time.
While I was looking at the issue, I found that "The application can request the SoftDevice to guarantee that the HFCLK source is set to the external
crystal and that it is ramped up and stable before the start of the timeslot." in SD140 document and I am already using the NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED option for that so I wanted to test if I can use the radio time slot request instead of sd_clock_hfclk_request and called time slot request before reading temperature adc but it seems not working.
The time slot request code is something like below. The interesting thing is even if I added "sd_clock_hfclk_request + waiting for the ramp-up time" code before or after the time slot request code, temperature adc reading still has the inaccuracy issue.
Here are my questions.
1. is there any problem in my code? or I am not supposed to read the adc with while using time slot request?
2. Since I am using time slot request for other radios as well, I am worried about their performance Is there anyway to check HFCLK/HFXO status with time slot request?
Thanks.
#define TIMESLOT_EXTEND_LENGTH (1000)
uint32_t request_next_event_earliest(void)
{
m_slot_length = TIMESLOT_EXTEND_LENGTH;
m_timeslot_request.request_type = NRF_RADIO_REQ_TYPE_EARLIEST;
m_timeslot_request.params.earliest.hfclk = NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED;
m_timeslot_request.params.earliest.priority = NRF_RADIO_PRIORITY_NORMAL;
m_timeslot_request.params.earliest.length_us = 1000;
m_timeslot_request.params.earliest.timeout_us = 1000000;
return sd_radio_request(&m_timeslot_request);
}
uint32_t err_code;
uint8_t open_retry = 0;
uint8_t request_retry = 0;
while((err_code = sd_radio_session_open(radio_callback)) && open_retry++ < 100)
{
wait_ms(1);
}
while((err_code = request_next_event_earliest()) && request_retry++ < 100)
{
wait_ms(1);
}