2019-09-25 02:53 AM
Hi,
I write in this forum for a problem with the ADC of the microcontroller SPC56EL70L5.
My goal is to perform two group conversions in ADC0 and wo in ADC1.
I use the function generated by the program "adc_std_start_conversion" but some values obtained from the conversion are not valid.
The adc work with interrupts and I'm respecting the conversion waiting times.
The behavior changes with different values of Tsample and Tconv, but the problem is not solved.
I had thought at this point to try to set a presempling but the application does not generate me the registers to set.
The program that creates problems is the following:
osalThreadDelayMicroseconds(3);
adc_lld_start_conversion(&ADCD1, &adc0_group_ADC0_FAST,samples_0_fast, ADC0_GROUP_ADC0_FAST_BUF_DEPTH);
osalThreadDelayMicroseconds(30);
adc_lld_start_conversion(&ADCD2, &adc1_group_ADC1_FAST,samples_1_fast, ADC1_GROUP_ADC1_FAST_BUF_DEPTH);
osalThreadDelayMicroseconds(3);
while(num_conv_1<3 || num_conv_2<3){
if(num_conv_1==1){
if(mux_set_port<=16 && mux_set_port>=1)
adc_lld_start_conversion(&ADCD1, &adc0_group_ADC0_SLOW,samples_0_slow, ADC0_GROUP_ADC0_SLOW_BUF_DEPTH);
else if(mux_set_port==17)
adc_lld_start_conversion(&ADCD1, &adc0_group_ADC0_SLOW_REG1_LINE_CURR,samples_0_slow_reg1_line_curr, ADC0_GROUP_ADC0_SLOW_REG1_LINE_CURR_BUF_DEPTH);
else if(mux_set_port==18)
adc_lld_start_conversion(&ADCD1, &adc0_group_ADC0_SLOW_APS33M,samples_0_slow_aps33m, ADC0_GROUP_ADC0_SLOW_APS33M_BUF_DEPTH );
else
num_conv_1++;
num_conv_1++;
}
if(num_conv_2==1){
adc_lld_start_conversion(&ADCD2, &adc1_group_ADC1_FAST_13_14,samples_1_fast_13_14, ADC1_GROUP_ADC1_FAST_13_14_BUF_DEPTH);
num_conv_2++;
}
}
num_conv_1 and num_conv_2 are used only to start the next conversions at the end of the first ones by setting it in the callback.
What do you advise me to do?
I have made many attempts but I cannot resolve.
2019-09-26 02:10 AM
Hello ,
ADC is dependent in Noise on voltage reference and so on ..
Have you tried to increase INPSAMP in configuration editor (Low Level Drivers) ?
Best regards
Erwan
2019-09-27 01:47 AM
Hi Erwan thanks for the reply.
I did a lot of tests varying Tsamp e Tconv, respecting always the specification but the problem has not been resolved.
The problem of the validity of the samples it occurs only when the second group is composed of only one line to be converted. I thought that a pre-sampling was necessary but setting it as shown in the datasheet does not work, so I thought of doing a sort of manual presampling by setting the groups from a two-line line and making the first useless conversion and this worked.
It seems to me an anomalous behavior anyway, if you know tell me an error let me know.
Best regards