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

Randomly no image when powering on GBS-C #480

Open
nyanpasu64 opened this issue Jul 17, 2023 · 4 comments · May be fixed by #501
Open

Randomly no image when powering on GBS-C #480

nyanpasu64 opened this issue Jul 17, 2023 · 4 comments · May be fixed by #501

Comments

@nyanpasu64
Copy link
Collaborator

In custom passthrough mode (and IIRC fixed passthrough), connected to a Wii over component, randomly when I power on the GBS and ESP, the GBS-C will fail to initialize and display an image. When I connected to the ESP over serial after the fact, it did not respond to serial commands. I do not know what went wrong during the boot process, as I did not have a USB serial console connected.

I'll have to get a boot log capture before debugging further. I tried plugging in the GBS at various points during Wii startup, but could not replicate the issue.

@nyanpasu64
Copy link
Collaborator Author

nyanpasu64 commented Jul 20, 2023

Plugged in the GBS-C power 10+ seconds after Wii, and get no image. The Arduino serial monitor woke up after plugging in power, but I see no activity on the USB serial port, no \nstartup text (unsure if it's seen in normal startup or the USB serial connection doesn't wake up in time) and no <reset> text, and sending text over serial does nothing. I cannot access gbscontrol.local in a browser, and sshing into OpenWRT and running iwinfo wlan1 assoclist (2.4 GHz) shows only my Wii connected rather than GBS-C. My phone shows no hosted AP SSID either. Hitting the Reset button on the ESP board fixes the problem, first printing some serial noise followed by \nstartup etc.

I'll have to figure out where in the boot process this stalled. I don't know if the Arduino serial monitor would've woken up like it did, if Serial.begin(115200) had never run.

If the ESP8266 is hung, I'm not sure why the hardware watchdog timer wouldn't reset it to a known good state. Either it's stuck in an infinite loop or softlocked state which feeds the watchdog to prevent a reset, or it failed to startup altogether (possibly due to a low-voltage brownout start?) and software debugging is futile. I may or may not have gotten this issue prior to installing my cooling fan, I don't remember and it's hard to rule out intermittent issues (eg. unplugging the fan and rebooting dozens of times).

@nyanpasu64
Copy link
Collaborator Author

  • Infinite yield() remains connected to wifi, unlike the ESP when it fails to boot.
  • Infinite ESP.wdtFeed() disconnects from wifi, entering a state indistinguishable from failed boots. But I can't find any code in GBS-C, libraries, or SDK which calls that function as opposed to yielding, so I think it's unlikely.
  • An infinite loop resets and briefly flickers the power LED on every 3 seconds. Calling ESP.wdtDisable() then looping forever, resets and briefly flickers the power LED on every ~7.5 seconds.
  • Holding the reset button disconnects from wifi (or prevents connecting to wifi if you hold it during system boot), indistinguishable from a failed boot. I forgot to record whether the ESP's power/status LED is on or off during failed boot.
  • In certain orientations of my power cable, the ESP's power LED flickers when i wiggle the barrel plug in the jack. i suspect (but can't say for certain) that when plugging in my power cable, I randomly get a power delivery and contact bounce issue during initial power-up.
    • I could lug my oscilloscope out from storage and probe the 5V power line during every bootup sequence, hoping to catch a black screen. Do I want to?
    • It's probably worth probing the plug-in power contact bounce at least once, or wiggle the barrel jack and observe the resulting voltage.

my primary suspicion is that the esp failed to power up altogether. unfortunately I have less information than I like, since early prints are lost during even successful boots.

i edited my code to flash the led 5 times on setup(). Next time I encounter a black screen, if the LED flashes the ESP dies after setup() starts. If it never flashes, there's a hardware problem or a crash in the code that runs before setup() (either ESP SDK code or a static variable's constructor, ugh).

@nyanpasu64
Copy link
Collaborator Author

nyanpasu64 commented Aug 20, 2023

i edited my code to flash the led 5 times on setup().

Haven't gotten any image loss in a month or so. I'm suspecting a brownout event where the GBS draws too much power for the 5V charger (or the GBS/ESP's step-down regulators) on startup, and sleeping for 500ms (or more? IDK, I could probe the voltage lines with a scope) might be enough to prevent it from ever happening.

It could also be caused by a long USB cable plugged into the ESP (with the ESP's USB 5V trace cut) with a large ferrite bead around it, causing power transmission line ripple? I doubt it's affecting power considering the ESP's 5V line is cut, but I'll try plugging that back in and see if it happens in the future it's already plugged into the GBS but just not the computer.

@nyanpasu64
Copy link
Collaborator Author

Did some quick scope testing:

  • Sometimes when plugging in a barrel jack, there will be multi-volt spikes in the 5V rail for extremely brief periods (static electricity rather than conductor chatter?) hundreds of milliseconds before power is supplied.
  • With my "do nothing but flash the LED on power up" firmware installed, the power rail voltage jitters slightly (for 200ms-1s) on startup. It appears that the smoother you plug the barrel jack in, the less the voltage fluctuates (so sloppy plugging will cause worse power supply while the power connector is moving).
    • I also installed a Noctua 40mm fan to cool the GBS-C. When it is plugged in, the power voltage may or may not be slightly more fluctuating for 150-250ms after plugging in power.

I'd sleep 500ms on power-up before doing any sort of intensive work on the ESP or talking to hardware.

@nyanpasu64 nyanpasu64 linked a pull request Sep 19, 2023 that will close this issue
1 task
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 a pull request may close this issue.

1 participant