Spark Logic

8-bit|16-bit parallell ILI9341

andreas_ferm

Good day everyone, I’m all new to stm32 and have previously only done smaller projects on arduiono boards, mostly using already-finished libraries.

Now I reached a point where my programmings skills lack, so instead of optimizing my code i started to look at maple mini and thought it would be excellent to also add a “nice” GUI to my project.

I ended up ordering a chinese 3.2″ tft+touch+sd card combo, but what i didn’t know or think of beforehand was to check the connectivity needed (i just read here and saw all the included libraries for the aforementioned display controller), but all of them are using SPI. So the display came in the mail and i became aware that it didn’t have any SPI interface, (at least not for the display, only for the touch and sd card)

Are there any working options that is available to use with stm32duino? What would be my best chance of getting this to work? (i was initially thinking about going for a MEGA, but choose the maple mini clone as i was impressed with the various tft demos i’ve seen )

I’ve tried looking through “all” of the internet, but have only found small pointers, and none of the really targeted for stm32duino. (i found one post where someone had posted an utft version with support for stm32, which was based on some teensy port, but it was also done for SPI only, and i couldn’t find any ILI9341 tft ‘drivers’ for parallel communication… well there was one for an ILI9481 but i’m not sure if that can be used in direct replacement.

Anyone has a similar display and has it working with a maple mini?

Thanks!
Andreas

Replies20

martinayotte Fri Jul 22, 2016 9:52 pm

Do some search on the forum, Roger introduced the SPI.setModule(n) that allows to switch SPIs without changing the library. Of course, you need to do those calls every you want to switch code execution from one device to the other.

konczakp Sun Jul 24, 2016 3:40 pm

I’ve seen this method and also I was trying (without any success) to use it. That is why I have asked if anyone has a working sketch :/

@stevestrong – in one of the topics about using sd card You have mentioned that You are using SPI.setModule(2) and it is working. Can You share Your code please?

cologne86 Sun Jul 24, 2016 6:08 pm

if your spi purpose isnt too time critical maybe you could use a different slaveselect pin and access them one by one, this would give you 3 more free pins

i have another problem with my touchscreen, i dont know if it is broken or any bit set wrong :? even if RD is set high and the code is the same as before the input doesnt get detected right, i have also measured double resistance on the x-achses with the multimeter(two time the resistance on the x-achses one day before)…does anyone see the same behavior or have an idea?

konczakp Mon Jul 25, 2016 8:59 am

You can do some test with this touch screen. Connect one Analog pin do GPIOA and second one to GPIOB, RD pin to GND and other 2 pins to digital pins as you want. Change pin definition in sketch and please use my sketch which I have uploaded earlier. In this configuration it should work perfectly. If it’s not then try changing pin configuration. Don’t connect any other pins. With my sketch I’m getting very reliable readings. So You should too. If you can measure the resistance then the screen should be ok. Earlier I had the same problem. I can’t remember what I did but I have started from this pin configuration. Dividing both analog pins to different GPIO will decrease influence between both Analog pins. Also in my sketch I don’t need to get RD pin go high. Moreover when I was setting this pin high I had strange readings. So maybe the RD pin is a problem.

About this SD card. I was trying to get it working on SPI1 too but no success. This is my pin connection:

SD pins |SCK |D0 |D1 |SS |
Pin stm32 |PA5 |PA6 |PA7 |PA4|

stevestrong Mon Jul 25, 2016 11:52 am

spi1.png
spi1.png (27.05 KiB) Viewed 567 times

konczakp Mon Jul 25, 2016 12:05 pm

This is exactly how I have connected it. To be clear I’m trying to connect sd-card which is on tft screen so I’m not worrying about voltage (because voltage regulator onboard) This is the TFT on which screen and touch is already working. I have formatted (under Ubuntu) sd card to FAT and it is a small card, 1GB large. I was also trying to switch MOSI/MISO but without success. I’ve also tried other sketches and libs but also without any success :/

stevestrong Mon Jul 25, 2016 12:15 pm

stevestrong wrote:Check if your SD adapter is for 5V or 3.3V.

konczakp Mon Jul 25, 2016 12:18 pm

TFT is supplied with 5 i 3.3v. There is no pin switch etc for voltache change because there is voltage regulator. This is the same screen as You have.

stevestrong Mon Jul 25, 2016 12:21 pm

I meant your SD card adapter…

konczakp Mon Jul 25, 2016 12:28 pm

Image

I think You misunderstood me. This is my sd adapter. There is voltage regulator so I don’t care about voltage. screen need to be connected with 3.3 and 5v. sd card adaptor is on the screen board.

stevestrong Mon Jul 25, 2016 12:45 pm

Yes, your right, I misunderstood the situation.
Of course, you are using the on-board SD adapter. So it should work with the 3.3V.
Be sure that the 3.3V supply can give up to 1A.
I will test it in the evening at home and let you know the results.

ahull Mon Jul 25, 2016 7:15 pm

Do we have a full schematic of that board? I see one of the pins of the SD card goes to those flat pack chips in the middle of the board, I presume that is significant.

konczakp Mon Jul 25, 2016 7:52 pm

unfortunately I don’t have any schematics :/

stevestrong Mon Jul 25, 2016 8:55 pm

This is what is closest to the reality, except the touch plate connection.
The 3.3V is also fed from the 5V power regulator.

U2 = U3 = HC245

konczakp Mon Jul 25, 2016 9:09 pm

stevestrong, have You tried with Your tft sd card ?

stevestrong Mon Jul 25, 2016 9:19 pm

well, I’m still struggling with git, trying to get the master branch, and trying to merge my local changes, which are, somehow, too many, compared to my last activity…
maybe because it is long time ago since I checked out last time.
sorry, but it seems that I will not be able to compile it today :(

konczakp Mon Jul 25, 2016 9:21 pm

that’s ok. I’ll be unavailable for a time of one week so when You’ll be ready just paste it here and I’ll check it later. thanks

bianchifan Tue Jul 26, 2016 2:56 pm

Early spring this year I played a little with a couple of those “mcufriends” combined with an Uno.
IIRC there were ILI9320, 25, 35, 41 and 86, all with resistive touch w/o controller and micro SD slot.
The adafruit libs didn’t work for me, same for all other libs recommended by all those lovely internet forums ;)
Just when I finished a lib that could handle one out my fundus I found one that did all and much faster than my own crap.
What did I learn?
Every display has another routing for its touch, even when format and controller match.
So there is only one way to go: try and try and try…

SD slot is working at all but one, there was a poor ratching.
It can be accessed via SPI, please have a look at the adfruit tftlib examples.

stevestrong Tue Jul 26, 2016 6:01 pm

Hi there,
I reworked a little bit the touch lib, by introducing some features like:
– easily detecting touch and getting coordinates in one function call
– mapping of the returned coordinates to the display resolution (default: 320×240)
– semi-automatic (user-assisted) easy calibration process (requires touching two opposite corners of the display).
If interested how to use it, please check the included INO example.
Any (constructive) comment is welcome. :)
Have fun!

stevestrong Wed Jul 27, 2016 7:07 pm

SD card is working, together with the touch lib.

The clou: the board must be powered with 5V!
In this case remove the 3.3V wire from the pill.

It did not work with the 3.3V from the blue pill, probably the 3.3V regulator of the pill is not strong enough for the SD adapter too.

*** Touch demo with easy calibration + SD card info ***
Calibrating the touch surface
> please press one corner...ok.
> and now press the diagonally opposite corner...ok.
Calibration done!

SdFat version: 20150321

Assuming the SD is the only SPI device.
Edit DISABLE_CHIP_SELECT to disable another device.

Assuming the SD chip select pin is: 4
Edit SD_CHIP_SELECT to change the SD chip select pin.

touch the screen to start
X = 319, Y = 81, Z = 1296

init time: 9 ms

Card type: SDHC

Manufacturer ID: 0X3
OEM ID: SD
Product: SL16G
Version: 8.0
Serial number: 0X72F2CA43
Manufacturing date: 8/2015

cardSize: 15931.54 MB (MB = 1,000,000 bytes)
flashEraseSize: 128 blocks
eraseSingleBlock: true
OCR: 0XC0FF8000

SD Partition Table
part,boot,type,start,length
1,0X0,0XC,8192,31093648
2,0X0,0X0,0,0
3,0X0,0X0,0,0
4,0X0,0X0,0,0

Volume is FAT32
blocksPerCluster: 64
clusterCount: 485710
freeClusters: 485700
freeSpace: 15915.42 MB (MB = 1,000,000 bytes)
fatStartBlock: 8794
fatCount: 2
blocksPerFat: 3795
rootDirStart: 2
dataStartBlock: 16384

touch the screen to start

Sign in to reply