Hi.
I'm testing the ADCs on the SK-S7G2 board because we have unstable ADC readings on our custum board.
I put a stable voltage on pin P00 (battery voltage). I noticed that if that ADC reads more channels (in this case 3) the reading error is about 8 channels instead of 3 if I read only one channel.And the error is only in the first readings then the value seems to stabilize around 1 channel..
I don't understand if I'm doing something wrong or if there is a bug in the function.
I attach my example project.
Thanks
Paolo
SK-S7G2-Test-ADC.zip
Paolo,
Please add the following code to increase the number of sampling states for CH0.
The default is 11, try increasing the number to see if the readings get more stable.
ssp_err_t status;adc_sample_state_t…
Can you edit this a bit - I think you may have used channels and voltages interchangeably. It might be helpful to show you schematic for the ADC input and the code where you use the ADC HAL calls, and some details like sample and hold, channel numbers, and the SSP version, etc.
This may be helpful as well.
ajwrs.wordpress.com/.../
Also, have you tried running your ADC code on an eval board that has the temperature sensor circuit as a check that it works correctly?
LArry
Hi Larry.
The scheme is that of the SK-S7G2, where between ground and P00 I connected a battery.
As you can see from the attached project I use SSP 2.3.0 and GCC 10.3. I use a while for read ADC
while (1) { g_adc.p_api->scanStart(g_adc.p_ctrl); // Wait end convertion tx_semaphore_get(&g_adc_semaphore, TX_WAIT_FOREVER); // Read ADC g_adc.p_api->read(g_adc.p_ctrl, ADC_REG_CHANNEL_0, &adc_value); g_adc.p_api->read(g_adc.p_ctrl, ADC_REG_CHANNEL_1, &adc_fake1); g_adc.p_api->read(g_adc.p_ctrl, ADC_REG_CHANNEL_2, &adc_fake2); if (adc_value < adc_min) { adc_min = adc_value; } if (adc_value > adc_max) { adc_max = adc_value; } sprintf(msg, "%05d\t%04d\t%04d\t%04d\r\n", ++count, adc_value, adc_min, adc_max); g_sf_console.p_api->write(g_sf_console.p_ctrl, (uint8_t *)msg, TX_NO_WAIT); tx_thread_sleep(TX_TIMER_TICKS_PER_SECOND); }
can you please summarize the problem - the original question was not clear.
-Larry
This is an example output from my test program:
00001 1298 1298 129800002 1305 1298 130500003 1304 1298 130500004 1303 1298 130500005 1302 1298 130500006 1301 1298 130500007 1301 1298 130500008 1300 1298 130500009 1300 1298 130500010 1300 1298 130500011 1299 1298 1305
AN00 has the values between 1298 and 1305 (7 channels).
If I run the program enable only one AN00 on synergy configuretor the error is 3 channels.
It appears that the first reads of the loop in that case read a value with an error.
Why?