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

Getting Stuck in st7789_init #4

Closed
TheCustomFHD opened this issue Nov 26, 2023 · 6 comments
Closed

Getting Stuck in st7789_init #4

TheCustomFHD opened this issue Nov 26, 2023 · 6 comments

Comments

@TheCustomFHD
Copy link

I tried Connecting the CBerry28, an old Raspberry Pi Screen to the Pico using this, as the documentation of it states that it is using this chip. I have added some Blinking as a form of Debug so i can see where the Pico is at at a Moment, since i cant get a USB Serial Connection to work on this Project. It seems to not get past the st7789_init for some odd reason, im fairly sure i have connected everything correctly, here is my Pin Mapping to this Display:

VIN = 3.3V | Display Pi Pin = 1 | Pico Pin = 3.3V
GND = GND | Display Pi Pin = 6 | Pico Pin = GND
SCK = Clock | Display Pi Pin = 23 | Pico Pin = GPIO 18
MOSI = SDA | Display Pi Pin = 19 | Pico Pin = GPIO 19
CS = CS | Display Pi Pin = 24 | Pico Pin = GPIO 17
RST = RST | Display Pi Pin = 22 | Pico Pin = GPIO 21
D/C = RS | Display Pi Pin = 15 | Pico Pin = GPIO 20 (High = Control Word - Low = Display Word)

Backlight = 5V | Display Pi Pin = 2 | Pico Pin = 5V VBUS
Display Pin 17 is connected to Display Pin 12, to get a 100% Duty Cycle Signal for the Backlight to turn on.

I have this Set-Up connected via Jumper Cables. Id be curious to know where i went wrong with using your library, so that i wouldn't need to attempt to code my own one just to see that i wired something up wrong or forgot to tell your library a specific thing.

I know this might not be a code related issue, but it not returning from that init function, makes me hope you could have an idea of whats going on. I've mainly tried the blink example. Thanks in advance!

@TheCustomFHD
Copy link
Author

TheCustomFHD commented Nov 26, 2023

The Documentation for it:
https://www.admatec.de/pdfs/C-Berry28.pdf

Although i think i might have found the issue.
Nevermind, i still haven't found it.
I have tried multiple different pins on the screen that could remotely reference what this library needs, but it kind of just refuses to go past the init phase.

So on a educated guess, either

  1. This Library doesn't like this Screen and gets invalid Responses from the Screen and thus gets Stuck in the Init.
  2. This Library is getting Stuck in the Init because the Init has a small issue that this Screen shows.
  3. Wiring is incorrect and im just simply not smart enough (i am not hooking everything up at once to it, each signal only to one pin, but it has multiple pins that could get the same signal (multiple pins are mentioned as a CLK, or SDA/MOSI/RXD/TXD)

@sandeepmistry
Copy link
Member

Hi @TheCustomFHD,

If you unplug all the wires does the board get past the init function? st7789_init only sends commands and does not receive any responses.

@TheCustomFHD
Copy link
Author

Hello and sorry for the late reply @sandeepmistry ,

I have just now attempted to just run the uf2 of the blink example with nothing connected. it blinks before the function. but it refuses to blink anywhere after the function call. If it doesnt get any informations (which it looks like), then im confused where it could be hanging/crash on. To be clear, im running this on a standard Pico, not a Pico W, and its running at the stock speeds, and i compiled on Linux (Arch Linux, up to date if that matters, perhaps a compiler bug?)

@TheCustomFHD
Copy link
Author

TheCustomFHD commented Feb 12, 2024

(This is invalid, ignore this comment)
My Bad. Apparently the CBerry28 actually uses a RAIO RA8870, which could explain a lot.
(To be fair, the documentation around this thing in general is very poor and misleading.)
Guess ill have to write a Driver for that at some point. Thanks for the Patience, ill mark this as closed.

@TheCustomFHD TheCustomFHD closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2024
@cshaa
Copy link

cshaa commented May 15, 2024

Hey! I have a Pico W and I'm also getting stuck on the init function – even if I disconnect all pins. Here's my project that reproduces the problem.

EDIT: It appears to hang on this line:

// SWRESET (01h): Software Reset
printf("This line gets executed");
st7789_cmd(0x01, NULL, 0);
printf("This one doesn't");
sleep_ms(150);

What I find weird is that if I add a printf to the very start of st7789_cmd, it doesn't get executed either. Maybe it crashes elsewhere, but doesn't flush the stdio buffer or something. (It was just my silly JS dev ass that mistakingly using single quotes for a string.) I'll investigate further.

EDIT 2: It seems to be a timing issue. The more printf I add, the further I get before it crashes. By filling the init function with printfs, I managed to get past the init function, and now it crashes on the first pixel write.

EDIT 3: By adding printfs even to st7789_write and st7789_ramwr, I got the blink example to work, albeit very slowly. I am clueless why the Pico crashes once I remove the printfs and don't know how to debug this timing issue.

EDIT 4: I was able to prevent the Pico from crashing by swapping all the sleep_us(1) for sleep_ms(10). Now it runs, albeit very slowly.

@cshaa
Copy link

cshaa commented May 16, 2024

I found out the actual cause of the problem, and opened issue #5 for it.

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