Hi,
I'm using S7A3 MCU, SSP 2.4.0
Trying to measure 16 analog input using ADC14. The ADC read that return few channel is lower than other. I measure the voltage at the ADC input pins and it has the same voltage as other input. my code is below
volatile bool adc_convert_complete = false; uint16_t adcBuffer[16]; adc_register_t adcChannel[] = {ADC_REG_CHANNEL_0, ADC_REG_CHANNEL_1, ADC_REG_CHANNEL_2, ADC_REG_CHANNEL_3, ADC_REG_CHANNEL_4, ADC_REG_CHANNEL_5, ADC_REG_CHANNEL_6, ADC_REG_CHANNEL_7, ADC_REG_CHANNEL_8, ADC_REG_CHANNEL_16, ADC_REG_CHANNEL_17, ADC_REG_CHANNEL_18, ADC_REG_CHANNEL_19, ADC_REG_CHANNEL_20, ADC_REG_CHANNEL_21, ADC_REG_CHANNEL_22}; g_adc0.p_api->open(g_adc0.p_ctrl, g_adc0.p_cfg); R_S14ADC->ADHVREFCNT_b.HVSEL = 1; R_S14ADC->ADHVREFCNT_b.LVSEL = 1; R_S14ADC->ADCSR_b.ADHSC = 0; // High speed A/D conversion R_S14ADC->ADSSTR0n_b[0].SST = 38; R_S14ADC->ADSSTRO_b.SST = 38; status = g_adc0.p_api->scanCfg(g_adc0.p_ctrl, g_adc0.p_channel_cfg); while(1) { g_adc0.p_api->scanStart(g_adc0.p_ctrl); while (adc_convert_complete == false); adc_convert_complete = false; for (int i = 0; i < 16; i++) { g_adc0.p_api->read(g_adc0.p_ctrl, adcChannel[i], &adcBuffer[i]); } g_adc0.p_api->scanStop(g_adc0.p_ctrl); tx_thread_sleep (100); } void mcu_adc_callback (adc_callback_args_t *p_args) { SSP_PARAMETER_NOT_USED(p_args); adc_convert_complete = true; }
The conversion is show below: Channels in green boxes are measured that all having the same voltage input. However, couple channels with red arrows are reading lower than others. The channels with read arrows read correctly when I significantly lower the input voltage level.
Is there anything I did wrong? Does it require to be calibrated (how)
Thanks,
Hi Copper.Apologies for the delay. I'm assuming you meant S3A7? Please share with us the configuration screenshot of the ADC stack.Regards,Jayesh If this response, or one provided by another user, answers your question, please verify the answer. Thank you!Renesas Engineering Community Moderatorshttps://community.renesas.com/https://academy.renesas.com/en-support.renesas.com/.../
Hi Jayesh,
Yes, it is S3A7. Below is the configuration
Hi Copper.The configuration looks correct. Can you tell us more about how you've connected the input voltage to the ADC pins? This could be a problem due to different impedances. Also, have you considered changing the input from channels 3 and 10 to any other available channel? Let us know.Regards,Jayesh If this response, or one provided by another user, answers your question, please verify the answer. Thank you!Renesas Engineering Community Moderatorshttps://community.renesas.com/https://academy.renesas.com/en-support.renesas.com/.../
It is a complex circuit with many multiplexer switches. However, in this case, I measure the voltage at the MCU analog input pin to verify that the tolerance of the MUX would not be the cause. and yes, the voltage input is correct, but the conversion is not.
The board is completed PCBA, I can't swap the channel but will try with different board to see if it behaves the same.
Regards,
I tested with other boards and those behave the same.
I tried by disabling other channel in the configuration, the 2 incorrectly reading channel is now reading correctly.
The more ADC channels are enabled in the configuration, the lower that 2 channels reading.
I'm not sure if that is because of the crosstalk because none of the analog input is floating.
after further testing, I believe it is crosstalk. if a channel have a low input voltage, it will effects the reading of the channel next to it. This is not very good.
Hello Copper! Is there any update on this? I discussed this with the team, and we think the problem you're encountering has a high chance of being caused by the high impedance of your analog inputs (the analog multiplexer in your circuit). Crosstalk can be problematic when we have harsh rising/falling edges but not in DC circuits with small current flow. Could you share with us the clock configuration of your project? Have you set the ADC clock to maximum but didn’t change the sampling state values for the channel, which is by default 13.5 * ADCLK (270nS)? If the input impedance is high, the sampling time might not be sufficient. This can cause the sample and hold circuit to not charge or discharge to exact values. As a result, adjacent channels may affect each other due to the short sample time.Regards,Jayesh If this response, or one provided by another user, answers your question, please verify the answer. Thank you!Renesas Engineering Community Moderatorshttps://community.renesas.com/https://academy.renesas.com/en-support.renesas.com/.../
Hi, Jayesh,
Inputs into the ADC are buffered with Opamp in series with 10K resistor or some voltage divider which is less than 10K. I don't think 10K is very impedance. Can you verify if this is the case for the S3A7.
In one of your replies, you mentioned about different impedance. If I have one channel input impedance is 10k but other is 5k Ohm, is this would cause the issue?
Hi Copper. I see you mentioned that you have a completed PCB, but would it be possible for you to swap out the 10K resistors to a lower value of 100 Ω resistors and then test it?Also, the difference in impedances shouldn't be a problem.Regards,Jayesh If this response, or one provided by another user, answers your question, please verify the answer. Thank you!Renesas Engineering Community Moderatorshttps://community.renesas.com/https://academy.renesas.com/en-support.renesas.com/.../
I swapped with 1K resistor and it works properly.
Thanks