Strange behavior of ADC values


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.



  • 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.

    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?


  • 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)

            // 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);



  • can you please summarize the problem - the original question was not clear.


  • Hi Paolo,

    What is the input impedance of the ADC channel?  If the impedance is too high the sampling capacitor will not have enough time to charge up resulting in invalid readings.  You can either lower the input impedance or increase the number of sampling states for that channel to allow time for the sampling capacitor to stabilize.


  • This is an example output from my test program:

    00001   1298    1298    1298
    00002   1305    1298    1305
    00003   1304    1298    1305
    00004   1303    1298    1305
    00005   1302    1298    1305
    00006   1301    1298    1305
    00007   1301    1298    1305
    00008   1300    1298    1305
    00009   1300    1298    1305
    00010   1300    1298    1305
    00011   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.



  • I had collegate a battery. The impedence is very low.



  • Anyone who knows why?
    I don't understand why the second reading is always very different from the first, and it takes a few readings to get back to the correct value. Being a while reading shouldn't depend on the code.
    I'm using the ADC on a measuring instrument and this behavior creates problems for us.

    Best Regards


  • Take a look at the tables mentioned in this post -

    You're going to have to post a schematic and you project to help on this.

  • I attach to pin P0_0 a battery with a 100 ohm series resistor.

    The project I have attached in the first post.

    Best Regards


  • Are you on the the SK board now, not you own  design?