hi.
I have a firmware using standard GATT, now im implementing the mesh layer.
Im using SDK 17.0.2 + MESH 5.0.0. (im not using the new sdk connect because it is very difficult to me)
in my node i have implemented the SAADC using only the library 17.0.2, the rutine GET_temperature, WORKS fine
BUT, when i integrate this rutine in the MESH, the program stuck in the while (nrfx_saadc_is_busy())
could you help me, what is the wrong?
I did some thing but not works.
1.- eliminate the all wait for event and interface. not worked
2.- Increase the saadc priority, but not work.
I
uint16_t GetTemperature(void){
ret_code_t err_code;
uint16_t med_temp=0;
int16_t temp_avg_1=0;
int16_t temp_max=0;
int16_t temp_min=0;
while (med_temp<100)
{
if (!nrf_drv_saadc_is_busy())
{
med_temp++;
adc_buf_NPT=0;
err_code = nrfx_saadc_calibrate_offset();
********** from HERE **********
while (nrfx_saadc_is_busy()) // Wait for calibration to complete
{
__WFE(); //
__SEV(); //
__WFE(); // This sequence puts the system to sleep (SystemON) while waiting
}
********** To HERE **********
APP_ERROR_CHECK(err_code);
err_code =nrfx_saadc_sample_convert(0, &adc_buf_NPT);
if (temp_max==0) temp_max=adc_buf_NPT;
if (temp_min==0) temp_min=adc_buf_NPT;
if (adc_buf_NPT<=temp_min) temp_min=adc_buf_NPT;
if (adc_buf_NPT>=temp_max) temp_max=adc_buf_NPT;
if (adc_buf_NPT<0) {adc_buf_NPT=0;}
temp_avg_1= (temp_avg_1*(med_temp-1) +adc_buf_NPT)/(med_temp);
APP_ERROR_CHECK(err_code);
}
}
thanks.
Ricardo