feat: OTA firmware and config updates over wifi#804
Open
Gheop wants to merge 1 commit into
Open
Conversation
Adds ArduinoOTA to the NerdminerV2 env so the firmware and the SPIFFS config can be flashed over wifi: pio run -e NerdminerV2-OTA -t upload --upload-port <ip> pio run -e NerdminerV2-OTA -t uploadfs --upload-port <ip> - 16MB dual-app partition table (default_16MB.csv) for A/B OTA slots. - mDNS hostname nerdminer-<mac4>, advertising fw_version in its TXT record. - OTA password taken from the NERDMINER_OTA_PWD env var at build time; the build fails (static_assert) if it is unset, so no password is committed. - During a transfer the miner tasks idle at a safe point via an ota_active flag and RELEASE the SHA hardware lock first: otherwise suspending a hw miner mid-hash keeps that lock and Update.end()'s image SHA-256 check deadlocks (transfer reaches 100%, device hangs). The monitor and stratum tasks (which don't touch the SHA engine) are simply suspended. - A watchdog task reboots the device if a transfer stalls >90s, since ArduinoOTA.handle() blocks inside loop().
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.
Adds ArduinoOTA to the
NerdminerV2env so both the firmware and the SPIFFS config can be flashed over wifi, no USB needed:Details
default_16MB.csv) for A/B OTA slots.nerdminer-<mac4>, advertisingfw_versionin its TXT record (avahi-browse -r _arduino._tcp).NERDMINER_OTA_PWDenv var at build time; astatic_assertfails the build if it is unset, so no password is ever committed.ArduinoOTA.handle()blocks insideloop().The tricky part: SHA engine deadlock
Suspending a hardware miner mid-hash keeps the SHA hardware lock (
esp_sha_acquire_hardware).Update.end()then callsesp_image_verify(), which computes the image SHA-256 with that same engine → deadlock: the transfer reaches 100 % and the device hangs with no error until the watchdog reboots it.Fix: the miner tasks poll an
ota_activeflag and idle at a safe point with the lock released; in-flight jobs get 300 ms to drain before the (SHA-free) monitor and stratum tasks are suspended. Isolated with anOTA_ONLY_TESTbuild (wifi + OTA only) that always succeeded, which pinpointed the miner tasks as the cause.Note
Switching the env to the 16 MB table wipes SPIFFS on the first USB flash — re-push
config.jsonwith-t uploadfsafterwards (wifi credentials live in NVS and survive). Tested end to end on a LilyGo T-Display-S3: firmware + config OTA both succeed with the miners, screen and stratum all running.