Skip to content
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

Check relevant pins for p0.flash() #95

Merged
merged 4 commits into from
Nov 15, 2024
Merged

Check relevant pins for p0.flash() #95

merged 4 commits into from
Nov 15, 2024

Conversation

JensOgorek
Copy link
Contributor

@JensOgorek JensOgorek commented Nov 14, 2024

This is for #75

Before flashing, the p0.flash() call will set the GPIO0 to the correct state and check GPIO2 and GPIO12 on the p0 for their states.
GPIO0 and 2 are responsible for booting to the bootloader upon restart.
GPIO12 on low sets the flash voltage to 3.3V. On high, which sets it to 1.8V, it can cause issues when flashing.

The strapping register itself does not need to be checked in that stage of flashing. Since the configuration after the restart would be the relevant one, but then the p0 would be in bootloader mode, which we would not have to check and could not check.

@JensOgorek JensOgorek added the bug Something isn't working label Nov 14, 2024
@JensOgorek JensOgorek added this to the 0.6.1 milestone Nov 14, 2024
@JensOgorek JensOgorek self-assigned this Nov 14, 2024
@JensOgorek JensOgorek modified the milestones: 0.6.1, 0.6.0 Nov 14, 2024
@JensOgorek JensOgorek changed the title update: check relevant pins for bootloader Check relevant pins for p0.flash() Nov 14, 2024
Copy link
Collaborator

@falkoschindler falkoschindler left a comment

Choose a reason for hiding this comment

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

@JensOgorek I reviewed and simplified the code a bit. This avoids code duplication for message handling. And I think we can simply use strstr twice instead of reading and comparing the int level. Maybe you can have a look and check if it does work as expected.

@JensOgorek
Copy link
Contributor Author

JensOgorek commented Nov 15, 2024

I tested it, it worked like before.
Also, I added an optional force argument to skip the pin check. When the expander esp is in an invalid/blank state, it would never answer and could never be flashed.
To make the flashing more reliable, I added a restart and a full disconnect before flashing. The flash would sometime not work (and work again after restart). Now it seems to work flawlessly.

Copy link
Collaborator

@falkoschindler falkoschindler left a comment

Choose a reason for hiding this comment

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

Ok, I added another check for the correct number of flash arguments and extended the documentation just a tiny bit.

@JensOgorek JensOgorek merged commit 828fbcf into main Nov 15, 2024
@JensOgorek JensOgorek deleted the flash_with_strapping branch November 15, 2024 13:56
@JensOgorek JensOgorek linked an issue Nov 15, 2024 that may be closed by this pull request
JensOgorek added a commit that referenced this pull request Nov 19, 2024
* Check relevant pins for p0.flash() (#95)

* update: check relevant pins for bootloader

* code review and simplification

* update: added forceing flash, added disconnect before flashing

* review

---------

Co-authored-by: Falko Schindler <falko@zauberzeug.com>

* add venv to ignores

* Expander watchdog for documentation (#98)

* updated docs

* review

---------

Co-authored-by: Falko Schindler <falko@zauberzeug.com>

* auto-format BNO055 class

---------

Co-authored-by: Falko Schindler <falko@zauberzeug.com>
Co-authored-by: Pascal Schade <pascal@zauberzeug.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check strapping pins before flashing port expander
2 participants