Skip to content

STM32F103C8T6 - ST7789_test() not working: "flickering" black screen. #39

@Bruur-vr

Description

@Bruur-vr

Hello,

I tried adding your library to a test project in STM IDE (workspace 1.17.0) but I only get a black flickering screen.
I use STM programmer & STlink V2 to download the .hex file.

Board used is and official WeAct Studio BluePill+ (known for being genuine chip), TFT LCD is 1.3inch ST7789 chinese. (When using old libraries and arduino v1.6.5 I can get it to work using same pins: so LCD works (Benchmarked: fillscreen 35Mbps & clearscreen 36Mbps))

I implemented the code by first adjusting the .ioc: clock config on 40Mhz (HCLK) as suggested (I am using dupont wires). And enabled the LSE clock, since it is also connected on the board I have.

Set the prescaler for SPI on 16 to test.

Hardware SPI pins used:
MOSI (SDA) - PA7
SCK (SCL) - PA5
Other GPIO's used as Output push pull, high speed, no Pull-up/pull-down.
(CS - PA4)
DC - PA1
RST - PA0

Then continued to adjust lcd.h file:

/* If u need CS control, comment below*/
//#define CFG_NO_CS

/* Pin connection*/
#define ST7789_RST_PORT GPIOA
#define ST7789_RST_PIN  0
#define ST7789_DC_PORT  GPIOA
#define ST7789_DC_PIN   1

#ifndef CFG_NO_CS
#define ST7789_CS_PORT  GPIOA
#define ST7789_CS_PIN   4
#endif

...

/* Choose a type you are using */
//#define USING_135X240
#define USING_240X240
//#define USING_170X320

In main.c I adjusted the User code begin 2 & User code begin while:

/* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_SPI1_Init();
  /* USER CODE BEGIN 2 */
  ST7789_Init();

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
	  ST7789_Test();
  }
  /* USER CODE END 3 */
}

Multimeter readings (using range 20V DC):

PA7, PA5 & PA0 bounce around up until 3.1V. Other pins stay around 0V

I would appreciate knowing what i'm doing wrong.

(EDIT: trying to correctly format and clearing up what range was used for multimeter)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions