STM32F103C + ILI9341 + Adafruit_GFX_AS

sajuukKahr
Mon Jan 30, 2017 11:09 pm
Hello,

I’ve been trying to interface a STM32F103C blue pill (china bought) with a ILI9341 but to no luck.

CS=PA2
D/C=PA1

MOSI=PA7
MISO=PA6
SCK=PA5

VCC 3.3V/5V (the unit is 5V compatible, tried both)
triple checked the connections
tried the second display still nothing

What I am using to test the display: https://github.com/rogerclarkmelbourne/ … cstest.ino


zmemw16
Tue Jan 31, 2017 12:48 am
how to structure this? probably not too great.

arduino_stm32 as of when?
arduino ide version?
operating system?

it’s a blue pill, R10 is 10k please check? no is good, 1k5 is excellent. yes, well some enumerate, some don’t, some can’t decide.
(at some point maybe replace 10k with 1k5 smt, add a 1k8 smt on top or add a1k8( leads) to appropriate pins.)
(usb ports and hubs appear to influence it as well, with one of my 7 port hubs devices are seen ok in the first 4, a bit weird after)

have you programmed the blink sketch and it works?
repeat with half the low time and double high time, as expected? ( some boards have the 1hz blink already in)
you edited the graphics test for your cs and d/c pins? connected the backlight (with a resistor?? to ?? 3v3?? to 5v??)

:?: is there a ‘suggest you purchase’ paragraph anywhere?

you have ordered a st-link usb stick (about $2 .. $4, maybe 2 and definitely another pill, history and forum would maybe suggest a Baite multi-pack of Mini’s ) ?
soldering iron ?? solder?? flux?? Baites are typically supplied with headers unsoldered; also modules.
also some dupont 40 wire strips all 10cm, each of female – male, female – female, male – male?
all 3 means doubling to what you want in length and of course dupont’s give you 10 colours
sadly the female sockets are good for maybe 3 insertions, one way, rotate 90, hope
i tend to to apply a rubber band in a 9 loop around the wires and hook the other side of board/bread board, so
add bag of rubber bands :)

hth
stephen


sajuukKahr
Tue Jan 31, 2017 9:17 am
The board is working properly from what I can tell. R10 came as a 103 replaced with 1k (till I get the 1.5k smd resistors).

The board was tested with blink and serial communication. The board gets recognized by the system and can be flashed via USB. (see reflection :D )

I flashed the graphic test via usb and serial but to no luck.

At first I tried custom pin configuration but since I was not getting any success I just wired the lcd to the board like the sketch is already configured so I do not have to edit the sketch all the time.

the unit is running at 72mhz.

the backlight resistor is irrelevant as you would be able to see the output with an external light. but yeah, backlight was connected to 5v with 4k7, 3.3v even 3.3v directly.


stevestrong
Tue Jan 31, 2017 10:11 am
Any info (link) about the display?
Many displays are supposed to be an ILI9341 but they aren’t.

What exactly means “no luck”?
Could you read the ID successfully?
What is shown in the serial monitor?

Do you own a scope to check the SPI signals?


sajuukKahr
Tue Jan 31, 2017 2:39 pm
the unit: tjctm24028-spi
https://www.aliexpress.com/item/2-4-240 … e32a7c1489

OUTPUT:
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark Time (microseconds)
Screen fill 170820
Text 43020
Lines 243833
Horiz/Vert Lines 15845
Rectangles (outline) 11599
Rectangles (filled) 355071
Circles (filled) 144677
Circles (outline) 173061
Triangles (outline) 60156
Triangles (filled) 166877
Rounded rects (outline) 59812
Rounded rects (filled) 416086
Done!

The display does not display anything (both lcd units)…and no, sorry I do not have a oscilloscope to debug this.


stevestrong
Tue Jan 31, 2017 2:49 pm
How did you set the RST, DC and CS pins in the demo sketch? Can you show us?
The default setting in the demo sketch uses pins of Adafruit shield, which can be totally inappropriate in your case.
Also, be sure that you define the pins using “PAx” style instead of pure numbers.
I would recommend to use the RST line, too:
#define TFT_DC PA1
#define TFT_CS PA2
#define TFT_RST PA3
Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST);

sajuukKahr
Wed Feb 01, 2017 5:57 pm
CS=PA2
D/C=PA1
RST=PA3

MOSI=PA7
MISO=PA6
SCK=PA5

Screen is black.
tried both constructors
Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST);
and
Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

The unit is 5v compatible and tried both 5v and 3.3v. the unit does not have any 3.3V converter on the back.

I am trying to get an arduino uno to display on the screen….but any idea is welcome.


sajuukKahr
Wed Feb 01, 2017 8:13 pm
confirmed working on Arduino Uno with library https://github.com/gmtii/ili9341-arduino will work with 3.3V only (I guess the seller scammed me a bit on the 5v compatible bit). The Adafruit_GFX_AS is not working at all with any voltages….

Will try to compile the library on STM32 and see the result.


BennehBoy
Wed Feb 01, 2017 10:27 pm
Standard adafruit gfx library works fine for me on stm32 – coupled with ssd1306 (standard again) using software SPI – apologies if I’ve missed the point, maybe just try the bog standard adafruit libraries?

stevestrong
Thu Feb 02, 2017 7:09 am
Are you sure it is the GFX lib problematic? Did you try to set different background colors, let say, to change in a 2 second interval?
As BennehBoy said, it should run with standard Adafruit GFX lib, as my ILI9486 lib does as well.

sajuukKahr
Thu Feb 02, 2017 8:22 am
I am using Adafruit_GFX_AS.h since Adafruit_GFX.h is giving me errors like methods not defined in the class:
tft.setCursor(0, 0);
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1);
tft.println(“Hello World!”);
I get compiler errors on setCursor, setTextColor, println and so on.

sajuukKahr
Thu Feb 02, 2017 9:26 am
stevestrong wrote:Are you sure it is the GFX lib problematic? Did you try to set different background colors, let say, to change in a 2 second interval?
As BennehBoy said, it should run with standard Adafruit GFX lib, as my ILI9486 lib does as well.

stevestrong
Thu Feb 02, 2017 12:42 pm
Sorry, I forgot to tell you that the mentioned ILI9486 lib works at the moment only in conjunction with the SPI lib from my repo.
https://github.com/stevstrong/Arduino_S … raries/SPI
because it includes some features which are not yet committed in the official STM32duino repo.

stevestrong
Thu Feb 02, 2017 12:46 pm
sajuukKahr wrote:I am using Adafruit_GFX_AS.h since Adafruit_GFX.h is giving me errors like methods not defined in the class:
tft.setCursor(0, 0);
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1);
tft.println(“Hello World!”);
I get compiler errors on setCursor, setTextColor, println and so on.

sajuukKahr
Thu Feb 02, 2017 3:58 pm
working with you SPI and GFX libs.

Not working via USB bootloader upload and 3.3v.
Programmed via serial…


victor_pv
Thu Feb 02, 2017 4:55 pm
sajuukKahr wrote:confirmed working on Arduino Uno with library https://github.com/gmtii/ili9341-arduino will work with 3.3V only (I guess the seller scammed me a bit on the 5v compatible bit). The Adafruit_GFX_AS is not working at all with any voltages….

Will try to compile the library on STM32 and see the result.


BennehBoy
Thu Feb 02, 2017 5:05 pm
The base adafruit_gfx library now includes custom font provision. See my lrduino repo for example usage of it btw.

stevestrong
Thu Feb 02, 2017 5:17 pm
sajuukKahr wrote:working with you SPI and GFX libs.

Not working via USB bootloader upload and 3.3v.
Programmed via serial…


sajuukKahr
Thu Feb 02, 2017 7:10 pm
I know it is weird…I can see output on serial either via A9 and A10 or the usbmodem.
Programming via USB I could get the Blink to run (standard test on board upon arrival) outputed some serial text.

What I observed:
1) smt32flash can’t wake the device after DFU flash
2) flashed sketch via USB will not run = black screen

flashing the sketch via serial = works like a charm


stevestrong
Thu Feb 02, 2017 7:24 pm
Please post here the complete Arduino IDE log output, including compile and USB flash process.
Btw, do you select the different upload methods in the IDE menu? For USB upload you have to select “Stm32duino bootloader”.

Ok, i just realised you are on Mac os, and selected the right upload method.
I have to pas, i have no Mac, so i cannot help you any further.


Angr77
Wed Jan 02, 2019 12:39 pm
Hi!

I have been playing around with a 2.8″ SPI display with the ILI9341 standard. After much searching I found this thread. (There is a lot of threads about this…but none exactly how to create some kind of baseline and get your display working with Blue Pill)

Backgound
I am using a Blue Pill board (64K) and manage/updates it through a ST-Link. So far it was working great!
However, I had problems to get the display to work – it was just showing a complete white screen. However I could see that my program was running and the screen was flashing when pressing the reset button on Blue Pill.

The connectors used:

#include "SPI.h
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341_STM.h"
#define TFT_DC PC14
#define TFT_CS PC15
#define TFT_RST PA3

//Ref these pins are connected also / If not connected there is no way to get it going at all...
//#define TFT_MOSI PA7
//#define TFT_MISO PA6
//#define TFT_CLK PA5

Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC);

///plus the screen code from Adafruit…


Leave a Reply

Your email address will not be published. Required fields are marked *