Arm Mbed OS support forum

UniGraphic library with boards


I am using the UniGraphic library with differents boards (SPI1 : PA7…PA4, ILI9341 display, Mbed Studio, MBed-OS 6.3.0).
STM32F103RCBT6 (NUCLEO-F103RB) : it works.
STM32F407ZGT6 (Seeed Arch Max) : it works.
STM32F411CEU6 (NUCLEO-F411RE) : it does not work.
Tested with 2 STM32F411CEU6 on SPI1 and SPI2 (Mbed studio and online compiler), the screen stay white. Any idea what is wrong?

Hello Alain,

The following wiring worked for me on an STM32F411CEU6 (Blackpill) board:

ILI9341 tft(SPI_8, 10000000, PA_7, PA_6, PA_5, PA_4, PB_0, PB_1, "tft"); // SPI type, SPI speed, mosi, miso, sclk, cs, reset, d/c

The LED pin was connected to the +3.3V rail over a 100 ohm resistor.
Verify also the reset and d/c connections on your board.

I hope it helps you make it work.

Best regards, Zoltan

Hi Zoltan,

Replaced PA_3 and PA_2 with PB_0 and PB_1. Led connected to 3v3 through 4k7. Unlucky, it does not work. Maybe a crazy chinese board (two from the same provider). The size of the board and the flash memory size are perfect for me, but… I will try later with the STM32H743VIT6 and STM32F407VGT6 boards and another TFT.
The simple code:

#include "mbed.h"

#include “ILI9341.h”
#include “Arial28x28.h”

// PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC
ILI9341 lcd(SPI_8, 10000000, PA_7, PA_6, PA_5, PA_4, PB_0, PB_1, “tft2.8”, 240, 320) ;
static BufferedSerial pc(PA_9, PA_10);

// Mandatory to avoid crash (no RTC)
time_t read_rtc(void) {
return 0;

char a_out[128];
int main()
attach_rtc(&read_rtc, NULL, NULL, NULL); // Mandatory to avoid crash (no RTC)


lcd.background(Black); // 16bit: R5 G6 B5
lcd.set_font((unsigned char*)Arial28x28);
lcd.printf ( "Initialisation ");


while (1)


Best regards,

I have some custom target definitions that can be used with some of the mentioned boards.
It works with mbed-cli, maybe now also with Mbed-Studio.

A 4k7 (4700 ohm) resistor seems to be too much. It did not work for me when tested. Try 56 ohm or use a PwmOut without an external current limiting resistor (there should already be installed a small on-board one) to drive the LED back-light. When using a PwmOut start with a short duty cycle, like 10% (0.1) and gradually increase it until you get a good result. Please notice that there is no PwmOut available on the PB_2 pin. The following worked for me:

PwmOut  backlight(PB_10);
int main()

Thank you Johannes for sharing your custom targets. They are really helpful! I’m already using some of them for a while :slight_smile:

Great! I‘m still updating and trying to fix problems. I‘ve just updated clock for F401 for USB.
And the H743 has still some problems with USB, it is doing really strange things :slightly_frowning_face:.

Tested with an 100 ohms resistor. The screen is more white but it does not solve the problem. Is possible to read the TFT and see if he replies? TFT model: 2.8 "série SPI ILI9341.

Based on the info above I guess the issue relates to the Mbed target board rather than to the Display board. Try to step through the code in debug mode.

You can try this:

// mem write/read test
unsigned short  readback;
unsigned short  color = 0x10000;
bool            readerror = false;

tft->pixel(0, 0, color);         // write
readback = tft->pixelread(0, 0); // read

if (readback != color) {
    readerror = true;
    printf("pix %.4x readback %.4x\r\n", color, readback);
printf("pixelread test %s\r\n", readerror ? "FAIL" : "PASS");

Hi Zoltan,

I am afraid the 2 boards I have are sick:
pix 0 readback ffff
pixelread test FAIL
Back to a STM32F103RCBT6 and there it works (pixelread test PASS).

I have found: " We are committed to always use the best raw material, using the latest chips, users get the best user experience, improve the efficiency of development, from the picture we can know is the 014 batches of chips, The 14th week of 2020 , is in the middle of march to make chips, batch is very new, user experience is very good!!! But piracy often USES is very ancient vintage chips, such as the recent discovery of piracy is 537 batches of chips, 15 years of production , all over the past five years"

The 2 “bad” boards are “537” batches of chips. I just ordered the “14” model. We will see!

Best regards,


Hello Alain,

Thank you for the info. It can be useful for others struggling with such chips.

Once you get it this Mbed pinout could be handy.

Good luck, Zoltan

Hi Zoltan,

The pinout is a little more complex. I have replaced PA7 by PB5 (both MOSI1) and now the SPI works (pixelread pass)! But the display is still not working. Luck is needed…