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

Children