cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F071RB6T ADC FAIL ?

Sebastian Juch
Associate II
Posted on August 23, 2017 at 16:03

Hey,

i have a strange behavior of STM32F071RB6T.

I initialize the RCC, TIM3 for PWM 1Ch. works!

I initialize the RCC, TIM3 for PWM 1Ch, ADC with DMA. works!

I deaktivate PWM init and just whant to test the ADC with DMA and...suprise suprise.

micro does not finished the hardware init and stucks in the while for waiting ADRDY.

I atached main.c initialisierung.c

Did i forget something?

Thanks in advanced.

#stm32f071rb6t-adc_dma-fail
4 REPLIES 4
Posted on August 23, 2017 at 16:36

The USART TX pins should be PP not OD mode

TIM16 interrupts enable, no NVIC enable

Does the ADC require HSI enabled on F0 parts?

Review Peripheral register states in debuggers 'Peripheral View'

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 23, 2017 at 17:37

You are right with USART , my mistake. 

But.. USART and TIMER are not initialized in the code. They are commented out.

Please look at the bottom of the init file at void Init_Hardware(void)

Just RCC, PWM and ADC_DMA are active.

I don't think that enabeling the RCC for the rest of the periph is responsible for the problem.

Any other ideas?

I read in the ERRATA of the cpu that there are problems with the ADC and ADRDY, ADCAL.

But i don't understand the solution.

May be you do? 

Thanks in advanced.

Sebastian

EDIT: Tomorrow i can provide screenshot's. But what i can say is that the ADRDY flag will not be set und that in debug he stucks at the while in the init of ADC.

Posted on August 23, 2017 at 18:09

Move the DMA Init ahead of the ADC Init code.

I'm not using F0 parts, and not going to reconstruct this into a compilable project.

Check the peripheral registers in working vs not working situation.

See if this ordering hangs

...

    /* ADC Calibration */

    ADC_GetCalibrationFactor(ADC1);

    ADC_Cmd(ADC1,ENABLE);

    /* Wait until ADC is not Ready*/

    while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_ADRDY))

    /* DMA Circular Mode*/

    ADC_DMARequestModeConfig(ADC1, ADC_DMAMode_Circular);

    /* Enable DMA, ADC1 */

    ADC_DMACmd(ADC1, ENABLE);

    /* Fire Up Conversion */

    ADC_StartOfConversion(ADC1);

...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 23, 2017 at 18:30

Thank you for the fast answer, i will try it tomorrow and will report soon.

Thanks in advanced.

Sebastian