Skip to content

Number of ADC channels arbitrarily limited #39

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

Closed
tfry-git opened this issue Apr 13, 2023 · 3 comments · Fixed by #61
Closed

Number of ADC channels arbitrarily limited #39

tfry-git opened this issue Apr 13, 2023 · 3 comments · Fixed by #61
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@tfry-git
Copy link
Contributor

These lines of code:

ADC_REGULAR_RANK_1, ADC_REGULAR_RANK_2, ADC_REGULAR_RANK_3, ADC_REGULAR_RANK_4, ADC_REGULAR_RANK_5

and

#define AN_MAX_ADC_CHANNELS (5)

(also referenced, here:

"A maximum of 5 channels can be sampled successively.");
)

limit multi-channel sampling to a sequence of max length 5. The STM32H7 actually supports 16 channels (accordingly #defines up to ADC_REGULAR_RANK_16 exist), and arguably the feature is most useful when more than a handful of pins are involved.

Now, I am not quite sure what is the long term plan for cross-hardware support in this library. Depending on that, the proper fix will either be a plain adjustment of the values, or a small mess of #ifdefs.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Apr 13, 2023
@iabdalkader
Copy link
Collaborator

Sorry for taking so long to reply to this issue, I haven't been watching the repo for a while as I thought it was maintained by someone else. Re your issue, I can't remember exactly why I limited the channels to that specific number, it's probably because we only broke out a few ADC channels, this was before the GIGA. Can you point out where in the datasheet it mentions the maximum number of channels that can be sampled successively ? If they are indeed 16, there's no reason not increase them.

@tfry-git
Copy link
Contributor Author

Pinpointing the documentation is complicated by the fact that STM provides separate huge documents for each processor variant within the H7 family. Anyway, for the H747 of the giga that would be ST RM0399 version 4.0, section 26.4.11 (page 970), and the detail descriptions sections 26.6.11 through 26.6.15 on the ADC_SQRx registers.

For determining that this is indeed a common spec of the H7-family, I guess the more accessible reference is the HAL driver: targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_ll_adc.h lists 16 ADC_REGULAR_RANK_XY ranks, without any #if for processor variant.

@iabdalkader
Copy link
Collaborator

@tfry-git Thanks for the references. I have this on my todo list and will fix it as soon as I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants