Skip to content

HVFB with safety thresholds#3816

Closed
noah-m wants to merge 9 commits into
UBC-Thunderbots:masterfrom
noah-m:hvfb-thresholds
Closed

HVFB with safety thresholds#3816
noah-m wants to merge 9 commits into
UBC-Thunderbots:masterfrom
noah-m:hvfb-thresholds

Conversation

@noah-m

@noah-m noah-m commented Jun 30, 2026

Copy link
Copy Markdown

Description

This is an extension of #3791, which added the minimal HVFB implementation.

This PR replaces the unconditional 500 ms LT3750 retrigger behaviour with voltage-based charge control. It is intended to provide more consistent operating voltage across boards whose hardware flyback feedback currently stops at different voltages (200V and 240V). It should also eliminate the scenario of flyback charging during active capacitor discharging.

Key changes:

  • Uses calibrated capacitor voltage readings for charge hysteresis.
  • Stops charging above a configurable software threshold and restarts below a lower threshold.
  • Periodically reissues a CHRG rising edge while voltage remains low, in case the LT3750 has failed to charge despite CHRG remaining high.
  • Keeps the EMA-smoothed voltage for telemetry while using the non-EMA reading for charge control.
  • Disables the flyback before chicker pulses, keeps it disabled throughout the pulse, then resumes normal charge control afterward.
  • Adds a short pre-kick settling delay where charging is disabled.

Testing Done

No successful testing has been performed. Furthermore, this was the active code when powerboard 3 caught fire. While the root cause is likely hardware-based, it has not been determined.

The impact of non-EMA reading for charge control should be validated; we may wish to further tune the trade-off between response time and filtering.

Resolved Issues

Related to #3791.

Length Justification and Key Files to Review

Key files:

  • src/software/power/charger.cpp
  • src/software/power/charger.h
  • src/software/power/chicker.cpp
  • src/software/power/chicker.h
  • src/software/power/powerloop_main.cc

Review Checklist

It is the reviewers responsibility to also make sure every item here has been covered

  • Function & Class comments: All function definitions (usually in the .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.
  • Remove all commented out code
  • Remove extra print statements: for example, those just used for testing
  • Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

{
pinMode(HV_SENSE, INPUT);
// Currently unused
pinMode(FLYBACK_FAULT, INPUT);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking a look in Altium, the FLYBACK_FAULT pin (pin 27) isn't actually connected to anything. Further, there is no independent flyback fault pin on the LT3750 itself. The DONE pin will go high on a fault condition as per the datasheet (page 4 here). Or just look at this image:

Image

I.e: is there any reason to have this pin? It's also unused so perhaps it'd make sense to just delete it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, good catch. That line can be removed. Ideally, DONE would take on fault behaviour as you mentioned, however the DONE pin does not work on at least one powerboard and has not been validated for many other boards. So while I intend to incorporate DONE in the future to take on the role of fault logic, it could also be removed.

@williamckha

Copy link
Copy Markdown
Member

Closing this PR in favour of #3829, which we tested at comp and confirmed works,

@williamckha williamckha closed this Jul 4, 2026
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.

4 participants