AnsweredAssumed Answered

Spike in AD conversions for STM32F407

Question asked by schembari.roberto on Sep 20, 2016
Latest reply on Sep 29, 2016 by John F.
Hi, we have a problem in temperature AD acquisitions. The sensors are two Microchip MCP9700T-E/LT and are connected to ADC CH13 (pin #18) end CH3 (pin #26) through only a 22ohm resistance.
The ADC is triggered by a 10Khz pwm timer and is set as:
   
// APB2-> 84MHz
    // L'a/d può andare al max a 36MHz (vedi datasheet STM32F40x)
    // quindi il prescaler minimo è /4 (=21MHz)
    ADC_CommonInitTypeDef aci;
    aci.ADC_Mode = ADC_TripleMode_InjecSimult; //Injected simultaneous mode only
    aci.ADC_Prescaler = ADC_Prescaler_Div4;
    aci.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; //DMA disabilitato
    aci.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
    ADC_CommonInit(&aci);

    // Config. modalità conversione
    ADC_InitTypeDef ai;
    ai.ADC_Resolution = ADC_Resolution_12b;
    ai.ADC_ScanConvMode = ENABLE;
    ai.ADC_ContinuousConvMode = DISABLE;
    ai.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
    ai.ADC_ExternalTrigConv = ADC_ExternalTrigInjecConvEdge_None;
    ai.ADC_DataAlign = ADC_DataAlign_Left;
    ai.ADC_NbrOfConversion = ADC_NO_OF_INJ_CH;
    ADC_Init(ADC1, &ai);
    ADC_Init(ADC2, &ai);
    ADC_Init(ADC3, &ai);

    // abilito gli ADC
    ADC_Cmd(ADC1, ENABLE);
    ADC_Cmd(ADC2, ENABLE);
    ADC_Cmd(ADC3, ENABLE);

    // configurazione canali ADC
    ADC_InjectedSequencerLengthConfig(ADC1, ADC_NO_OF_INJ_CH);
    ADC_InjectedSequencerLengthConfig(ADC2, ADC_NO_OF_INJ_CH);
    ADC_InjectedSequencerLengthConfig(ADC3, ADC_NO_OF_INJ_CH);

The problem are the spikes that appear when starts the conversion (see attached for waveform of the two channel at mcu pin 18 and 26). This spike is exactly in the conversion instant, and then the measures are totally wrong. If we change the ADC trigger frequency, the spike moves in according to the change, but don't change if we change the other ADC sets.
The only change that we have, in amplitude and in duration of the spike, is when we change the channels conversion sequence.
Can you help me?
Thank you
PIN18.jpgPIN18_zoom.jpgPIN26.jpgPIN26_zoom.jpg

Outcomes