2020-02-12 09:18 PM
I am using STM32F429 DISCO board and X-CUBE DSPDEMO to perform FFT on an analog signal. The demo code comes with ADC1 IN0 configured for PA0. It performs FFT and displays the signal on LCD. I am trying to change the input pin to PA1 by changing definitions in the global.h file, but it doesnt work when i connect the input signal to PA1. The code could be found here. https://www.st.com/en/embedded-software/x-cube-dspdemo.html#overview.
Kindly help.
2020-02-12 10:14 PM
Presenting some code would have been helpful.
But in general, specific ADC channels are bound to specific pins. You need to change both GPIO pin and ADC channel number.
2020-02-12 10:18 PM
Hi,
The Default code is
/* User can use this section to tailor ADCx instance used and associated
resources */
/* Definition for ADCx clock resources */
#define ADCx ADC1
#define ADCx_CLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE()
#define DMA2_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE()
#define ADCx_CHANNEL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADCx_FORCE_RESET() __HAL_RCC_ADC_FORCE_RESET()
#define ADCx_RELEASE_RESET() __HAL_RCC_ADC_RELEASE_RESET()
/* Definition for ADCx Channel Pin */
#define ADCx_CHANNEL_PIN GPIO_PIN_0
#define ADCx_CHANNEL_GPIO_PORT GPIOA
/* Definition for ADCx's Channel */
#define ADCx_CHANNEL ADC_CHANNEL_0
/* Definition for ADCx's DMA */
#define ADCx_DMA_CHANNEL DMA_CHANNEL_0
#define ADCx_DMA_STREAM DMA2_Stream0
and i changed it to
/* User can use this section to tailor ADCx instance used and associated
resources */
/* Definition for ADCx clock resources */
#define ADCx ADC1
#define ADCx_CLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE()
#define DMA2_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE()
#define ADCx_CHANNEL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADCx_FORCE_RESET() __HAL_RCC_ADC_FORCE_RESET()
#define ADCx_RELEASE_RESET() __HAL_RCC_ADC_RELEASE_RESET()
/* Definition for ADCx Channel Pin */
#define ADCx_CHANNEL_PIN GPIO_PIN_1
#define ADCx_CHANNEL_GPIO_PORT GPIOA
/* Definition for ADCx's Channel */
#define ADCx_CHANNEL ADC_CHANNEL_1
/* Definition for ADCx's DMA */
#define ADCx_DMA_CHANNEL DMA_CHANNEL_0
#define ADCx_DMA_STREAM DMA2_Stream0
2020-02-13 12:16 AM
I don't speak Cube.
Did you walk through the code, and check you catched every occurence ?