cancel
Showing results for 
Search instead for 
Did you mean: 

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

Linda
Associate II
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
19 REPLIES 19
Linda
Associate II
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.

raptorhal2
Lead
Posted on June 17, 2014 at 01:41

My guess is that the startup file and possibly configuration files that are associated with your IDE were not properly included in the new build.

Cheers, Hal

Posted on June 17, 2014 at 02:42

I guess you're going to have to get your head around the IDE you are using, the project settings and options within it, and get a better grasp on why it's crashing.

If the simple act of copying the project fails, then you need to look at the directories, where it's pulling the include files, and what it's using for the start up file.

You might want to compare and contrast the .MAP files and see if you can find any differences in the code that is being built.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Linda
Associate II
Posted on June 17, 2014 at 04:07

Might be ADCx_DMA have too high priority, how can I lower its priority?

Thanks

Linda
Associate II
Posted on June 17, 2014 at 11:49

After I debug by step, it crash in this function:

  if(HAL_TIM_OC_Start_IT(&TimHandle, TIM_CHANNEL_2) != HAL_OK)

  {

    /* Initialization Error */

    Error_Handler();

  }

This one is part of PWM, when the ADC couldn't convert anything, this portion work fine, but after ADC do its job, then PWM  does not work properly.

raptorhal2
Lead
Posted on June 17, 2014 at 15:07

There is no Timer function in the ADC_RegularConversion_DMA example.

Posted on June 17, 2014 at 16:12

I am rapidly losing interest. Get your story straight and present the entire project as an attachment. Specify what tool chain you are using.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Linda
Associate II
Posted on June 17, 2014 at 20:29

Dear Baird Hal,

I copy 2 projects to my project, one is PWM, the other one is Examples\ADC\ADC_RegularConversion_DMA.the timer is in PWM.  Now, the ADC works, but PWM doesn't work.

Linda
Associate II
Posted on June 20, 2014 at 13:49

Dear Clive1,

I am using Keil and I try to attachment the whole project, but system fail, the file might too big. How can I send to you?

Thanks.

Posted on June 20, 2014 at 19:30

Yeah, I don't like big files, you should be able to zip up and quantify the size of the file. It shouldn't exceed a few hundred KB for what you're describing. But I'm really not interested in CUBE/HAL code, or merging barely functional examples. I've posted a LOT of example code for the Standard Library that's a lot clearer and functional.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..