2014-06-13 08:43 AM
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-foxtrot2014-06-13 12:57 PM
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, Hal2014-06-13 03:02 PM
Thanks Baird.
But which reference manual? I don't have it. Could you please send me a link or the manual? Thanks a lot.2014-06-13 03:30 PM
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
2014-06-13 04:58 PM
Thanks clive1!!
2014-06-14 12:30 PM
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 ;**************************************************2014-06-14 03:51 PM
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.
2014-06-14 05:22 PM
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, Hal2014-06-15 01:32 AM
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 lot2014-06-15 08:29 AM
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 !! Thehttp://www.st.com/web/en/resource/technical/document/datasheet/DM00071990.pdf
for you part describes the pins and peripheral / adc associations.