cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I have this TFT SPI Touch Display ILI9341, program Arduino 1.6.5., and developement board STM32F103C8T6. And I need initialize the display.I have program, but all Power Mode, MADCTL Mode is 0xFF !!! on output.WHERE I HAVE PROBLEM ????? code is in deta

TZ
Associate

#include <Adafruit_GFX.h> // this line I have added

#include "SPI.h"

#include "Adafruit_GFX_AS.h"

#include "Adafruit_ILI9341_STM.h"

// For the Adafruit shield, these are the default.

#define TFT_DC   PA0   //  (Green) 

#define TFT_CS   PA1   //  (Orange) 

#define TFT_RST   PA2   //  (Yellow)

// STM32 - TFT

// 5v  - VCC

// GND  - GND

// PA0  - DC

// PA1  - CS

// PA2  - RST

// PA5  - SCK

// PA6  - MISO

// PA7  - MOSI

// 5v  - LED A

Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST); // Use hardware SPI 

void setup() {

 Serial.begin(115200);

 Serial.println("ILI9341 Test!"); 

 tft.begin();

 // read diagnostics (optional but can help debug problems)

 uint8_t x = tft.readcommand8(ILI9341_RDMODE);

 Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);

 x = tft.readcommand8(ILI9341_RDMADCTL);

 Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);

 x = tft.readcommand8(ILI9341_RDPIXFMT);

 Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);

 x = tft.readcommand8(ILI9341_RDIMGFMT);

 Serial.print("Image Format: 0x"); Serial.println(x, HEX);

 x = tft.readcommand8(ILI9341_RDSELFDIAG);

 Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); 

  

 Serial.println(F("Benchmark        Time (microseconds)"));

 Serial.print(F("Screen fill       "));

 Serial.println(testFillScreen());

 delay(500);

 Serial.print(F("Text           "));

 Serial.println(testText());

 delay(3000);

 Serial.print(F("Lines          "));

 Serial.println(testLines(ILI9341_CYAN));

 delay(500);

 Serial.print(F("Horiz/Vert Lines     "));

 Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));

 delay(500);

 Serial.print(F("Rectangles (outline)   "));

 Serial.println(testRects(ILI9341_GREEN));

 delay(500);

 Serial.print(F("Rectangles (filled)   "));

 Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));

 delay(500);

 Serial.print(F("Circles (filled)     "));

 Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

 Serial.print(F("Circles (outline)    "));

 Serial.println(testCircles(10, ILI9341_WHITE));

 delay(500);

 Serial.print(F("Triangles (outline)   "));

 Serial.println(testTriangles());

 delay(500);

 Serial.print(F("Triangles (filled)    "));

 Serial.println(testFilledTriangles());

 delay(500);

 Serial.print(F("Rounded rects (outline) "));

 Serial.println(testRoundRects());

 delay(500);

 Serial.print(F("Rounded rects (filled)  "));

 Serial.println(testFilledRoundRects());

 delay(500);

 Serial.println(F("Done!"));

}

void loop(void) {

 for(uint8_t rotation=0; rotation<4; rotation++) {

  tft.setRotation(rotation);

  testText();

   

  delay(1000);

 }

}

.................................

3 REPLIES 3

tft.readcommand8 probably does not work as you intend.

There's not much arduino help here. You may want to go the stm32duino forum.

JW

TZ
Associate

please, in the ILI9341 on board is (microcontroller) PCD8544 or MIO283QT9A or what ???

PCD8544 is controller to drive old-style segment black and white LCDs, it has nothing to do with ILI9341.

JW