Hello!
I am trying to bring life to an Arduino TFT LCD on my NucleoF446RE, using STM32CubeIDE.
On its back it says it is the 3.97" type, and refers to the mcufriend website.
So I was wondering if I could use the MCUFRIEND library with my Nucleo.
I saw an older topic about this, according to that there is a cut-down Adafruit-GFX library that the MCUFRIEND_kbv requires, which I couldn't find.
Can anyone help?
-Peter
-
Install the Arduino IDE on your PC. (download from this site)
-
Tools->Board->Boards Manager : install STM32 Cores by STMicroelectronics version 1.8.0
-
Tools->Board : Nucleo-64
-
Tools->Board Part Number : Nucleo F446RE
-
Tools->Port : your COM port for F446
-
Tools->Library Manager : Install Adafruit_GFX and MCUFRIEND_kbv
-
File->Examples->MCUFRIEND_kbv : graphictest_kbv
-
Plug the Shield into the Nucleo header sockets.
-
Run all the library examples
-
All the examples should run out of the box on your Nucleo-F446
-
Report any problems.
No, I have never run MCUFRIEND_kbv from STM32CubeIDE. Please start with Arduino IDE.
If and when you have everything running on Arduino IDE, I might attempt STM32CubeIDE.
David.
Thank you for the help.
I done these steps, and tried the graphictest_kbv, aspect_kbv and the Font_simple, but I only get white screen so far.
Little update: The blinking example works fine.
Any idea what is wrong?
Take notes on paper. Number the steps.
Then you have created a "checklist".
Repeat the steps from your checklist. Use a real pencil to "tick" each step.
If you have a problem, you can post your checklist. And describe how and where things go wrong.
Are you familiar with the Arduino IDE e.g. for Uno, Due, ... ?
If it is your first time, I would buy / beg / borrow a Uno clone. And start from scratch.
Running Blink.ino or asciitable.ino should work exactly the same on the Nucleo as on a Uno.
Typing a checklist into a PC or running trivial sketches may sound like hard work. But it only takes an hour of your life. And you will get accurate answers.
The Arduino Forum works pretty well.
The AvrFreaks Forum often has message threads that extend to weeks (when typing full information would have solved the problem in the first reply)
David.
What TFT controller is reported by the Uno ?
I would expect modern controllers like ILI9341 to cope with the F446 speed.
ILI9320, SPFD5408, ... may be too slow.
If I have your controller, I will try it with library v2.9.8-Release on a Nucleo-F446RE board.
David.
I'm not quite familiar with the Arduino IDE. I have an UNO, and have only ran a few example codes so far.
The Blink.ino and ASCIITable.ino examples works both on UNO and Nucleo.
The MCUFRIEND_kbv examples only works on UNO. (On Nucleo, white screen so far.)
Here's my checklist:
-
Arduino IDE 1.8.12 installed
-
Adafruit_GXF and MCUFRIEND_kbv library installed
-
STM32 Cores 1.8.0 by STMicroelectronics installed
-
Nucleo-64 Board + Nucleo F446RE Board Part Number selected
-
3.97" TFT LCD inserted on the Arduino ports of the Nucleo
-
Connect USB, COM Port selected.
-
Tried examples: graphictest_kbv, aspect_kbv, Font_simple, TouchScreen_Callibr_native
-
Compile, Upload done. "1 File(s) copied Upload complete on NODE_F446RE (F:)"
-
White screen
The Driver IC is ILI9486.
Update: According to Google, the LCD controller is ST7793. Not sure which one is which.
I ran the diagnose_TFT_support sketch.
It says: ID = 0x7793
According to the mcufriend_how_to.txt:
ST7793 240x400 ID=0x7793 #define SUPPORT_B509_7793
I just tried my ILI9486 Shield with v2.9.8-Release.
v2.9.8-Release is happy with reading ID, running graphictest_kbv.ino, ...
It does Adafruit Tests in 1.94 sec. F_CPU=180MHz
Which is pretty good for a 320x480 screen.
v2.9.9-Beta is happy with reading ID, running graphictest_kbv.ino, ...
It does Adafruit Tests in 2.36 sec. F_CPU=180MHz
Do the examples read the ID correctly ?
Have you tried forcing the ID ? e.g. tft.begin(0x9486);
The Beta is "safer" with the speed.
-
Leave the IDE.
-
Delete the current MCUFRIEND_kbv
-
Download the Beta from GitHub i.e. download master Branch as ZIP
-
Run the IDE
-
Sketch->Include Library->Add .ZIP library
-
Run MCUFRIEND_kbv examples.
David.
Edit. What ID is reported by the Uno ?
What is reported by LCD_ID_readreg.ino ? (you can run this on Uno or Nucleo)
If you really have a Sitronix ST7793 it is a 240x400 controller.
v2.9.8-Release has #define SUPPORT_B509_7793
by default
It might be fussy about the speed.
It works!! 
I deleted v2.9.8, and downloaded the master zip (v2.9.9) and added manually as you said.
After that, all the examples worked except for touchscreen.
I checked the Serial Monitor during the sketches both with UNO and Nucleo, and it said it's 0x7793 every time.
As you said, I also tried to force the IC (tft.begin(0x9486)
which resulted white screen.
No doubt, my IC Driver is ST7793 after all...
The TouchScreen_Callibr_native sketched worked perfectly on UNO, but on Nucleo it only shows the instructions and won't detect the touch. (Even if I force it with tft.begin(0x7793)
"Not possible to diagnose Touch pins on ARM or ESP32"
What I need is to use it as part of a project, as header and source files in C in CubeIDE.
Can I ask what kind of workflow would you do in my place?
Look at the pins diagnosed by the Uno. Or measure resistance with a DMM. Put "these" pins into the Calibration sketch.
The Touch will work if you have got the right pins. In fact, I can even detect which "good pins" are X or Y. I will put this into the master Branch soon.
David.
Update:
I got my first pixel using the STM32CubeIDE!
For some reason it not uses the top of the screen
And I'll change the us delays, and gpio initializations
But it should be easy from now on 
Do you have a GitHub account?
It would be a good idea to Fork MCUFRIEND_kbv. Then we could cooperate with STM32CubeIDE.
David.
Yes, I commit my code from time to time, however my goal is just not losing any progress.
I made a .h and a .c file, but I only kept, what I need exactly for NucleoF446RE.
If you think it can be helpful, I send them to you of course.
However I would still fix a few things before that.
If you Fork, you can create as many branches as you like.
Others can access your code. And offer "Pull Requests" or simply contribute "Issues"
It might even encourage me to try STM32CubeIDE.
Even so, I am happier with neutral IDEs like Keil or Rowley.
David.
Hi, it's me again!
I would like to ask for help with displaying colored bitmaps.
I managed to get to work your pushColors and pushColors_any functions on Nucleo.
What I'd like to ask is what procedure do you suggest, if I want to display any image from my PC?
I would also like to ask, what is the difference these functions, and the Adafruit's drawRGBBitmap functions?
-Peter
You have a Cortex-M4. Plenty of oomph for decoding .BMP, .JPG, .PNG, .GIF format images.
.JPG, .PNG, .GIF all compress the image data. Decoding the compressed data requires SRAM and CPU power.
.BMP formats have no compression. Which is why you can display with a Uno. But they waste a lot of disk space on a SD card.
drawRGBBitmap() expects you to know the geometry. And just consists of raw 16-bit pixels. It requires even less power than .BMP files.
I strongly suggest that you use conventional .JPG (or .BMP) files. These contain geometry and format information in the header. And most importantly: they can be displayed on any PC, Internet, ...
David.
Thank you again, it works! 
I used this converter:
http://www.rinkydinkelectronics.com/t_imageconverter565.php
(I found another topic about this, where you suggested this.)
And then the "void drawRGBBitmap(int16_t x, int16_t y, const uint16_t *bitmap, int16_t w, int16_t h);" function from the Adafruit library.
As for the monochrome pictures, I found out that using Gimp, I can easily convert pictures to a X-Bitmap. Then the Adafruit drawXBitmap will do the job.
-Peter
When you install a new Arduino library, run all the examples that come with the library.
From memory, the drawBitmap_kbv.ino sketch shows you how to use the Adafruit_GFX methods.
the bitmap_RGB.h says:
// several programs can convert BMP, JPG, PNG images to C arrays of pixels
// these used the utility bundled with UTFT.
// Online tool at http://www.rinkydinkelectronics.com/t_imageconverter565.php
the bitmap_mono.h says:
// http://skaarhoj.com/FreeStuff/GraphicDisplayImageConverter.php
There are many online tools for preparing image arrays
There are many applications that might use embedded images.
If the example does not show what you want, say so.
Make a suggestion for improving the example(s).
David.