ADC problem in STM32F207

Comments

4 comments

  • Avatar
    Richard Webb

    I'm not fond of the STL and prefer to bang-up the registers directly but this may point you in the right direction. The outer #defines and #includes aren't shown and some of the prep work is handled in a prior, general system initialization function. Also not the identical chip (an STM32F103) but I believe that the operation is the same as the 207.

    0
    Comment actions Permalink
  • Avatar
    Dr Danish Ali

    How strongly do you know that conversion never starts?

    You set that bit to request start-of-conversion. And then (according to the reference manual) the hardware clears that bit as soon as the conversion starts. So when debugging/single-stepping you might never see that bit as set.

    I suggest you try to use the ADC _without_ DMA before trying with DMA. This way you can know if the problem is with the ADC or the DMA.

    Hope this helps.

    0
    Comment actions Permalink
  • Avatar
    Sina

    Thank you for your response Richard, I tried to use your code but unfortunately the compiler cannot detect  these definitions :

    RCC_CFGR_ADCPRE

    RCC_CFGR_ADCPRE_DIV6

    ADC_CR2_CAL

    RCC_AHBENR_DMA1EN

    DMA1_Channel1_IRQn

     

    Dr Danish Ali, I disabled the DMA code and It did work :) .  whenever I was enabling  following command

    ADC_DMACmd(ADC1, ENABLE); 

    ADC was converting only a single time (In ADC's Register) and DMA's destination register was zero all the time. Then I checked the DMA code again. I found another example for DMA Initialization and now DMA is also working fine. 

    I appreciate your help guys. I attach the code here for those who might be interested to see the final code.

    0
    Comment actions Permalink
  • Avatar
    Sina

     

    I attached the wrong format here is the txt file

    0
    Comment actions Permalink

Please sign in to leave a comment.