Skip to content

[STM32F3xx] bug fix multiple ADC channels using multiple ADC blocks #1580

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

Merged
merged 1 commit into from
Mar 9, 2016

Conversation

ohagendorf
Copy link
Contributor

When two or more analogue inputs are initialized on more than one ADC HW block the initialisation fails with:

Cannot initialize ADC

The reason is the reusage of just one ADC_HandleTypeDef for all initializations (in mbed\targets\hal\TARGET_STM\TARGET_STM32F3\analogin_api.c). After the first (successful) ADC initialisation AdcHandle.State is set to HAL_ADC_STATE_READY).
But for the next ADC block initialisation the AdcHandle.State has to be reset so that the HAL initializes it (in mbed\targets\cmsis\TARGET_STM\TARGET_STM32F3\stm32f3xx_hal_adc_ex.c line 424). When this state is not reset the HAL returns with an initialization error. And this error induces the above mbed error message.

The error message can be reproduced just with AnalogIn in1(xx); AnalogIn in2(yy); where xx and yy belongs to two different ADC blocks.

When two or more analogue inputs are initialized on more than one ADC HW block the initialisation fails with:
Cannot initialize ADC

The reason is the reusage of just one ADC_HandleTypeDef for all initializations (in mbed\targets\hal\TARGET_STM\TARGET_STM32F3\analogin_api.c). After the first (successful) ADC initialisation AdcHandle.State is set to HAL_ADC_STATE_READY).
But for another ADC block initialisation the AdcHandle.State has to be reset so that the HAL initialize it (in mbed\targets\cmsis\TARGET_STM\TARGET_STM32F3\stm32f3xx_hal_adc_ex.c line 424). When this state is not reset the HAL returns with an initialization error. And this error induces the above mbed error message.

The error message can be reproduced just with AnalogIn in1(xx); AnalogIn in2(yy); where xx and yy belongs to two different ADC blocks.
@0xc0170
Copy link
Contributor

0xc0170 commented Mar 1, 2016

@bcostm @adustm

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 7, 2016

Bump for review

@bcostm
Copy link
Contributor

bcostm commented Mar 8, 2016

I didn't check it but it looks ok to me. Another solution would be to create a table of AdcHandle variables as already done with the STM32F4 Serial api.

0xc0170 added a commit that referenced this pull request Mar 9, 2016
[STM32F3xx] bug fix multiple ADC channels using multiple ADC blocks
@0xc0170 0xc0170 merged commit 2c6c939 into ARMmbed:master Mar 9, 2016
@ohagendorf ohagendorf deleted the f3xx_adc branch March 13, 2016 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants