Spark Logic

8-bit|16-bit parallell ILI9341

andreas_ferm Tue Oct 06, 2015 12:16 pm

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

Replies

stevestrong Wed Jul 20, 2016 12:57 pm

Hi,
I bought a similar board (2.4 inch touch LCD), and I am planning to make it run next days (tomorrow at soonest) with a blue pill.
My requirements:
– use USB serial for monitoring
– use SPI for SD card -> port pins PA4..7
– use touch screen -> port pins PA0..3
– use 8 data pins -> port pins PB8..15
– use control pins -> freely configurable on remaining port pins

I am going to use the @iwapola version, which seems pretty nicely speed optimized.
However, I see that the control pins are too restrictively coded, and I will then remap them in a more flexible configurable way.
I will then share my working version, which you could take 1 to 1 if this pin mapping would be OK for you.

martinayotte Wed Jul 20, 2016 1:00 pm

konczakp wrote:Am I missing something ?

stevestrong Wed Jul 20, 2016 2:33 pm

Attention!
According to this site, it seems that the pins XP and YM are shared with D6 and D7, YP and XM with LCD_WR and LCD_CD (marked as LCD_RS on my board), respectively.
//I need to change the pins below for it to work. NOt sure why
#define YP A1 // must be an analog pin, use "An" notation!
#define XM A2 // must be an analog pin, use "An" notation!
#define YM 7 // can be a digital pin
#define XP 6 // can be a digital pin

#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// optional
#define LCD_RESET A4

cologne86 Wed Jul 20, 2016 7:41 pm

hi,
at first thanks for the great work all together :)
the library for the 8bit lcd is working just fine and its really fast!.
But now i want to use the touch screen and need analog control pins.
As you told before i swapped the ports and used b8 to b15 for the data.
#define TFT_CNTRL GPIOA
#define TFT_DATA GPIOB
#define TFT_RD PA4
#define TFT_WR PA5
#define TFT_RS PA6
#define TFT_CS PA7
#define TFT_RST PA8

cologne86 Wed Jul 20, 2016 8:10 pm

ok, sry :)
everything is working now, i just edited and saved the wrong file (same file wrong folder) :lol:

konczakp Wed Jul 20, 2016 8:50 pm

unfortunately PB2 is not reacting for a blink command. Is there any other way ? Maybe some more settings need to be done to get PB2 working as a digital pin not only Boot. Maybe we can start from pin PB3 not PB0?

stevestrong Wed Jul 20, 2016 10:43 pm

cologne86 wrote:ok, sry :)
everything is working now, i just edited and saved the wrong file (same file wrong folder) :lol:

martinayotte Wed Jul 20, 2016 11:02 pm

konczakp wrote:unfortunately PB2 is not reacting for a blink command. Is there any other way ? Maybe some more settings need to be done to get PB2 working as a digital pin not only Boot. Maybe we can start from pin PB3 not PB0?

martinayotte Thu Jul 21, 2016 12:48 am

I don’t own any pills, but looking at the schematic you provide link, yes, there is a 100K on the jumper header, but I don’t see elsewhere where the PB2 can be plug external other from having a wire connect to that jumper header, assuming the jumper is removed … :ugeek:

RogerClark Thu Jul 21, 2016 1:14 am

LOL

I looked at my RedPill and it doesnt have a PB2 pin

So I looked at the schematic again, and PB2 is not broken out to the pins (which is the same as on the Maple mini) – probably as its Boot1 (even though it could be used)

So the OP needs to let us know what board they are using, or perhaps they are confusing PB2 with another pin

martinayotte Thu Jul 21, 2016 1:44 am

RogerClark wrote:(which is the same as on the Maple mini) – probably as its Boot1 (even though it could be used)

RogerClark Thu Jul 21, 2016 1:52 am

I think we are talking about different boards

I can’t see it on my RedPill

Image

martinayotte Thu Jul 21, 2016 2:09 am

RogerClark wrote:
I can’t see it on my RedPill

RogerClark Thu Jul 21, 2016 3:12 am

I agree, the Maple mini is a far better board than the Blue or Red Pill, (I don’t think the Red Pill is still available either)

stevestrong Thu Jul 21, 2016 9:40 am

Regarding how to identify the touch pins, it is suggested that the resistance between XM-XP and YM-YP should be measured.
One pair has a bit larger resistance than the other pair because of the display geometry (4:3), I suppose.
In this way I figured out that on my display the touch pins are mapped as follows:
(XP-XM): LCD_WR – D0 = ~330 ohm
(YP-YM): LCD_CD(or _RS) – D1 = ~500 ohm
So, in my case, it is not D6 and D7 which are used, as posted earlier.
But I think it is different from display to display.

RogerClark Thu Jul 21, 2016 10:03 am

@konczakp

That board does not have a pin PB2

Which pin do you think is PB2.

(Image from your ebay link)
Image

konczakp Thu Jul 21, 2016 10:33 am

This one :)

Image

Edit: should I maybe unsolder Resistor on this pin ?

RogerClark Thu Jul 21, 2016 10:54 am

The schematic seems to indicate that the jumper pin has 100k in series with it.

I doubt you can drive the display through 100k , you would need to replace the 100k witha much lower value resistor.

Sign in to reply