Multiple ADC channels with some incorrect value

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,

Parents Reply
  • 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 Moderators
    https://community.renesas.com/
    https://academy.renesas.com/
    en-support.renesas.com/.../

Children