[Guide] ili9341 SPI TFT Screen on Retropie

Various user-contributed guides for hardware-related things
User avatar
moosepr
Posts: 524
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by moosepr » Fri Aug 18, 2017 10:19 am

yeah over-scan would do that. The only problem is that you loose pixels.

you can adjust the over-scan amount to tweak it all

Code: Select all

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=0

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

codeman0624
Posts: 109
Joined: Wed Nov 23, 2016 10:19 am
Has thanked: 3 times
Been thanked: 74 times

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by codeman0624 » Fri Aug 18, 2017 11:10 am

moosepr wrote:
Fri Aug 18, 2017 10:19 am
yeah over-scan would do that. The only problem is that you loose pixels.

you can adjust the over-scan amount to tweak it all

Code: Select all

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=0

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
Is the possibility of losing pixels the only reason you specifically mention in your guide to disable overscan?

Thanks for the help

User avatar
moosepr
Posts: 524
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by moosepr » Fri Aug 18, 2017 11:30 am

It is, when you only have 240x320 you want to keep as many as you can!
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

Lpoolm
Posts: 392
Joined: Thu Jun 09, 2016 4:17 am
Location: uk
Has thanked: 76 times
Been thanked: 51 times

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by Lpoolm » Sun Aug 20, 2017 1:33 am

right, so i now get the white screen but can not get my text to show up, it stays white? is this likely to be the wiring?
20170820_092439.jpg
20170820_092439.jpg (3.67 MiB) Viewed 7898 times
hopefully you can follow the wires :D

gpio layout

vcc - gpio 2
gnd - gpio 6
cs - gpio 8
reset - gpio 25
d/c - gpio 24
mosi - gpio 10
sck - gpio 11
led - gpio 18
miso - gpio 9
Check out my modding and repair channel of retro and modern consoles:
https://www.youtube.com/channel/UCFz7yW ... GtQ/videos

User avatar
moosepr
Posts: 524
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by moosepr » Mon Aug 21, 2017 2:21 am

ah i think you might have pin and gpio mixed up the screen pins tend to be in a bunch near the center of the gpio

kinda like this
Image

the bunch at the bottom are for GPIO buttons

Display--------Raspberry Pi
BL--------------pin 12 (GPIO 18)
SCK------------pin 23 (GPIO 11)
MISO----------pin 21 (GPIO 9)
MOSI----------pin 19 (GPIO 10)
CS--------------pin 24 (GPIO 8)
RST------------pin 22 (GPIO 25)
D/C-------------pin 18 (GPIO 24)
VIN-------------pin 17 (3.3v)
GND-----------pin 20 (GND)
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

codeman0624
Posts: 109
Joined: Wed Nov 23, 2016 10:19 am
Has thanked: 3 times
Been thanked: 74 times

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by codeman0624 » Mon Aug 21, 2017 5:38 am

So some things I learned about SPI screens over the weekend:

To get overscan to work, you need to have it enabled (obviously), but you also need to set overscan_scale=1. This may be set by default, but on my system it was not.

The SPI clock speed does not match the requested speed in the settings. The clock frequency depends directly on the core frequency of the chip. And the core frequency is only divisible by powers of 2. Mine seemed to like its core frequency at 250MHz, which means the only available SPI clock frequencies are 125MHz, 62.5MHz, 31.25MHz, 15.625MHz...etc. So dividing 250MHz by 2, 4, 8, 16, etc.

This was confirmed on an oscilloscope. The SPI clock stayed at 62.5MHz for speed settings of 70000000, and 110000000...it did not change because the core frequency divider was always rounded to 4. When I tried 125000000, I actually got a clock frequency of 125MHz, but the screen was very unhappy.

At 62.5MHz the screen has a pretty decent refresh rate, it's relatively smooth. But I was able to get it to run at 75MHz by setting core_freq=300 in config.txt. Adding this extra 12.5MHz made it look even better, I'm quite happy with the final result.

User avatar
moosepr
Posts: 524
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by moosepr » Mon Aug 21, 2017 6:59 am

@codeman0624 thats some good detective work!! i too have learnt something!!

i did notice that there didnt seem to be much change from 80000000 to 99000000, but then using 100000000 tipped it over the edge.

i really need to get myself a scope!
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

codeman0624
Posts: 109
Joined: Wed Nov 23, 2016 10:19 am
Has thanked: 3 times
Been thanked: 74 times

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by codeman0624 » Mon Aug 21, 2017 7:36 am

moosepr wrote:
Mon Aug 21, 2017 6:59 am
@codeman0624 thats some good detective work!! i too have learnt something!!

i did notice that there didnt seem to be much change from 80000000 to 99000000, but then using 100000000 tipped it over the edge.

i really need to get myself a scope!
That makes sense. I wouldn't be surprised if your core frequency was running at 200MHz. So every setting between 50000000 and 99999999 would give you a SPI clock of 50MHz. Then as soon as you get to 100000000, you actually get a 100MHz clock and then the screen is unhappy.

The one piece of the puzzle I'm missing is what controls the core frequency. I know if you set the core_freq variable in config.txt then the core will be fixed at that frequency. But I do not have a good understanding of what determines the frequency and how it scales if you do not set core_freq to anything. But I did also read somewhere that fbcp potentially maxes out at 300MHz, so I've just stuck with that for now.

A scope is definitely worth the investment!! This is one of the better scope deals I've seen:
https://www.circuitspecialists.com/hant ... 5202p.html

User avatar
moosepr
Posts: 524
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by moosepr » Mon Aug 21, 2017 1:14 pm

Yeah a scoop is on my list of things to buy once I move too a bigger place. Don't have a proper workspace yet
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

User avatar
Holydohnut
Posts: 194
Joined: Wed May 10, 2017 2:02 pm
Has thanked: 29 times
Been thanked: 68 times

Re: [Guide] ili9341 SPI TFT Screen on Retropie

Post by Holydohnut » Mon Aug 21, 2017 1:36 pm

At the moment the guide on page one of this post says to set speed=16000000 Do the conversations above mean we can increase that to speed=99000000 and get a better result with no worries about damaging the screen?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest