Skip to content

Conversation

@jannic
Copy link
Contributor

@jannic jannic commented Jan 27, 2025

Signals:
1: 3.3V
2: 5V
4: IRQ0

Before:
neotron-3V3-5V-main

With this fix:
neotron-3V3-5V-power_good

@thejpster
Copy link
Member

Nice catch, thanks!

if ctx.shared.state_dc_power_enabled.lock(|r| *r) == DcPowerState::Starting {
let mon_3v3 = ctx.local.adc.read_abs_mv(ctx.local.pin_3v3_monitor);
defmt::trace!("3v3 reading: {}", mon_3v3);
if mon_3v3 < 1600 {
Copy link
Member

Choose a reason for hiding this comment

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

Why 1600mV? That seems quite low?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a voltage divider before the ADC. 1600mV on the pin means 3.2V on the 3.3V rail.
image

So 1600mV may actually be too high. I didn't do an estimate of the tolerances.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(If you agree with the general approach, I can work on the details, like adding some explanations, putting the "magic value" 1600 in a const etc.)

Copy link
Member

@thejpster thejpster Jan 28, 2025

Choose a reason for hiding this comment

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

Ahhhh. Yes, you can't exceed fairly tight limits on the ADC pin so I halved the input.

Yes the approach makes sense.

@thejpster
Copy link
Member

This tested OK. @jannic can you rebase on main to pick up some fixes? I was unable to push to your fork.

@thejpster thejpster merged commit 22a9dd7 into Neotron-Compute:main Apr 17, 2025
2 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