UniGraphic library with boards

Hi,

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?

1 Like

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)

sprintf(&a_out[0],“Begin\r\n”);
pc.write(&a_out[0],strlen(a_out));

lcd.background(Black); // 16bit: R5 G6 B5
lcd.foreground(0xE383);
lcd.cls();
lcd.set_orientation(3);
lcd.set_font((unsigned char*)Arial28x28);
lcd.locate(20,100);
lcd.printf ( "Initialisation ");

sprintf(&a_out[0],“End\r\n”);
pc.write(&a_out[0],strlen(a_out));

while (1)
    ;

}

Best regards,
Alain

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()
{
    backlight.write(0.2);
    ...
}

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,

Alain

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…

Alain

Sorry I try to use in arduino nano ble but I have some compile error:

[Error] TFT932x.cpp@33,16: use of undeclared identifier ‘White’

[Error] TFT932x.cpp@34,16: use of undeclared identifier ‘Black’

[Error] TFT932x.cpp@35,5: use of undeclared identifier ‘set_auto_up’

[Error] TFT932x.cpp@63,16: use of undeclared identifier ‘White’

[Error] TFT932x.cpp@64,16: use of undeclared identifier ‘Black’

[Error] TFT932x.cpp@65,5: use of undeclared identifier ‘set_auto_up’

[Error] TFT932x.cpp@88,16: use of undeclared identifier ‘White’

[Error] TFT932x.cpp@89,16: use of undeclared identifier ‘Black’

[Error] TFT932x.cpp@90,5: use of undeclared identifier ‘set_auto_up’

[Error] TFT932x.cpp@170,13: use of undeclared identifier ‘set_width’

[Error] TFT932x.cpp@171,13: use of undeclared identifier ‘set_height’

[Error] TFT932x.cpp@177,13: use of undeclared identifier ‘set_width’

[Error] TFT932x.cpp@178,13: use of undeclared identifier ‘set_height’

[Error] TFT932x.cpp@184,13: use of undeclared identifier ‘set_width’

[Error] TFT932x.cpp@185,13: use of undeclared identifier ‘set_height’

[Error] TFT932x.cpp@191,13: use of undeclared identifier ‘set_width’

[Error] TFT932x.cpp@192,13: use of undeclared identifier ‘set_height’

[Error] TFT932x.cpp@311,5: use of undeclared identifier ‘WindowMax’

[ERROR] .\UniGraphic\Display\TFT932x.cpp:33:16: error: use of undeclared identifier 'White

the code is

#include “mbed.h”
#include “ILI9341.h”

ILI9341 myLCD(SPI_8, 10000000, SPI_PSELMOSI0, SPI_PSELMISO0, SPI_PSELSCK0, p23, p27, p21,“myLCD”); // Spi 16bit, 12MHz, mosi, miso, sclk, cs, reset, dc for minimaple

any ideas? thank

MArco

Hello,

these come from GraphicsDisplay.h so check includes.
Also there were another issues what will be need to fix

BR, Jan

1 Like