Skip to content

Feat h7 current sensing #460

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

Open
wants to merge 19 commits into
base: dev
Choose a base branch
from
Open

Feat h7 current sensing #460

wants to merge 19 commits into from

Conversation

askuric
Copy link
Member

@askuric askuric commented Mar 19, 2025

  • This PR adds the low-side current sensing for H7 boards.
  • There are some cleanups of the driver code as well, minimal though
  • The current sensing does not work with portenta for the moment - did not have on me at the moment so I could not really test the MBED integration properly.
  • Also I've added portenta and a few other MBED boards to the compile CI

@askuric askuric changed the base branch from master to dev March 19, 2025 10:36
@askuric askuric added the enhancement New feature or request label Mar 24, 2025
@askuric
Copy link
Member Author

askuric commented Apr 29, 2025

H7 low-side is working, I've tested it with the SimpleFOCMini v2.
Before this commit it did not work properly actually. It did not handle the repetition counter missing.

I did find something strange though. In the case where the repetition counter is handled in the software (in the interrupt handler) where we count and use every second measurement, for H7 we have to start from the 2nd call of the interrupt while the other architectures were starting from the 1st call. There is a shift of one interrupt call. I am not sure where does it come from.
I'm wondering if this shift is persistent between the architectures (always the same for the same family) or is it different for different timers, or is there something else going on. In any case I did not see this before.

We need to investigate this!

Here is the code for h7:

if( needs_downsample[adc_index] && tim_downsample[adc_index]++ > 1) {
tim_downsample[adc_index] = 1;
return;
}

And for g4:

if( needs_downsample[adc_index] && tim_downsample[adc_index]++ > 0) {
tim_downsample[adc_index] = 0;
return;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant