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

Fix SONOFF chip reset after flashing #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sultanqasim
Copy link

@sultanqasim sultanqasim commented Apr 23, 2024

The chip will return to the bootloader after cmdReset if the bootloader pin is not de-asserted after entering the bootloader. To fix this, this patch de-asserts the bootloader pin after a delay.

@sultanqasim
Copy link
Author

There's something strange about the connections, seems it's not as simple as I first thought; this patch breaks entering the bootloader on Mac unless I reorder asserting the bootloader pin to be after exiting reset.

The chip will return to the bootloader after cmdReset if the bootloader
pin is not de-asserted after entering the bootloader. To fix this, this
patch de-asserts the bootloader pin after a delay.
@sultanqasim sultanqasim marked this pull request as ready for review June 7, 2024 13:56
@sultanqasim
Copy link
Author

Revised patch works reliably on Mac and Linux, even with sleeps between every step. I don't quite undetstand the connections, but this work.

@JelmerT JelmerT self-assigned this Sep 18, 2024
@XenoKovah
Copy link

XenoKovah commented Dec 22, 2024

Note: I've been using @sultanqasim's fork where he has incorporated this change for months now to successfully flash Sonoff dongles, so I just wanted to voice my support for merging this, just because then it'd clean up his documentation to not need to mention this outstanding PR anymore and to just use your main code rather than his fork.

@forkineye
Copy link

I tried this, but time.sleep(0.002) was too short for me. Upping it to .5 did however.

@sultanqasim
Copy link
Author

@forkineye Which OS (and which OS version) do you use? What’s the minimum sleep that works reliably for you?

@forkineye
Copy link

@forkineye Which OS (and which OS version) do you use? What’s the minimum sleep that works reliably for you?

Windows 11. I didn't try taking it any lower, sorry. Was just trying to get everything migrated over to my new dongle. Thanks for getting me in the right direction though!

@sultanqasim
Copy link
Author

Ah, Windows may be slower for some USB operations than Linux and Mac that I tested on. I'm curious if a 5 or 10 ms sleep would work on Windows.

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.

4 participants