Skip to content

Fix SONOFF chip reset after flashing#173

Open
sultanqasim wants to merge 1 commit intoJelmerT:mainfrom
sultanqasim:sonoff_patch
Open

Fix SONOFF chip reset after flashing#173
sultanqasim wants to merge 1 commit intoJelmerT:mainfrom
sultanqasim:sonoff_patch

Conversation

@sultanqasim
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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

@sultanqasim
Copy link
Copy Markdown
Author

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

@forkineye
Copy link
Copy Markdown

@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
Copy Markdown
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