-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feather-m0: add support for saul_bat_voltage #21022
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
feather-m0: add support for saul_bat_voltage #21022
Conversation
crasbe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small nitpicks, otherwise this looks very good.
It will require a rebase after #21349.
cb3cbc6 to
1b578fc
Compare
abb0908 to
fbe894f
Compare
|
👍 now only some actual tests are needed 😅 |
didn't you have such hardware at home? |
|
I have a Feather-M0 at home, but it's difficult to flash with WSL and even converting the .hex to a .uf2 file worked, but I can't access the serial terminal. |
|
Good news: I just remembered that my server runs Ubuntu Server and I can use that to test the PR. It always shows -6mV, regardless of whether the BAT pin is left floating (and the charge controller just seems to cycle, at least the LED is blinking very fast) or connected to 3.3V, which makes the LED light up permanently. |
|
I just ran the Two things are evident here: connecting it to 3.3V does not show anything, therefore the range of the battery reading might be incorrect (wrong AREF perhaps?) and two resolutions show -1, which indicates that they are not supported. |
|
More testing, now with lab supply and Multimeter: Real Voltage: 1.29V Real Voltage: 1.60V Real Voltage: 1.98V Real Voltage: 4.21V |
That seems too big. :-/ |
|
So why did you move this PR out of draft stage? ;-) |
Because I don't consider this PR to be in the draft stage, it's very much close to completion and there is probably just an unrelated bug somewhere else. |
|
After rebasing to include #21508 and applying the suggestion to change the ADC channel from 7 to 6, this is what the output looks like: However one thing I wondered in general: Why does this approach not use the |
Is that the expected output? |
Also: Is it exposed via SAUL? For my use-case (advertising the battery voltage via |
Yes.
Not yet, because the VBat of the STM32s is more for battery backup of the RTC etc. |
So that is another reason :-) But I mean, there is nothing preventing us from merging the two features in the future. |
|
This has to be rebased after #21504. It's fine for me if (for the time being) we have two similar features, but I'd like to have to cross-referencing in the documentation and/or an issue to keep track of eventually merging them and/or adding SAUL for |
|
Ping @miri64 :) |
Co-authored-by: crasbe <crasbe@gmail.com>
fbe894f to
e044b00
Compare
|
Rebased and adopted for 60eaa5a |
257f2df to
1fc77e7
Compare
boards/adafruit-feather-nrf52840-express/include/bat_voltage_params.h
Outdated
Show resolved
Hide resolved
boards/adafruit-feather-nrf52840-sense/include/bat_voltage_params.h
Outdated
Show resolved
Hide resolved
Co-authored-by: crasbe <crasbe@gmail.com>
Co-authored-by: crasbe <crasbe@gmail.com>
Co-authored-by: crasbe <crasbe@gmail.com>
6fa85b9 to
e59e9b6
Compare
Co-authored-by: crasbe <crasbe@gmail.com>
e59e9b6 to
08b6936
Compare
Contribution description
When trying to get #21018 to work for the
feather-m0, the ADC line only returned-1, so I removed this from #21018.Testing procedure
Flash
example/saulto one (or ideally all) of the supported boards and use the CLI to read from theBATregistry entry.Issues/PRs references
Based on #21018