ADC Continuous mode bug in DA14531

Learn MoreFAQsTutorials

3 posts / 0 new
Last post
wanhuaqifang
Offline
Last seen:3 weeks 1 day ago
加入:2020-01-02 07:07
ADC Continuous mode bug in DA14531

Hi dialog pm,

While I`m using DA14531`s ADC in continuous mode with BLE Enabled, I founded it will auto close after 2 seconds when I turn it on.

I founded that in "arch_system.c" a function called conditionally_run_radio_cals(); always enable ADC to check die temperature and re-cablirate the RF if temperature difference is greater than (or equal to) 8 degrees Celsius.

This operation will call "adc_init()" and turn off the ADC Interrupt.

I want to know that can I disable RF auto calibrate manually? If I disable it, is there any serious bug happen to the BLE Connections?

Or, how should I do to use continuous mode?

My SDK verison is the newest version:"v_6.0.14.1114-with hotfix_00"

Ex.:

the function conditionally_run_radio_cals(); code belows here:

void conditionally_run_radio_cals(void)
{
#if defined (__DA14531__)
// 531 case
uint32_t current_time = lld_evt_time_get();

if (current_time < last_temp_time)
{
last_temp_time = 0;
}

if ((current_time - last_temp_time) >= 3200) //2 sec
{
last_temp_time = current_time;

// Store the current content of the following registers:
// - GP_ADC_CTRL_REG,
// - GP_ADC_CTRL2_REG,
// - GP_ADC_CTRL3_REG,
// - GP_ADC_SEL_REG.
uint16_t tmp_adc_ctrl_reg = GetWord16(GP_ADC_CTRL_REG);
uint16_t tmp_adc_ctrl2_reg = GetWord16(GP_ADC_CTRL2_REG);
uint16_t tmp_adc_ctrl3_reg = GetWord16(GP_ADC_CTRL3_REG);
uint16_t tmp_adc_sel_reg = GetWord16(GP_ADC_SEL_REG);

adc_config_t cfg =
{
.input_mode = ADC_INPUT_MODE_SINGLE_ENDED,
.input = ADC_INPUT_SE_TEMP_SENS,
.continuous = false
};

// Initialize and enable ADC
adc_init(&cfg);

int8_t current_temp = adc_get_temp();

if (last_temp == 127)
{
last_temp = current_temp;
}
else
{
int8_t temp_diff = current_temp - last_temp;

if (temp_diff < 0)
{
temp_diff = -temp_diff;
}

if (temp_diff >= 8)
{
// Calibrate the RF if the temperature difference is greater than
// (or equal to) 8 degrees Celsius
rfcal_count++;
rf_recalibration();

last_temp = current_temp;
}
}

// Restore the content of the ADC CTRL and SEL registers
SetWord16(GP_ADC_CTRL2_REG, tmp_adc_ctrl2_reg);
SetWord16(GP_ADC_CTRL3_REG, tmp_adc_ctrl3_reg);
SetWord16(GP_ADC_SEL_REG, tmp_adc_sel_reg);
SetWord16(GP_ADC_CTRL_REG, tmp_adc_ctrl_reg);
}
#else

Device:
PM_Dialog
Offline
Last seen:3 hours 17 min ago
Staff
加入:2018-02-08 11:03
Hi There,

Hi There,

Thanks for pointing this. A possible work around might be the following in schedule_while_ble_on() :

if (ea_sleep_check(&sleep_duration, 4)) //6 slots -> 3.750 ms { if (GetBits16(GP_ADC_CTRL_REG, GP_ADC_EN) == 0) { // check time and temperature to run radio calibrations. conditionally_run_radio_cals(); } }

Thanks, PM_Dialog

wanhuaqifang
Offline
Last seen:3 weeks 1 day ago
加入:2020-01-02 07:07
Thanks dialog pm.

Thanks dialog pm.

But I need to run ADC continuous mode for a long time to sample lots of datas.

Can I keep ADC continuous on in an hour? Will it cause some serious RF problem? like:disconnect after half an hour?