Adafruit_ILI9341_STM – nothing on display

michael_l
Tue Jul 19, 2016 2:23 pm
I guess I’m asking for some help to get something to display on this 2.2″ ILI9341 SPI TFT Touch display. Serial monitor prints data but display just stays black. I’m using ST-Link V2 dongle for uploading.

I’m running stm32_graphicstest with these defines:

#define TFT_CS PB4 //10 pin 3 10
#define TFT_DC PC15 // 9 pin 5 9
#define TFT_RST PB3


ahull
Tue Jul 19, 2016 4:33 pm
Check what I am about to suggest very carefully. You appear to be powering the display from 3.3V, however it appears to have a LDO voltage regulator (marked U1) on it, so check that you should not be powering it from 5v, or perhaps link out J1 on the display and power it from 3.3V without the LDO voltage regulator.

Check that I am correct before you try this obviously, or you will have purchased your membership of the stm32duino magic smoke club.
Note. I didn’t check any of the other pins. We can do that once we are happy that we have the correct power.


martinayotte
Tue Jul 19, 2016 4:38 pm
ahull wrote:or you will have purchased your membership of the stm32duino magic smoke club.

michael_l
Tue Jul 19, 2016 8:22 pm
Some progress.. I connected LED pin into one of 3.3V pins and now I have white screen but nothing else. So it seems the display is sort of ‘alive’ :)

ahull
Tue Jul 19, 2016 8:49 pm
michael_l wrote:Some progress.. I connected LED pin into one of 3.3V pins and now I have white screen but nothing else. So it seems the display is sort of ‘alive’ :)

michael_l
Tue Jul 19, 2016 9:27 pm
Swapping pins did not help. Serial monitor shows debug prints okay. I am beginning to think that they sold me some ili9340 instead of ili9341. Tomorrow I’ll check that it gets enough power.

michael_l
Fri Jul 22, 2016 7:19 am
So far I have flashed with st-Link V2 dongle. I re-flashed stm32duino bootloader back and thought to try with that. to my surprise it works and demo program runs just great!

I don’t know what to think about this. If I flash the basic ‘blink’ program it works when flashing via ST-Link dongle.


stevestrong
Fri Jul 22, 2016 7:34 am
michael_l wrote:Some progress.. I connected LED pin into one of 3.3V pins and now I have white screen but nothing else. So it seems the display is sort of ‘alive’ :)

michael_l
Fri Jul 22, 2016 8:14 am
stevestrong wrote:michael_l wrote:Some progress.. I connected LED pin into one of 3.3V pins and now I have white screen but nothing else. So it seems the display is sort of ‘alive’ :)

stevestrong
Fri Jul 22, 2016 8:22 am
Yes, I read it.
But I don’t really think that it goes wrong during flashing with the dongle.
To further check the issue, you should monitor the supply voltage and SPI lines in both cases.
When you are using the bootloader, the dongle is not connected anymore, right? So the power supply has different condition.

michael_l
Fri Jul 22, 2016 2:27 pm
I have ST Link dongle pins connected all the time on the board.

If I flash with bootloader and power device by the same USB or by connecting ST-LINK –> OK.
If I flash with ST Link and power device by USB or by connecting ST-LINK (or have both connected) –> Not OK.

Something goes not right when flashing with ST-Link or is my thinking not correct here.. please help :-)

EDIT: I verified flash contents with STM32 ST-Link utility. The flash contents are identical to the file. Does bootloader load something into memory during startup – something that does not happen when there is no bootloader ?


ahull
Fri Jul 22, 2016 3:25 pm
I suspect that you have some serial enumeration issue, or there is something specific in your code that is causing the behaviour.
Try a simple blink sketch using both methods. I use ST-Link all the time, and don’t have any issues.

michael_l
Fri Jul 22, 2016 3:31 pm
ahull wrote:I suspect that you have some serial enumeration issue, or there is something specific in your code that is causing the behaviour.
Try a simple blink sketch using both methods. I use ST-Link all the time, and don’t have any issues.

ahull
Fri Jul 22, 2016 3:39 pm
michael_l wrote:ahull wrote:I suspect that you have some serial enumeration issue, or there is something specific in your code that is causing the behaviour.
Try a simple blink sketch using both methods. I use ST-Link all the time, and don’t have any issues.

michael_l
Fri Jul 22, 2016 3:44 pm
ahull wrote:michael_l wrote:ahull wrote:I suspect that you have some serial enumeration issue, or there is something specific in your code that is causing the behaviour.
Try a simple blink sketch using both methods. I use ST-Link all the time, and don’t have any issues.

michael_l
Fri Jul 22, 2016 4:45 pm
Is it normal that bolded code is printed ? {upload.altID} {upload.usbID} — should these be the actual values ?? These must be set some script

Sketch uses 25,916 bytes (39%) of program storage space. Maximum is 65,536 bytes.
Global variables use 11,904 bytes of dynamic memory.
C:\Users\mika\Documents\Arduino\hardware\Arduino_STM32/tools/win/stlink_upload.bat COM19 {upload.altID} {upload.usbID} C:\Users\mika\AppData\Local\Temp\builde7beee08ccdcd28160514e2a426c5306.tmp/rtos_blink_mika.ino.bin
STM32 ST-LINK CLI v2.1.0
STM32 ST-LINK Command Line Interface

ST-LINK SN : 48FF6C064970535623390887
ST-LINK Firmware version : V2J24S4
Connected via SWD.
SWD Frequency = 1800K.
Connection mode : Normal.
Device ID:0x410
Device flash Size : 64 Kbytes
Device family :STM32F10xx Medium-density

Loading file…
Flash Programming:
File : C:\Users\mika\AppData\Local\Temp\builde7beee08ccdcd28160514e2a426c5306.tmp\rtos_blink_mika.ino.bin
Address : 0x08000000
Flash memory programming…
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± 0%
0%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ 29%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ 59%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ 88%ÛÛÛÛÛÛ 100%
Flash memory programmed in 2s and 74ms.
Programming Complete.

MCU Reset.

Application started.


ahull
Fri Jul 22, 2016 8:43 pm
I’m using Linux, so I have no idea what those lines *should* look like, but they do look reasonable.

What I see is something like..
Sketch uses 16,604 bytes (12%) of program storage space. Maximum is 131,072 bytes.
Global variables use 2,720 bytes of dynamic memory.
USB Status [ttyACMx] 2016-07-18T12:50:15 INFO src/stlink-common.c: Loading device parameters....
2016-07-18T12:50:15 INFO src/stlink-common.c: Device connected is: F1 Medium-density device, id 0x20036410
2016-07-18T12:50:15 INFO src/stlink-common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
2016-07-18T12:50:15 INFO src/stlink-common.c: Attempting to write 16604 (0x40dc) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08004000 erased
2016-07-18T12:50:16 INFO src/stlink-common.c: Finished erasing 17 pages of 1024 (0x400) bytes
2016-07-18T12:50:16 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2016-07-18T12:50:16 INFO src/stlink-common.c: Successfully loaded flash loader in sram
16/16 pages written2016-07-18T12:50:16 INFO src/stlink-common.c: Starting verification of write complete
2016-07-18T12:50:17 INFO src/stlink-common.c: Flash written and verified! jolly good!

USB Status [ttyACMx] Waiting for tty device /dev/ttyACM3

/dev/ttyACM3 should now be available.


bhaskins
Sat Jul 23, 2016 2:47 am
I have two of these and I’m running 3.3v on both supply and backlight (led).
I did not short J1, Seems to work fine that way.
Both are tied up at this time, one is on a F4 Nucleo and the other is on a RPi3, but I hope to try them soon with stm32duino.
What demo are you using?

michael_l
Sat Jul 23, 2016 12:01 pm
ahull wrote:I’m using Linux, so I have no idea what those lines *should* look like, but they do look reasonable.

What I see is something like..
Sketch uses 16,604 bytes (12%) of program storage space. Maximum is 131,072 bytes.
Global variables use 2,720 bytes of dynamic memory.
USB Status [ttyACMx] 2016-07-18T12:50:15 INFO src/stlink-common.c: Loading device parameters....
2016-07-18T12:50:15 INFO src/stlink-common.c: Device connected is: F1 Medium-density device, id 0x20036410
2016-07-18T12:50:15 INFO src/stlink-common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
2016-07-18T12:50:15 INFO src/stlink-common.c: Attempting to write 16604 (0x40dc) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08004000 erased
2016-07-18T12:50:16 INFO src/stlink-common.c: Finished erasing 17 pages of 1024 (0x400) bytes
2016-07-18T12:50:16 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2016-07-18T12:50:16 INFO src/stlink-common.c: Successfully loaded flash loader in sram
16/16 pages written2016-07-18T12:50:16 INFO src/stlink-common.c: Starting verification of write complete
2016-07-18T12:50:17 INFO src/stlink-common.c: Flash written and verified! jolly good!

USB Status [ttyACMx] Waiting for tty device /dev/ttyACM3

/dev/ttyACM3 should now be available.


michael_l
Sat Jul 23, 2016 4:40 pm
I tried this in my Nucluo F103RB and setup extra pins like this and the display works just fine. Nucleo has onboard ST Link.

#define TFT_CS PC13 //10 pin 3 10
#define TFT_DC PC15 // 9 pin 5 9
#define TFT_RST PC14 // 8 pin 4 8

So my conclusion is that I’ve chosen “wrong” pins in BP that don’t play ball when flashing with St Link because they don’t get initialized.. *OR* stm32duino bootloader does init some pins in a way that makes it work


zmemw16
Sun Jul 24, 2016 1:18 am
you’ve 4 wires to the stlink? ? ? one is its 3v3 output.
you only need to connect 3; swclk, swdat and then gnd to the common ground of pill and display.

stephen


RogerClark
Sun Jul 24, 2016 11:13 am
Some STLink modules have 3.3V, Reset, SWDIO, SWCLK and GND. However I’ve never found that connecting the Reset line made any difference

Anyway, the 4 wires could be Reset, SWDIO, SWCLK and GND and still would not include 3.3V


zmemw16
Sun Jul 24, 2016 12:36 pm
duh of course it could marked as 3v3 and be linked internal to the ‘stlink’ pcb as an adc input.
all my usb ‘clone’ stlinks, it’s 3v3 and seems sufficient to power the board.
just thought it was worth mentioning as a doubt about the power supply aspect had been raised earlier in the thread.

stephen
<edit more correctly defined 3v3 & adc f/back /edit>


michael_l
Sun Jul 24, 2016 3:31 pm
OK, more testing.. I finally got it demo working with BP with these pin settings and flashing with ST Link.

#define TFT_CS PC13
#define TFT_DC PC15
#define TFT_RST PC14

PC13 is user led but that does not seem to bother.

So for some reason using these and flashing with ST Link result in white screen. Are these pins okay to use ?

#define TFT_CS PB4 //10 pin 3 10
#define TFT_DC PA15 // 9 pin 5 9
#define TFT_RST PB3 // 8 pin 4 8


Leave a Reply

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