zauberzeug / lizard

Domain-specific language to specify behaviour of microcontroller managed hardware
MIT License
15 stars 5 forks source link

Check relevant pins for p0.flash() #95

Closed JensOgorek closed 1 week ago

JensOgorek commented 1 week ago

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 commented 1 week ago

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.