STM32F4 problem with TFT_ILI9163 128x160

Hello guys,

I have the STM32F407VE generics and a TFT_ILI9163 128x 160 is SPI but i cannot send data to them.
i have a WHITE screen and sometimes a dark lines

in platformio io i have this

[env:genericSTM32F407VET6]
platform = ststm32
board = genericSTM32F407VET6
framework = arduino
upload_protocol = stlink
monitor_speed = 115200

and my code test only to the screen

/*
Turn display ON/OFF - this command it's almost unusable since it doesn't control the backligh
It result in a white screen!
*/
 #include <arduino.h>
 #include <pins_arduino.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <TFT_ILI9163C.h>
//#include "stm32f4xx.h"

// Color definitions
#define	BLACK   0x0000
#define	BLUE    0x001F
#define	RED     0xF800
#define	GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0  
#define WHITE   0xFFFF

/*
Teensy3.x and Arduino's
 You are using 4 wire SPI here, so:
 MOSI:  11//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
 MISO:  12//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
 SCK:   13//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
 the rest of pin below:
 */
 
#define TFT_CS     PB9 
#define TFT_RST    PA8                  
#define TFT_DC     PB6  
#define TFT_SCLK   PB3     
#define TFT_MOSI   PB5  
#define TFT_brilho PC6 
/*
Teensy 3.x can use: 2,6,9,10,15,20,21,22,23
 Arduino's 8 bit: any
 DUE: check arduino site
 If you do not use reset, tie it to +3V3
 */


TFT_ILI9163C tft = TFT_ILI9163C(TFT_CS, TFT_DC, TFT_RST);
                      //TFT_ILI9163C tft = TFT_ILI9163C(TFT_CS, TFT_DC, TFT_RST,TFT_MOSI,TFT_SCLK);
                      //SPIClass SPI_3(SPI3, TFT_MOSI, iso, TFT_SCLK);


void setup() {
  
  tft.begin();
  tft.fillScreen(0xF81F);


}

void loop(void) {
  tft.display(false);
  delay(1000);
  tft.display(true);
  delay(1000);
}

I tried to do what this seller says

first i have problems :
with not found [wiring.h]
with avr/io.h
and now
fatal error: libmaple/libmaple_types.h: No such file or directory

Hm OK I got the compilation working with a few hacks. Repo: GitHub - maxgerhardt/pio-stm32-ili9163C: An example of using the ILI9163C display with the STM32 Arduino Core

Changes:

  • remove include <wiring_private.h> in TFT_ILI9163C.cpp. The needed definitions are already pins_arduino.h.
  • remove the same type of include from the Adafruit GFX library code

I guess this library just isn’t exactly made for the STM32 version of the Arduino Core.

Morever, when building you’ll get an error that the symbol end is not defined but is needed by sbrk.c, which responsible for heap management (malloc()). The linker script has a “bug”. It doesn’t define the symbol end but the symbol _end. I will open an issue in PlatformIO for this. You need to fix that now by doing the following:

Go into your PlatformIO home folder (C:\Users\<user>\\.platformio for Windows, /home/<user>/.platformio for Linux/Mac). Then to packages\framework-arduinoststm32\STM32F4\variants\generic_f407v\ld. Edit the file common.inc.

There is a section that reads

    .bss :
      {
        . = ALIGN(8);
        __bss_start__ = .;
        *(.bss .bss.* .gnu.linkonce.b.*)
        *(COMMON)
        . = ALIGN (8);
        __bss_end__ = .;
        _end = __bss_end__;
      } > REGION_BSS

You need to change it to the following:

    .bss :
      {
        . = ALIGN(8);
        __bss_start__ = .;
        *(.bss .bss.* .gnu.linkonce.b.*)
        *(COMMON)
        . = ALIGN (8);
        __bss_end__ = .;
        _end = __bss_end__;
        end = _end;
      } > REGION_BSS

Then it will compile.

Oh you already opened issue STM32F103rb and platfomio io and adafruit GFX · Issue #180 · platformio/platform-ststm32 · GitHub I see.