Skip to content

Feat current sense check if TRGO set for STM32 #456

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 2 commits into from
Mar 12, 2025

Conversation

askuric
Copy link
Member

@askuric askuric commented Mar 12, 2025

This PR adds a check in the ADC code that verifies that the timer to which the ADC will be synced does not have TRGO events already in use.
They can be used in two ways:

  • TRGO_UPDATE - by another ADC sync (another motor for example)
  • TRGO_ENABLE - by the driver code syncing multiple timers

This code was not necessary for the releases up to v2.3.4 as the driver sync was done after the ADC sync initialisaiton. Then the driver was the only one required to verify if the timers have TRGO in use. But in the new code, the driver is initalised first, and the ADC second, so the ADC code has to verify this as well.

I've also added to the code a check if the pins are ADC pins, and displayed the error. Up until now the init would fail without any error and block the operation.

I think that this PR is probably required for the v2.3.5, as without it the ADC code can overwrite the timer sync and create unaligned PWM signals. What do you think @runger1101001?

@askuric askuric changed the base branch from master to dev March 12, 2025 09:20
@runger1101001 runger1101001 merged commit d91a96f into dev Mar 12, 2025
45 checks passed
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.

2 participants