Skip to main content
Linda
Associate III
June 13, 2014
Question

Not working: \STM32Cube_FW_F4_V1.1.0\Projects\STM32F429I-Discovery\Examples\ADC\ADC_RegularConversion_DMA

  • June 13, 2014
  • 19 replies
  • 2132 views
Posted on June 13, 2014 at 17:43

Hi,

I copy \STM32Cube_FW_F4_V1.1.0\Projects\STM32F429I-Discovery\Examples\ADC\ADC_RegularConversion_DMA to following location:

\STM32Cube_FW_F4_V1.1.0\Projects\STM32F429I-Discovery\Demonstrations\Modules

The ADC is not working.

Then I change ADC3 channel 8 to ADC2 channel 13, PF10 to PC3,   by change the main.h:

~~~~~~~~~~~~~~~~~~~~~~~

/* Definition for ADCx clock resources */

&sharpdefine ADCx                            ADC3

&sharpdefine ADCx_CLK_ENABLE()               __ADC3_CLK_ENABLE()

&sharpdefine DMAx_CLK_ENABLE()               __DMA2_CLK_ENABLE()     

&sharpdefine ADCx_CHANNEL_GPIO_CLK_ENABLE()  __GPIOF_CLK_ENABLE()

     

&sharpdefine ADCx_FORCE_RESET()              __ADC_FORCE_RESET()

&sharpdefine ADCx_RELEASE_RESET()            __ADC_RELEASE_RESET()

/* Definition for ADCx Channel Pin */

&sharpdefine ADCx_CHANNEL_PIN                GPIO_PIN_10

&sharpdefine ADCx_CHANNEL_GPIO_PORT          GPIOF

/* Definition for ADCx's Channel */

&sharpdefine ADCx_CHANNEL                    ADC_CHANNEL_8

/* Definition for ADCx's DMA */

&sharpdefine ADCx_DMA_CHANNEL                DMA_CHANNEL_2

&sharpdefine ADCx_DMA_STREAM                 DMA2_Stream0         

/* Definition for ADCx's NVIC */

&sharpdefine ADCx_DMA_IRQn                   DMA2_Stream0_IRQn

&sharpdefine ADCx_DMA_IRQHandler             DMA2_Stream0_IRQHandler

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change to:

~~~~~~~~~~~~~~~~~~~

/* Definition for ADCx clock resources */

&sharpdefine ADCx                            ADC2

&sharpdefine ADCx_CLK_ENABLE()               __ADC2_CLK_ENABLE()

&sharpdefine DMAx_CLK_ENABLE()               __DMA2_CLK_ENABLE()     

&sharpdefine ADCx_CHANNEL_GPIO_CLK_ENABLE()  __GPIOC_CLK_ENABLE()

     

&sharpdefine ADCx_FORCE_RESET()              __ADC_FORCE_RESET()

&sharpdefine ADCx_RELEASE_RESET()            __ADC_RELEASE_RESET()

/* Definition for ADCx Channel Pin */

&sharpdefine ADCx_CHANNEL_PIN                GPIO_PIN_3

&sharpdefine ADCx_CHANNEL_GPIO_PORT          GPIOC

/* Definition for ADCx's Channel */

&sharpdefine ADCx_CHANNEL                    ADC_CHANNEL_13

/* Definition for ADCx's DMA */

&sharpdefine ADCx_DMA_CHANNEL                DMA_CHANNEL_2

&sharpdefine ADCx_DMA_STREAM                 DMA2_Stream0         

/* Definition for ADCx's NVIC */

&sharpdefine ADCx_DMA_IRQn                   DMA2_Stream0_IRQn

&sharpdefine ADCx_DMA_IRQHandler             DMA2_Stream0_IRQHandler

~~~~~~~~~~~~~~~~~~~~~~~~

It is still not working,

Please help.

Thanks a lot

#lmgtfy:-stm32-resources #whiskey-tango-foxtrot
    This topic has been closed for replies.

    19 replies

    raptorhal2
    Lead
    June 13, 2014
    Posted on June 13, 2014 at 21:57

    ADC2 is on your choice of stream 2 or 3, not stream 0. See the DMA Request Mapping Table in Section 10.3.3 of the reference manual.

    Cheers, Hal

    Linda
    LindaAuthor
    Associate III
    June 13, 2014
    Posted on June 14, 2014 at 00:02

    Thanks Baird.

    But which reference manual? I don't have it. Could you please send me a link or the manual?

    Thanks a lot.

    Tesla DeLorean
    Guru
    June 13, 2014
    Posted on June 14, 2014 at 00:30

    But which reference manual? I don't have it. Could you please send me a link or the manual?

    The one for YOUR part?

    http://www.google.com/search?q=Reference+Manual+STM32F429

    http://www.st.com/st-web-ui/static/active/en/resource/technical/document/reference_manual/DM00031020.pdf

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Linda
    LindaAuthor
    Associate III
    June 13, 2014
    Posted on June 14, 2014 at 01:58

    Thanks clive1!!

    Linda
    LindaAuthor
    Associate III
    June 14, 2014
    Posted on June 14, 2014 at 21:30

    New Problem comes out:

    program do not respone, after I push stop in debugger, it stop at B:

    SPI4_IRQHandler                   

    SPI5_IRQHandler                   

    SPI6_IRQHandler                   

    SAI1_IRQHandler                   

    LTDC_IRQHandler                   

    LTDC_ER_IRQHandler                 

    DMA2D_IRQHandler                  

                    B       .

                    ENDP

                    ALIGN

    ;*******************************************************************************

    ; User Stack and Heap initialization

    ;**************************************************

    Tesla DeLorean
    Guru
    June 14, 2014
    Posted on June 15, 2014 at 00:51

    I have practically no visibility into your code, I will guess that you haven't renamed and corrected your IRQ handler for the different stream, or enabled in the NVIC. The place it is ending up is where unhandled interrupts go to die.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    raptorhal2
    Lead
    June 15, 2014
    Posted on June 15, 2014 at 02:22

    Did you use the same interrupt handler file as the example ? It doesn't have the other peripheral handlers you listed here.

    Try stepping through the code to find the departure line for the errant interrupt.

    Cheers, Hal

    Linda
    LindaAuthor
    Associate III
    June 15, 2014
    Posted on June 15, 2014 at 10:32

    My an other try is: do not copy this project to other place, keep in the same folder(\STM32Cube_FW_F4_V1.1.0\Projects\STM32F429I-Discovery\Examples\ADC\ADC_RegularConversion_DMA), I just change the ADC to other pin  PC3 (instead of PF10), the program doesn't give a correct converting. The main.h is:

    ~~~~~~~~~~~~~~

    /* Definition for ADCx clock resources */

    #define ADCx                            ADC3

    #define ADCx_CLK_ENABLE()               __ADC3_CLK_ENABLE()

    #define DMAx_CLK_ENABLE()               __DMA2_CLK_ENABLE()     

    #define ADCx_CHANNEL_GPIO_CLK_ENABLE()  __GPIOC_CLK_ENABLE()

         

    #define ADCx_FORCE_RESET()              __ADC_FORCE_RESET()

    #define ADCx_RELEASE_RESET()            __ADC_RELEASE_RESET()

    /* Definition for ADCx Channel Pin */

    #define ADCx_CHANNEL_PIN                GPIO_PIN_3

    #define ADCx_CHANNEL_GPIO_PORT          GPIOC

    /* Definition for ADCx's Channel */

    #define ADCx_CHANNEL                    ADC_CHANNEL_8

    /* Definition for ADCx's DMA */

    #define ADCx_DMA_CHANNEL                DMA_CHANNEL_2

    #define ADCx_DMA_STREAM                 DMA2_Stream0         

    /* Definition for ADCx's NVIC */

    #define ADCx_DMA_IRQn                   DMA2_Stream0_IRQn

    #define ADCx_DMA_IRQHandler             DMA2_Stream0_IRQHandler

    ~~~~~~~~~~~~~~~

    How to fix this problem ?

    Thanks a lot

    Tesla DeLorean
    Guru
    June 15, 2014
    Posted on June 15, 2014 at 17:29

    Ok, so it's not crashing now, but PC3 (ADC123_IN13) on the ADC3 doesn't seem to be reading the right value?

    So important information to impart would be:

    What is the nature of the signal? Source, Impedance, Static or Oscillating

    What is the voltage?

    What is the actual 12-bit measurement/reading from the STM32?

    ADC_CHANNEL_8 ?? PC3 Will be Channel 13 !!

    The

    http://www.st.com/web/en/resource/technical/document/datasheet/DM00071990.pdf

    for you part describes the pins and peripheral / adc associations.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Linda
    LindaAuthor
    Associate III
    June 16, 2014
    Posted on June 17, 2014 at 01:21

    Dear Clive 1 ,

    It only work in the folder

    https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/Not%20working%20STM32Cube_FW_F4_V1.1.0ProjectsSTM32F429I-DiscoveryExamplesADCADC_RegularConversion_DMA

    , but once I copy to

    STM32Cube_FW_F4_V1.1.0\Projects\STM32F429I-Discovery\Demonstrations\Modules, then it crash.