2023-08-16 12:19 AM
We are using the ADC on an STM32G4xx for a safety project. The safety manual requires us to read VSS or VDD for ADC diagnostics. STM32G4 has ADC channel 0 internally connected to VSSA, so we are trying to use HAL_ADC_ConfigChannel() to configure ADC_CHANNEL_0.
Unfortunately, HAL_ADC_ConfigChannel() asserts on IS_ADC_CHANNEL(hadc, sConfig->Channel) because IS_ADC_CHANNEL() does not check for ADC_CHANNEL_0. I would assume this is a bug in stm32g4xx_hal_adc_ex.h since all ADC instances in the G4 do support VSS as valid input channel (see reference manual section 21.4.4).
Can someone please look at this?
Regards, Norbert
Solved! Go to Solution.
2023-08-28 05:13 AM - edited 2023-08-28 05:14 AM
Hello @unterberg_rtb ,
First let me welcome you to the STM32 Community :) and thank you for having reported this issue.
Indeed, this is a confirmed issue in HAL ADC driver: ADC_CHANNEL_0 is listed, so it must be checked by macro IS_ADC_CHANNEL().
To do: In this macro, and add "ADC_CHANNEL_0".
#define IS_ADC_CHANNEL(__HANDLE__, __CHANNEL__) ( ( ((__CHANNEL__) == ADC_CHANNEL_1) || \ ((__CHANNEL__) == ADC_CHANNEL_2) || \ ...
An internal ticket ID 159520 is submitted for correction.
(PS: ID 159520 is an internal tracking number and is not accessible or usable by customers).
Thanks
Imen
2023-08-28 05:13 AM - edited 2023-08-28 05:14 AM
Hello @unterberg_rtb ,
First let me welcome you to the STM32 Community :) and thank you for having reported this issue.
Indeed, this is a confirmed issue in HAL ADC driver: ADC_CHANNEL_0 is listed, so it must be checked by macro IS_ADC_CHANNEL().
To do: In this macro, and add "ADC_CHANNEL_0".
#define IS_ADC_CHANNEL(__HANDLE__, __CHANNEL__) ( ( ((__CHANNEL__) == ADC_CHANNEL_1) || \ ((__CHANNEL__) == ADC_CHANNEL_2) || \ ...
An internal ticket ID 159520 is submitted for correction.
(PS: ID 159520 is an internal tracking number and is not accessible or usable by customers).
Thanks
Imen