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.
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.
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.
Take a look at the tables mentioned in this post - https://renesasrulz.com/embedded-system-platform/synergy/f/forum/7991/s7g2-adc
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.
Are you on the the SK board now, not you own design?
Now I use SK board for understand the problem. So I discarded layout errors and software interference with different threads.
But the problem also occurred with the SK board.
ssp_err_t status;adc_sample_state_t p_sample; status = g_adc0.p_api->open(g_adc0.p_ctrl, g_adc0.p_cfg); status = g_adc0.p_api->scanCfg(g_adc0.p_ctrl, g_adc0.p_channel_cfg); p_sample.reg_id = ADC_SAMPLE_STATE_CHANNEL_0; p_sample.num_states = 15; status = g_adc0.p_api->sampleStateCountSet(g_adc0.p_ctrl, p_sample);
The procedure on the SK board solves the problem. But this should help if one has a high input impedance. In my case it is low.
I'll implement the change in our pcb and see if things improve.Thank you