Pictures soon! Working code first 🙂
Added Proof Image :
I have also been working on getting thjis particular screen to work with the STM32F4, but have had no luck with the board I currently have.
To learn the STM32F4, I thought I’d get a board with some cool hardware to start with, so I got the Mikromedia STM32F4 board. Turns out, the compiler they have that works with that board called MikroC PRO for ARM has closed-source and encrypted libs. So, you can’t see the source they use to drive the LCD. I tried to write my own driver, but never could get it to work. So I thought I’d start with some hardware that I DO know. I ported the Arduino library over and used the CrossWorks compiler for ARM. I have done some other work with that compiler with that particular Mikromedia board, so I trusted it. I wrote the code, wired up the Shield….still no luck.
So, I grabbed your code from PasteBin and modified it to work with my connections. STILL no luck.
Part of me believes there is something up with the timer code (both yours AND mine) for this board.
My code was written to use a simple SysTick timer to insert the delays, not much different than yours. But I found that when I passed in a millisecond value over ~15 ms, the timer ran far too long. A 500 ms delay ran for over a second. a 1000 ms delay ran for over 10 seconds. BUT…if I used 5 ten millisecond delays, or 10 ten-millisecond delays, the timers ran almost perfect (but still slightly slow).
At this time, I still haven’t been able to get the TFT to work that was on the board when I bought it without using their compiler with the closed-source TFT library. And I haven’t been able to get the Arduino shield to work either.
Any suggestions you have on the timer issue would be much appreciated. Any tips or tricks you have pertaining to the Arduino shield, I’d love to hear those, too.
Thanks for your efforts!
My code works 100%… are you pulling the RESET line high? That was my issue. The reset line for LCD is connected to RESET on arduino.I had my board working but had to use the breadboard so i removed the wires before i took a picture. Just check the reset and all data lines are ok.
So, this is really weird. I did have the reset line pulled high using one of the GPIO pins. However, I saw that the Arduino RESET line is a 5V line, but my GPIO was only putting out 2.9V, so I tied the RESET to a 5V out on the Discovery board. Problem still not solved…..
I attached the debugger and went to work, stepping through the code a line at a time. Here is where it gets pretty weird. Your code was looking for the 0x5408 code to come back when the driver IC was queried. On my chip I was getting a return of 7783. Very strange. I changed the first part of the IF statement to look for that code and HOLY CRAP….it kind of worked. I could see the black background and the color-changing squares. But, there were colored lines showing up obscuring the screen.
I looked at the Arduino code that comes with the TFT and found that some of the init commands and their values you were sending to the driver were different than the commands and values being sent by the Arduino code. I changed everything to what my code had, and it worked perfect.
Then I put it down to take a break. A few hours later I came back to it and, wow, it didn’t work…again!
Fired up the debugger again and…wtf…the driver code I was getting back this time was 8377. It switched the first 2 digits and the last 2 digits. The code didn’t change at all.
My permanent fix will ultimately be to find out why that is happening and to fix it. Of course, I could just eliminate the IF statement altogether since I know I won’t ever be using another TFT. But for now, I just have the code checking to see if the driver IC code returned != 0x00000000. If anything at all is returned, I know the TFT communicated and I execute the first chunk of code.
If you want some pics to post on this blog of the wiring and proof that your code works, let me know and I’ll send them to you. Who knows, this info may save someone else hours of debugging and head-scratching.
I also plan to organize this code into a reusable library and add some other functionality like buttons, gradients, various fonts, etc. etc. If you want my updated code, I’d be more than happy to share it with others.
Thanks for your reply offering help!
Hey buddy, sorry for the late reply. There are different IC codes per LCD… the lib has 2.
it checks for the 0x5408 and if its there it inits it and if not it runs the other init code for other LCD.
7783 = St7781 IC for LCD… be sure to look up that LCD and init info for it… something that should help is:
0x5408 = SPFD5408A based TFT
0x7783 = ST7781R based TFT
Feel free to email me any images with text you want and ill post it 🙂
Thanks for all the help and suggestions. It is a bit confusing because the SeeedStudio Wiki for these shields specifically states that v1.0 of this shield used the SPFD5408A driver instead of the ST7781 driver. I guess that is not true at all in my case.
Yeah, I saw that you had that IF statement allowing other TFT drivers to fall through to the other init code…but when mine did that, it still didn’t work for whatever reason. I haven’t looked to see if those init values are the same as the Arduino library values.
Luckily, I already had the init commands and values for that LCD. I pulled all of that straight from the Arduino libs. However, I plan to look at the code you posted the link to to see if there is anything in there as far as TFT functionality that I don’t have yet.
I have pics ready that I took today. Where should I send them? Email address?
Np, learning is half the fun.
Please log in using one of these methods to post your comment:
You are commenting using your WordPress.com account.
( Log Out /
You are commenting using your Google account.
( Log Out /
You are commenting using your Twitter account.
( Log Out /
You are commenting using your Facebook account.
( Log Out /
Connecting to %s
Notify me of new comments via email.
Notify me of new posts via email.
Create a free website or blog at WordPress.com.