Repository navigation
M5PM1: keep the wake source, retry the first read, add ToughC5 M-Bus pins - #432
Merged
Merged
Conversation
On a ToughC5 started by the PM1 timer, the first I2C read of the PM1 in Power.begin() is NACKed. begin() then fails, the board setup goes on and clears WAKE_SRC, and only the second begin() succeeds, so the reason for the power-on is gone and an application reading it gets 0. Retry the first read and keep WAKE_SRC before it is cleared. It is available from M5.Power.M5pm1.getWakeSource(). PaperMono clears WAKE_SRC before its first begin(), so it now calls begin() first.
The table now has a row for board_M5ToughC5, matching the V0.6 schematic and PCB and the board catalog.
This was referenced Nov 5, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #431.
Wake source
On a ToughC5 started by the PM1 timer,
WAKE_SRCreads 1 beforeM5.begin()and 0 after it. A capture of the internal I2C shows why:Power.begin()is NACKed, soM5PM1_Class::begin()fails.WAKE_SRCabout 9 ms later. The IRQ output needs this.begin()succeeds, but the value is already gone.This PR retries the first read and keeps
WAKE_SRCbefore it is cleared.M5.Power.M5pm1.getWakeSource()returns the kept bits, which matchm5pm1_wake_src_tof the M5PM1 library. The register is still cleared as before, so the IRQ behavior does not change.PaperMono cleared
WAKE_SRCbefore its firstbegin(), so it now callsbegin()first.On ToughC5 and PaperMono,
getWakeSource()of the M5PM1 library still returns 0 afterM5.begin(). UseM5.Power.M5pm1.getWakeSource()there.Measured over repeated PM1 timer power-ons:
getWakeSource()WAKE_SRCafterM5.begin()ToughC5 M-Bus pins
getPin()now returns the M-Bus pins of ToughC5, matching the V0.6 schematic and PCB.mbus_pin17tombus_pin20are G2 and G3, andmbus_pin8is G4, which the PM1 IRQ output also drives. The board catalog change is in m5stack/M5GFX#393.Checks
begintime is unchanged.