TFT_eSPI_Master Pin Defines

Hi Everyone

Arduino 1.8.12

For STM32F103C Generic with the official STM32 STMicroelectronics core.

I am testing the Library from Bodmer for the ILI9163..only white screen.

So not sure how to define the pins and cannot find MOSI and SCK in the Setup files, I added a Blink in setup on PC13 for the on board led.

I tested with (13,HIGH) , (C13,HIGH) , (PC13,HIGH) the compiler does not give any errors but the Led lights up and stay on.

void setup(void) {
  tft.init();

  tft.setRotation(1);

  pinMode(PC13, OUTPUT);
  digitalWrite(PC13, HIGH);
  delay(2000);
  digitalWrite(PC13, LOW);
  delay(2000);

}

The Led should go OFF and stay OFF ..But it stays on.

Am I using the wrong core ?

Thanks in advance.

Have you tried LED_BUILTIN?

Yep Led stays on , only when used in TFT_eSPI_Master.

void setup(void) {
  tft.init();

  tft.setRotation(1);

  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(PC13, HIGH);
  delay(2000);
  digitalWrite(PC13, LOW);
  delay(2000);

}

But when I start a new sketch with only Blink in the Led pulse on_off.

void setup()
{
  pinMode(PC13, OUTPUT);
}

void loop()
{
  digitalWrite(PC13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(PC13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

So your LED pin is also part of your SPI interface?

No.

CS - A1
DC - A0
RST - A2
MOSI - A7 Connected to TFT.But dont know were it is defined.
CLK - A5 Conected to TFT.But dont know were it is defined.

Even if PC13 is used in the library the led must switch off in the Setup and stay off for 2Secs if the Led comes back on I will know that PC13 is used in the library.

This is then a incorrect defining of my pins as I said I could not find MOSI and SCK in the Library user Setup files.

I suggest that you start with :
C:\Users\David\Documents\Arduino\libraries\TFT_eSPI\User_Setups\Setup32_ILI9341_STM32F103.h

and just edit the controller to be ILI9163_DRIVER and appropriate geometry.
in other words compare Setup32 with Setup3

The pin "names" look wrong to me. A1 would be Analog #1 and D1 will be Digital #1. PA1 will be PORTA.1 PD1 will be PORTD.1 (if your STM32 has a PORTD)

I know that I have used TFT_eSPI with NUCLEO-64 and NUCLEO-144 which have Analog # and Digital #

I am not sure about using TFT_eSPI with a BluePill. Please tell us how you get on.

David.

1 Like

Hallo David.

This is what I done so far , but still no working ILI9163. I do not use CS this pin is hard wired on the display ..works 100% with a Nano.

In User_select_setup.h..line 26

// Only ONE line below should be uncommented.  Add extra lines and files as needed.

#include <User_Setup.h>           // Default setup is root library folder

//#include <User_Setups/Setup1_ILI9341.h>  // Setup file configured for my ILI9341
//#include <User_Setups/Setup2_ST7735.h>   // Setup file configured for my ST7735
**#include <User_Setups/Setup3_ILI9163.h>**  // Setup file configured for my ILI9163
//#include <User_Setups/Setup4_S6D02A1.h>  // Setup file configured for my S6D02A1
//#include <User_Setups/Setup5_RPi_ILI9486.h>        // Setup file configured for my stock RPi TFT
//#include <User_Setups/Setup6_RPi_Wr_ILI9486.h>     // Setup file configured for my modified RPi TFT
//#include <User_Setups/Setup7_ST7735_128x128.h>     // Setup file configured for my ST7735 128x128 display
//#include <User_Setups/Setup8_ILI9163_128x128.h>    // Setup file configured for my ILI9163 128x128 display

In User_setup.h..line 42

// Only define one driver, the other ones must be commented out
//#define ILI9341_DRIVER       // Generic driver for common displays
//#define ILI9341_2_DRIVER     // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER      // Define additional parameters below for this display
**#define ILI9163_DRIVER**     // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER

In Setup3_ILI9163 ..line 10

// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
//#define TFT_CS   PIN_D8  // Chip select control pin D8
**#define TFT_DC   PA0**  // Data Command control pin
**#define TFT_RST  PA1**  // Reset pin (could connect to NodeMCU RST, see next line)
//#define TFT_RST  -1  // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V

In User_setup.h..line 257

// ######       EDIT THE PINs BELOW TO SUIT YOUR STM32 SPI TFT SETUP        ######

// The TFT can be connected to SPI port 1 or 2
#define TFT_SPI_PORT 1 // SPI port 1 maximum clock rate is 55MHz
#define TFT_MOSI PA7
#define TFT_MISO PA6
#define TFT_SCLK PA5

I have lost the plot somewhere. I strongly advise you to post the whole Setup file. Either by editing Setup32 or by copy-pasting an edited Setup32 to a new custom_Setup file.

Please post a link to the actual ILI9163 display that you have bought.

I possess a BluePill and have two ILI9163 displays. But both have CS.

David.

Thanks David.

I followed your advice and my ILI9163 is working from my STM32F103C "Bluepill"

I did not buy the display so there is no link ..I took it out of a faulty Router board .

The display uses a 18pin ribbon cable. App 9 mm wide.

My display does have the CS PIN but I just hardwired the pin since I dont use any other serial device on SPI port.

So far only tested the Ellipse example.

I strongly advise using CS pin at all times.

No, I had not used TFT_eSPI with BluePill. But I have now. With two different schemes: SPI1_ALT and with SPI2.

Oh, and I installed the new HID Bootloader on both BluePills.

David.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.