-
Notifications
You must be signed in to change notification settings - Fork 465
fix IS_ADC_CHANNEL() bug on STM32F411xE variants #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I can confirm, it seems not consistent, Channel is 18 but bitwise OR operator with STM32CubeF4/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc_ex.h Lines 222 to 226 in 5d01400
So the STM32CubeF4/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc_ex.h Lines 305 to 317 in 5d01400
If the @@ -304,17 +304,17 @@ HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef* hadc, ADC_
*/
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || \
- defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
- defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
+ defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || \
+ defined(STM32F412Cx)
#define IS_ADC_CHANNEL(CHANNEL) ((CHANNEL) <= ADC_CHANNEL_18)
-#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE ||
- STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
+#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F412Zx ||
+ STM32F412Vx || STM32F412Rx || STM32F412Cx */
-#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
- defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
+#if defined(STM32F411xE) || defined(STM32F413xx) || defined(STM32F423xx) || defined(STM32F427xx) || defined(STM32F437xx) || \
+ defined(STM32F429xx) || defined(STM32F439xx) defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
#define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) <= ADC_CHANNEL_18) || \
((CHANNEL) == ADC_CHANNEL_TEMPSENSOR))
-#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
+#endif /* STM32F411xE || STM32F413xx || STM32F423xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
#define IS_ADC_MODE(MODE) (((MODE) == ADC_MODE_INDEPENDENT) || \
((MODE) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \ |
Have to be fixed in STM32CubeF4: STMicroelectronics/STM32CubeF4#36 Signed-off-by: Michael Sharman <[email protected]> Co-authored-by: Frederic Pillon <[email protected]>
|
Hi @TheCodeSharman, Thank you for your suggestion and contribution. Our development teams will be notified to fix this. A fix will be implemented and made available in future release. Thank you once again for your contribution. With regards, |
|
Hi @fpistm, Thank you for your suggestion and contribution. With regards, |
|
ST Internal Reference: 92349 |
Have to be fixed in STM32CubeF4: STMicroelectronics/STM32CubeF4#36 Signed-off-by: Michael Sharman <[email protected]> Co-authored-by: Frederic Pillon <[email protected]> Signed-off-by: Frederic Pillon <[email protected]>
Have to be fixed in STM32CubeF4: STMicroelectronics/STM32CubeF4#36 Signed-off-by: Michael Sharman <[email protected]> Co-authored-by: Frederic Pillon <[email protected]> Signed-off-by: Frederic Pillon <[email protected]>
|
Hi @TheCodeSharman, I hope you are fine. The issue you reported has been fixed in the frame of version v1.26.0 of the STM32CubeF4 published recently on GitHub. Thank you again for having reported. With regards, |
This PR fixes an issue where the following is returning false for the STM32F411xE chip:
IS_ADC_CHANNEL(ADC_CHANNEL_TEMPSENSOR)As a result of this the example code on the Wiki for reading the internal temperature sensor returns a result of -266 because analogRead(ATEMP) always returns 0 indicating an error.
Note: Reviewing the code it looks like the definition of ADC_CHANNEL_TEMPSENSOR is inconsistent with the definition of IS_ADC_CHANNEL for other boards too? I've only made the minimal changes for the board I own however.