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

Screen goes black #3

Open
theflynn49 opened this issue Feb 5, 2024 · 14 comments
Open

Screen goes black #3

theflynn49 opened this issue Feb 5, 2024 · 14 comments

Comments

@theflynn49
Copy link
Contributor

theflynn49 commented Feb 5, 2024

Sometimes, the screen goes totally black, until reboot while playing Catskillvania.

  • it's probably not a hardware problem because it happens to my two boards, even if I switch screens
  • it happens only during transitions condo<->hallway or menu->hallway
  • sometimes instead of totally black it turns blueish, indicating a probable screen failure due to comm errors

this patch fixes the problem
file Catskill.ino
line 377 is
nextFrameFlag -= 2;
should/be
nextFrameFlag = 0 ;

  • I don't provide a PR because I have no idea why this fixes the problem. To my understanding, this only avoids successive continuous frames to be sent to the screen whenever there is a contention. I am not totally satisfied by this explanation.

Nevertheless this may help some poor soul having the same problem.

note : symptom looks like if you program your pico at 133Mhz; SPI clock goes berserk and screen goes black very often. I made this mistake too.

@benheck
Copy link
Owner

benheck commented Feb 5, 2024 via email

@theflynn49
Copy link
Contributor Author

@benheck : thank you for your answer !

Nevertheless, I failed to be completely clear : despite running at 125Mhz, it still fails once a minute or so.

I tried a zillion things, but to fix this the only thing I found is to reset nextFrameFlag to 0 line 377 of Catskill.ino

jF

@benheck
Copy link
Owner

benheck commented Feb 5, 2024 via email

@theflynn49
Copy link
Contributor Author

Thanks again for your help.

I am using Waveshare's ST7789 1.3 inches from Amazon (France), and I even tested with 2.0 inches models since I ordered the wrong type at first. Same symptoms with all screens.

Maybe I am using a different version of compiler, or so, and it generates something a little too slow. May I try the exact same uf2 file you are using to discard this hypothesis ?

On another hand, the problem always happen during condo<->hallway transitions, or menu -> hallway, and never ever at some other time, which seems to imply that the external flash operation collides somehow with something, and that it is not hardware related.

jF

@theflynn49
Copy link
Contributor Author

Hello again. I've been working on this lately, and the following scope capture might well be where the problem is. The trigger is (magically) set to show exactly when the screen freezes.
Yellow = SPI clock (screen) Blue = DC to screen
The yellow block is slightly shorter than the normal ones (as I see on other captures) 15.8ms instead of 16.4ms which seems to indicate that the transfer was somehow aborted.
Why would DC go low before the end of the previous block ??
snapshot_dso_01_01_03_07_37
This capture is made with your version of Catskill.ino. With the "nextFrameFlag = 0" patch, there is no more block collision.

@theflynn49
Copy link
Contributor Author

@benheck : Hello ; I am confident I finally nailed it, I made a PR for this, I hope you like it.
My Best.

@benheck
Copy link
Owner

benheck commented Feb 7, 2024 via email

benheck added a commit that referenced this issue Feb 7, 2024
Fix issue #3 sounds good to me!
@theflynn49
Copy link
Contributor Author

No no new game unfortunately :D I was testing on Bud Game; but this issue is time-related and I am convinced that my batch of screens are more sensible to aborted frames, because these aborted frame are systematic in the transitions hallway<->condo, but don't necessarily lead to a black screen.

Anyway, the bug is obvious once you get in the logic there.
Thank you for the PR, feels good, and for the Bud Game which is really fun to play :D

@benheck
Copy link
Owner

benheck commented Feb 9, 2024 via email

@theflynn49 theflynn49 reopened this Feb 25, 2024
@theflynn49
Copy link
Contributor Author

theflynn49 commented Feb 25, 2024

@benheck
Hi Ben !

I just found another nasty bug involving this issue, so I reopen it.

In state 0 or 1 of LCDlogic() in gameBadgePico.cpp, I wait for the previous DMA cycle to be completed, but I also MUST wait for the SPI to be quiescent to go on with the next cycle, because the first thing it's going to do is toggling the screen's DC signal while the SPI is still sending its data if the timing is playing with us.

Note that in state3, you don't have to do that, because the DMA is handling the SPI correctly while the screen stays in DATA mode.

I can make a PR for this if you want, let me know, or you can take the version in my fork.

Rgds
jF

@benheck
Copy link
Owner

benheck commented Feb 25, 2024 via email

@whatskenmaking
Copy link
Collaborator

@theflynn49 thanks for jumping in! Quick question for you - which version of the gameBadge are you using, 3 or 3B?

@theflynn49
Copy link
Contributor Author

@kenstcyr Hi there. I use both. Both work well.

@theflynn49
Copy link
Contributor Author

@kenstcyr ... After re-reading this, I think you want to know with what version I experienced these screen problems ... I was using mainly the version 3.

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

No branches or pull requests

3 participants