-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
supported? 7 pins -> without CS pin? #178
Comments
One gotcha that has been reported with CMake is that when changing the controller type, one may need to manually delete the file CMakeCache.txt from the build directory (or delete the whole build directory). Other things to try may be to test if the display is not compatible with Line 102 in 30b9738
by replacing that line with #define UNLOCK_FAST_8_CLOCKS_SPI() ((void)0) Apart from that, can't immediately think what might be the fault. May need to snoop the bus with a logic analyzer to figure the issue out. The ST7789 display I wrote the driver implementation against was this: https://www.adafruit.com/product/3787 |
thanks for your fast thoughts on this.. as a nooby and as a general question: i dont get errors after starting the buildfile, what should i expect to see on the spi-display? my display stays black all the time...(not in python, there it is fine and working with same wiring) i am connected via ssh, there is no hdmi or any other peripherial than the st7789 display. [as a sidenote: while the executable is running, i can start the python lib&script and get output on the display from the python script (a clock). shouldnt there be a confict for dual use? or is this ok? ]
i am on latest raspian and kernel: Raspbian GNU/Linux 10
|
The idea of the CS (Chip Select) pin is to allow chaining multiple SPI devices onto the same data&clock bus, where the CS pins are used to select which of the connected devices the host wants to talk to at any given time. On many displays I have the CS pin can just be connected to ground to make them behave "always-on", but I do have one display that also needs to receive the CS pin high->low edge transitions in order to "wake up" to process any incoming commands. So the answer for "is CS pin needed?" is "it depends on the display". Given that your display already works without a CS pin using the other library clearly shows that the CS pin is not needed for your particular display. When you don't provide the pin number for fbcp-ili9341, it will just ignore that and not use it when driving the display. By default when you start up the display, you should see the default framebuffer 0 of the linux. If you are booting to command line mode, I believe the fb0 should be showing a text entry asking to log in to the Pi. If you run any graphical program, it should show that program instead. Also given that you don't specify -DSTATISTICS=0 override to CMake, it means the driver should be showing a performance statistics overlay on the screen, so even if there is nothing showing up on the Pi linux framebuffer, the perf overlay should at least be getting displayed. You can try uncommenting Line 21 in 662e8db
There will certainly be a conflict. If the python clock script does not hang on the display, then it means that fbcp-ili9341 was probably not actively printing out any bytes to the bus. There is an internal debug config Line 18 in 662e8db
that can be used to see what activity happens on the bus. Hmm, looking at the pin wiring.. having trouble verifying the pins from that photo.. do you have the green reset pin connected to CE0 pin on the Pi? If so, try moving it to another general BCM? pin on the Pi that does not have a special function. |
thanks for explanation. i assue that the fcp-ili9341 is still not working well, even when the binary seem running without errors... i dont change any wiring and the python lib is working well on the same raspberry. the reset cable is wired to gpio/bcm 25 = pin 22. i dont see any problems, but i can try a different pin/bcm ---addition: |
i guess my raspberry is a model B, rev2.
|
Yes, the pin numbering that is used is the BCM pin names convention. The reason to avoid Pi’s CE0 line is that it is used by the Pi’s hardware SPI0 chip, so it may cause a conflict. |
Great, yeah, that looks all correct as far as the wiring goes. Unfortunately I am out of ideas on what would be wrong. Other things you could try is to uncomment Line 111 in 662e8db
and then delete all the display initialization and reset related code in https://github.com/juj/fbcp-ili9341/blob/master/st7735r.cpp#L10 , and then see if fbcp-ili9341 is able to drive the display after first using the working python driver. If it does, then it suggests that the initialization sequence in fbcp-ili9341 is not compatible with the display. |
thats was it. something in the init is not right. tomorrow will be another day (to go further) ... thx again for now, great help! |
Nice! You may be able to improve performance by reducing CDIV to a smaller value from 40. My ST7789 display was able to reach up to CDIV=4. (85MHz bus speed) |
after some testing and reboots: INIT: SPI on works: Rotation:
the rotation brings distortion/scaling... any hint to get this right? |
i read your instructions again and added:
now this is correct. (only left to figure out the init...) |
python-lib starts the display with reset and init: https://github.com/solinnovay/Python_ST7789/blob/master/ST7789/ST7789.py#L204 how to test and transfer this to fbcp-ili9341 ? |
i am a horrible coder, just a general noob ... 🤡 seems that a possible init is already there (whats this how to set code and option for another init like the python one? |
Fbcp-ili9341 specifies the command-data sequences as strings on one line. The first character is the command byte, and the subsequent characters are the data bytes. E.g. Line 39 in 662e8db
is the same as |
ok, my display seems to need a sequence. i can fiddle in my code-files and report if it works. i will report success/fail and than you can see if you want to make this an -DST or --Option? |
i tried to port only the hex-binary init-sequence from the python-lib to a place in the .cpp init (all at random place, i guess), but it did not work out yet. dont know if the SPI must somehow initialized... still trying to get it in order...
|
Still fails to inittried to sort it with fiddling, but still only python init works.
😢 fail: fbcp-ili9341 works only after previous init with the python-lib. Question of a NOOB:Differences in python? --> see image2
How do i test further to get the right init commands copied over from the python-lib? IMAGE 1: IMAGE2: |
Huuu, whats this? [edit: NO, i tried it, but screen stays black with my tft... 😢 ] |
no initialize with fbcp-ili9341 i tried your first suggestion without success. 😢 i tried the change from the fork without success. 😢 👍 running fbcp-ili9341 after the python init works alltimes fine. 😕 my last clue is that is something with 1) spi-mode. 2) spi_clock/timing or 3) DC-settings while commands. this is the transfered cmd-sequence from the python-lib, but still does not init standalone...
|
digged the internet, another fork seems again to have patches for my display... so i googled and found, that my display needs SPI mode 3 !!!!!! |
thats the end of my google wisdom. i dont see how to set mode 3 like this on SPI in your code.... |
Interesting find, that might be the reason. To configure SPI mode 3, you can add #define DISPLAY_SPI_DRIVE_SETTINGS (1 | BCM2835_SPI0_CS_CPOL | BCM2835_SPI0_CS_CPHA) in e.g. after line Line 16 in 662e8db
Or alternatively replace this line: Line 83 in 662e8db
|
you shed a light of hope...i will try... thx |
😿 sadly that all does not help to init the display. if i configure SPImode=3 like suggestest, stopping the fbi-ili9341 executable breaks the display showing up again with the ext start. if i compile without STILL 😢 i do have to init the display with the python code first, to show anything on fb. as a noob, i am now out of ideas to test (speed/SPI-speed/ clock, order of init-cmds?...dont know.. |
SCK line must be driven high ?as it does not work with code for SPImode=3, do this all need more code change? its above my understanding of SPI, but may you get a clue for something i can test? more on this here, very interesting: maybe the spi-cmds on init fails, for this reason? if is not working for missing CS (who knows?), some crazy guy broke this out. |
still deperate looking or a solution with my limit knowledge, i compared the adafruit init with the python init for the st7789 and found differences in cmd for resolution (0x55 vs 0x05) (sidenote: my fragment of the adafruit init did not resolve the problem) |
That is what Mode 3 means. Having
The fact that the display works with any driver at all definitely means that the display does not need a Chip Select line. Lacking a CS line will just mean that you cannot connect a second SPI display or other device, like touch controller, on the same line.
Both 0x05 and 0x55 should result in the same 16-bit 64KB color format for SPI displays. Iiuc the high nybble is only in effect when using the RGB color mode of the interface. According to the data sheet: No harm to pass 0x55 there though to reduce a source of differences. The CASET and RASET commands are not part of the initialization sequence. They are sent hundreds of times per frame at display runtime when uploading pixel commands. If you did not do any other modifications to fbcp-ili9341 except to remove all the init code when you got it working, then it means that fbcp-ili9341 is successfully sending the CASET and RASET messages to the display to upload pixels. |
now confued using google: i found a different init-sequence: https://www.newhavendisplay.com/app_notes/2-4TFT_ST7789.txt i crosschecked some slight differenences, but my python-init still works. for reference:
|
uhh sorry, i did not notice your posting... thanks for still giving me some feedback
yes, i am only fiddling with the init code in fbcp-ili9341 st7735r.cpp....but nothing helps. my goal was to only run the compiled fbcp...executable to show the framebuffer on the tft. but i can reproduce the sequence with python and the compiled executable to get working tft-display. i am bit lost in space, and still think hopefully only the init-sequence in st7735r.cpp must be tewaked? |
thats what i have at the minute:
|
out of ideas, again. 😭 What works:
Conclusion:
Help needed: Python works, Why?why does the python-lib init the display correct, so that afterwards the fbcp-ili9341 excecutable can display the FB ? |
Success. it runs!(details following: i guess that SPI mode 3 and RESET in init has done the trick) |
only SPI-mode=3 does the trick. i fiddeld too much with code,
after that line in Line 16 in 662e8db
like you suggested before(#178 (comment)). Gotcha. Success. |
Hey, that is great to hear! Made a TODO to make that a build option. It seems that different instances of the same controller out there may need to use a different SPI mode. So far my experience had been that if one had a certain type of controller (ILI9341, ILI9486, ST7789, etc.), it would always dictate which SPI mode was needed, but this is the first scenario that shows that it is not so: your display with ST7789 needs SPI mode 3, whereas my display with ST7789 needs SPI mode 0. So it looks like it needs to be a setting that people can toggle on their own. Interesting. I'll close this bug out when I have that implementation available. |
Your help was indispensable and great. thanx a lot. the maintainer of the TFT_eSPI has also build option for the SPI-Mode=3 variant as a second ST7789 = ST7789_2 https://github.com/Bodmer/TFT_eSPI/blob/master/TFT_Drivers/ST7789_2_Init.h 🤝 |
Hey @ozett! Thanks for collaborating with @juj to solve this issue! I'm sorting through this issue myself (I have the same components you do and am experiencing the same issue) Quick question if you have a moment! Just want to make sure I wired everything up correctly, if you can confirm you have similarly wired everything up. (For reference all of the Raspberry Pi pins I list will be the physical pins)
(If the images aren't clear enough I can try and get better lighting) If possible, could you also provide the solution you used to get it working? (I.e. what file changes you made, what cmake commands you ran to get it running?) Apologies, I'm having a tough time parsing it out from the comments (I'm bad at reading 😂 ) THANKS!! 🎉 P.S. Kick ass eye! Looks great in a 3D printed case! |
colors of your wiring are hard see. code:checkout github code already?
after that line in Line 16 in 662e8db
like the DEVeloper suggested before(#178 (comment)). Wiring is other than yours, this is mine:your wiringyour wiring is different.
and compile with your gpio-pin-nr.
todo:check your the gpio-numbers of your pins and use the correct ones in the compile-command. |
Thank you!! 😁 |
Famtastic to see in picture that you got it working! |
I have 2 of these displays so thank you guys so much for this! Edit, now I've got the first working thanks to your guys excellent instructions. To summarize some of the above discussion and get a working display (if it's like mine) run in the console of your raspberry pi:
Then run
under the line
Then continue with
Then make sure the SPI interface is turned off either in raspi-config or through If you have previously run 'cmake' and would like a fresh start do this:
My wiring is:
Then run the command below changing your wire numbers (if you're using different wiring) for
Finally run
And if your display is like mine (advertised as ST7789 but ended up working with ST7789VW, no cs pin) it might just work! For autorun on startup put this line before
make sure the command is copied exactly; & is there or you might get stuck without being able to boot These lines are in my
And I've made sure that all references to |
@james1236 were you able to get output to 2 screens?? Or do you just have 2 screens haha Just thought I'd ask, that sounds like a pretty sweet setup if you have output to 2 screens. |
Just one screen at a time, I have 2 screens that looked a bit different so them both working was a surprise |
Gotcha! Haha awesome! |
hi,
i trying to get fbcp-ili9341 running. but no success.
instead this python code runs on the same wiring perfectly: https://github.com/solinnovay/Python_ST7789
seems to be a 7789 driver with the CS-Pin missin on my display. this python-lib works.
i tried all this without any reaction on the display.
maybe there is a foolproof way to get an image on the display while this fbcp-ili9341 is running?
this is my wiring. works with the python-example. but with same wiring not with the fbcp-ili9341.
i am on an old rasperry
appreciate any hint/help. thanks
The text was updated successfully, but these errors were encountered: