STM32F103C8T6 with 3.97" TFT with GxTFT library

Dear friends,

I am trying to put one 3.97" TFT with OTM8009A controller (link 1 bellow) to work with a STM32F103C8T6 (link2 bellow), using GxTFT library (link 3 bellow). I am using the following pins to connect them:

TFT signals D0, D1, D2, D3, D4, D5, D6, D7 connected to PB8, PB9, PB10, PB11, PB12, PB13, PB14, PB15
TFT signals RD, WR, RS, CS connected to PA0, PA1, PA2, PA3
TFT reset signal connected to STM32 reset. VCC (3.3v) and GND properly connected

The problem is how to know where and what changes should be done in the libraries to make the TFT/STM running right !

Does anybody know if there is a step by step script (for dummies) to implement the necessary changes on GxTFT library ?

Any help will be very very appreciated.

  1. 3.97 Inch TFT IPS Touch LCD Display Screen Module High Resolution 800*480 3.97" STM32 Driver IC DIY Kit For Arduino|LCD Modules| - AliExpress

  2. Módulo de desenvolvimento de aprendizagem de sistema mínimo para arduino, placa de desenvolvimento de aprendizagem de arm stm32 para wawawax c8t6|development board|arm development boardarm board - AliExpress

  3. GitHub - ZinggJM/GxTFT: This library separates the aspects IO connection, controller type and display class into separate C++ classes.

Hi Antonio,

I have only experience with this TFT display using 16bit parallel interface.
The display has solder jumpers to select the bus width.
I do not know if the behaviour of the controller changes if 8bit bus width is used.
With 16bit the controller requires 16bit commands instead of the usual 8bit standard MIPI commands.

So most likely your display will not work with 8bit bus with my controller driver for OTM8009A, as this driver is special for 16bit commands.

Note also, that most of my GxIO drivers do not support 16bit commands, they send 16bit commands per default as 2x8bit.

I do not have the capacity to support the use of my GxTFT library for other configurations than the ones I used myself, as my main activity is for the support of e-paper displays.

As far as I know MCUFRIEND_kbv also supports OTM8009A, but I don't know if it uses 8bit or 16bit commands. And I think displays with OTM8009A can vary considerably and use or need different initialization code.

I do have the same display as you, bought recently from the same seller for a test with Arduino Due, to support an other user with a modified IO driver: GxIO_DUE_P16_rDUINO. The display turned out to be identical to the one I already had.

Jean-Marc

MIPI controllers always use 8-bit commands. Regardless of the bus width.

It is only the pixel data that uses the full width of the bus.

An 8-bit bus needs multiple writes to transmit a 16-bit pixel.

I don't think that I do support OTM8009A.
I do support 8080-8 and 8080-16 parallel interfaces. I STRONGLY recommend that you use 8080-8 with your pin-starved BluePill.
If you are prepared to give feedback, I will add OTM8009A.

David.

David, thanks for your reply. Unfortunatelly I can not use your suggestion for use 8080 since my hardware project is ready and it uses a generic blue pill STM32F103C8T6 with that 3.97" TFT OTM8009A controller configured to work with 8 bits. So I think I will be in a deep trouble If I do not find a solution... But thanks anyway PS: Do you intend to add the OTM8009A in your library ?

Jean-Marc, thanks for replay. I will try to find something in mcufriend libraries. Also I am studing what kind of modifications I need to implement on your GxIO drivers to work as I desire. Thanks so much for help.

Antonio

8080-8 is just a name for the 8-bit parallel bus.

Your link does not show the pcb properly. Jean-Marc says that you can select 8080-8 or 8080-16 interface.

David, Antonio,

This display needs a lengthy initialization sequence, with many commands that exist only as 16bit commands. It does not work without. Some may even be missing in the controller specs.

I assume, these commands can be sent as 2x8bit, but I have never tried, and have no test setup, cable bundle or shield, and no 8bit GxIO driver ready to check. And right now I have no time to test, as we get guests in the coming weeks, and it is gardening and holiday season.

david_prentice:
8080-8 is just a name for the 8-bit parallel bus.

Your link does not show the pcb properly. Jean-Marc says that you can select 8080-8 or 8080-16 interface.

Sorry... That links points to portuguese pages.
The correct ones are:

STM32F103C8T6 -> 1 pices STM32F103C8T6 ARM STM32 Minimum System Development Board Module For Sensing Evaluation for Skiller|Integrated Circuits| - AliExpress

3.97" TFT OTM8009A -> 3.97 Inch TFT LCD 3.97" Display IPS Resistance Touch Screen Module Full View HD 800*800 C51 STM32 Driver NT3551 DIY For Arduino|LCD Modules| - AliExpress

AntonioTesta:
David, thanks for your reply. Unfortunatelly I can not use your suggestion for use 8080 since my hardware project is ready and it uses a generic blue pill STM32F103C8T6 with that 3.97" TFT OTM8009A controller configured to work with 8 bits. So I think I will be in a deep trouble If I do not find a solution… But thanks anyway PS: Do you intend to add the OTM8009A in your library ?

@AntonioTesta,

I am interested in finding out how this display works with 8bit interface.

I can find out if it works with the existing controller driver with a GxIO P8 variant of either GxIO_DUE_P16_DUESHIELD (which seems to be GxIO_DUE_P8_DUESHIELD_H), or GxIO_STM32F407ZGM4_P16.

If it works I could create a GxIO_STM32_P8_PB8H for you, with minimal effort, but without test.

But I don’t yet know how fast I can do this, and if it fails I would need to postpone it.

Jean-Marc

ZinggJM:
@AntonioTesta,

I am interested in finding out how this display works with 8bit interface.

I can find out if it works with the existing controller driver with a GxIO P8 variant of either GxIO_DUE_P16_DUESHIELD (which seems to be GxIO_DUE_P8_DUESHIELD_H), or GxIO_STM32F407ZGM4_P16.

If it works I could create a GxIO_STM32_P8_PB8H for you, with minimal effort, but without test.

But I don't yet know how fast I can do this, and if it fails I would need to postpone it.

Jean-Marc

Great... and how can I help you in this job ?

First with patience, and then with testing with GxIO_STM32_P8_PB8H. I will keep you informed here in this topic.

I add some interim information here:

Note that the inking on the bus-width jumpers may be wrong, and the components and layout slightly different from the picture on the web-site. I think they added a backlight control circuit.
The inking on the last picture on the web-site seems correct, top-down: R4, R5, R7, R6.
Selected is R5, R6 for 16bit.

ZinggJM:
First with patience, and then with testing with GxIO_STM32_P8_PB8H. I will keep you informed here in this topic.

I will be waiting very calm, like a first time father to be waiting for his baby !!! rsrsrs

Jean-Marc, I was pushing the 3.97 TFT OTM8009A vendor asking him to inform some way to get his TFT and STM32 working together. He send me the link bellow. I do not know If you had access to the same package. Please take a look and see if that material would help. I am affraid not !!!

Thanks, Antonio

Antonio,

Thanks for the link. I didn't check if it contains exactly the same as the zip-file I got from the manufacturer, but I took a look at the code, and the code is the same. Same initialization code with the same 16bit commands, same code for address window setting.

Sending 16bit commands as 2 x 8bit commands does not work. Therefore for 8 bit interface a different controller code would be needed.

I will take a closer look at this, but this will take more time.

Untitled.jpg

It looks like any command goes to the IR register. For MIPI code commands it seems clear what to send in the case of 8 bit interface, but for the other 16bit commands this is not yet clear for me, how to set the second part of the index.

e.g.

void GxCTRL_OTM8009A::setWindowAddress(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
{
  IO.writeCommand16(0x2A00);
  IO.writeData16(x0 >> 8);
  IO.writeCommand16(0x2A01);
  IO.writeData16(x0 & 0x00ff);
  IO.writeCommand16(0x2A02);
  IO.writeData16(x1 >> 8);
  IO.writeCommand16(0x2A03);
  IO.writeData16(x1 & 0x00ff);
  IO.writeCommand16(0x2B00);
  IO.writeData16(y0 >> 8);
  IO.writeCommand16(0x2B01);
  IO.writeData16(y0 & 0x00ff);
  IO.writeCommand16(0x2B02);
  IO.writeData16(y1 >> 8);
  IO.writeCommand16(0x2B03);
  IO.writeData16(y1 & 0x00ff);
  IO.writeCommand16(0x2C00);
}
void GxCTRL_OTM8009A_P8::setWindowAddress(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
{
  IO.writeCommand(0x2A);
  IO.writeData(x0 >> 8);
  IO.writeData(x0 & 0x00ff);
  IO.writeData(x1 >> 8);
  IO.writeData(x1 & 0x00ff);
  IO.writeCommand(0x2B);
  IO.writeData(y0 >> 8);
  IO.writeData(y0 & 0x00ff);
  IO.writeData(y1 >> 8);
  IO.writeData(y1 & 0x00ff);
  IO.writeCommand(0x2C);
}

Jean-Marc

Untitled.jpg

Jean-Marc,

Meanwhile I am trying to test TFT3.97 8900A configured to 16 bits mode with generic STM32103C8T6. I connect them exactly as shown in GxIO/GxIO_STM32F103C8T6_P16_TIKY.h. Now I am trying to run one exemple such GxTFT_Tiky_graphicstest or GxTFT_graphicstest or GxTFT_myTFTs_graphicstest.

I have included or uncomment on them the following:

#include <GxIO/GxIO_STM32F103C8T6_P16_TIKY/GxIO_STM32F103C8T6_P16_TIKY.h>
#include <GxCTRL/GxCTRL_OTM8009A/GxCTRL_OTM8009A.h>
#include “myTFTs/my_3.97_800x480_OTM8009A_STM32F407ZGM4_FSMC.h”

But all of them issue an error message:


C:\Users…\Documents\Arduino\libraries\GxTFT-master\src\GxIO\GxIO_SPI\GxIO_SPI.cpp: In member function ‘virtual void GxIO_SPI::writeData16(uint16_t, uint32_t)’:

C:\Users…\Documents\Arduino\libraries\GxTFT-master\src\GxIO\GxIO_SPI\GxIO_SPI.cpp:224:11: error: ‘class SPIClass’ has no member named ‘transfer16’

IOSPI.transfer16(d);

It seams someone is trying to send data to SPI interface, that I am not using… Any idea about the reason for this ? Do I made some mistake in configuration ?

Thanks, Antonio

Antonio,

GxIO_SPI is compiled in any case with the actual directory structure of the library. I will check this tomorrow.

I need to know the Arduino package you compile for, board selected and section title.
I am surprised, because most SPIClass(es) do have transfer16.

At the time I created GxTFT there was no official Arduino package for STM32.

Now there is an official package available in Boards Manager:
"STM32 Cores by STMicroelecronics version 1.5.0"
Board Manager section: "STM32 Boards (selected from submenu)"

But this package can't currently be used with GxTFT because of different conditional compile symbols.

Most STM32 targets for GxTFT can be used with this package:
https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/master/STM32/package_stm_index.json
added in preferences as Additional Boards Manager URLs.
selectable in section "STM32 Boards (STM32Duino.com)"

Some STM32 targets can be used by manually adding STM32GENERIC for STM32 Boards:

I check-compiled GxTFT_Tiky_graphicstest.ino with "STM32 Boards (STM32Duino.com)" sucessfully.

Hi.AntonioTesta

#include <GxIO/GxIO_STM32F103C8T6_P16_TIKY/GxIO_STM32F103C8T6_P16_TIKY.h>
#include <GxCTRL/GxCTRL_OTM8009A/GxCTRL_OTM8009A.h>
#include “myTFTs/my_3.97_800x480_OTM8009A_STM32F407ZGM4_FSMC.h”

I,m also doing same thing like you but no error with me.
I’ve not received my display yet.
Ill post update about this tft when I do the tests.
I really love ips displays.

I have updated GxTFT with more support for OTM8009A 16 bit parallel interface mode.

I have added 16 bit command transfers to all GxIO classes for parallel 16 bit interfaces.

I give up to try to support 8 bit parallel interface mode; there is insufficient information available.
(I have seen some source code for STM32 for 8 bit, but this seems to be for MIPI-DSI).

Can anyone help me to understand pros and cons of 8 bit tft display vs 16 bit?

So far as I know 16 bit uses another 8 more connection and 16 bit can display more detail.
But the thing I want to know is about speed.
Which way will have faster refresh rate ?

Regards