0
\$\begingroup\$

I am using 64 pin stm32f103RE, Keil and STM32Cube for my project, the problem is when I try to read ADC by polling or interrupt modes with HAL_ADC_GetValue(&hadc1), just a fixed number is returned (0xFF0F0000). AS the pin is float so some noise values must be shown instead.

I also tried ADC_GetConversionValue(ADC1) using CMSIS and Keil but the result was the same, for both polling and interrupt mode. What would be the reason, may it be something with ADC hardware problem?

\$\endgroup\$
4
  • \$\begingroup\$ What would be the reason, may it be something with ADC hardware problem as every beginner you look for the hardware problems, compiler errors etc etc. You must remember - in almost 100% cases your code is wrong. Compiler and hardware is OK. Also do not ask questions without your code. \$\endgroup\$ Commented Oct 16, 2017 at 16:42
  • \$\begingroup\$ Have you configured the GPIOs correctly? Have you clocked the GPIO? Have you clocked the ADC? Have you started the ADC? Have you configured the correct channels in the ADC? Are you triggering the ADC? \$\endgroup\$ Commented Oct 16, 2017 at 17:00
  • \$\begingroup\$ GPIO is configured in HAL_ADC_MspInit() which is called by HAL_ADC_Init(). The last is called from MX_ADC1_Init() . This line "PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV2;" inside SystemClock_Config() shows that the adc is been clocked. I do triggering by software, also HAL_ADC_ConvCpltCallback() is been called and so I measure the value using HAL_ADC_GetValue(&hadc1). \$\endgroup\$
    – MSimard
    Commented Oct 16, 2017 at 23:01
  • \$\begingroup\$ My code is also containing GPIO, SD 4-wire FATFS-SDIO and SPI which are working well. The whole code is massive in size so i prefered not to put it here in my question. \$\endgroup\$
    – MSimard
    Commented Oct 16, 2017 at 23:23

1 Answer 1

0
\$\begingroup\$

The problem is solved. In spite of what Peter_J said, the problem was something with hardware, I changed the stm32 IC and the problem was fixed by itself. I had not soldered the IC, so I guess it was soldered by a temperature above 250 degree, some technicians use this temperature to solder faster, and they harm some IC's, or maybe touching the pins while soldering or handling made this, I mean ESD. Thanks anyway.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ If this solves your problem then you can "accept" your own answer to close the question. Otherwise the system will keep bumping it up to get answers. \$\endgroup\$
    – Transistor
    Commented Oct 28, 2017 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.