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

brunof777 Thu Jul 21, 2016 11:46 am

hello

I make on this pins
Port data |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 |
Pin stm32 |PB7|PB6|PB5|PB4|PB3|PB2|PB1|PB0|

Control pins |RD |WR |RS |CS |RST|
Pin stm32 |PA4|PA5|PA6|PA7|PA8|

stevestrong Thu Jul 21, 2016 12:38 pm

Have you tried to comment out in “TouchScreen_STM.cpp” the line 22:
//#include "pins_arduino.h"

martinayotte Thu Jul 21, 2016 12:50 pm

konczakp wrote:
Edit: should I maybe unsolder Resistor on this pin ?

martinayotte Thu Jul 21, 2016 12:53 pm

stevestrong wrote:Have you tried to comment out in “TouchScreen_STM.cpp” the line 22:
//#include "pins_arduino.h"

brunof777 Thu Jul 21, 2016 2:20 pm

stevestrong wrote:Have you tried to comment out in “TouchScreen_STM.cpp” the line 22:
//#include "pins_arduino.h"

stevestrong Thu Jul 21, 2016 2:27 pm

@brunof777
what do you mean under “not working”? does it compile? do you get any printouts?
have you identified the pins for x and y plates (XP, YP,XM, YM) ?

brunof777 Thu Jul 21, 2016 3:11 pm

stevestrong wrote:@brunof777
what do you mean under “not working”? does it compile? do you get any printouts?
have you identified the pins for x and y plates (XP, YP,XM, YM) ?

stevestrong Thu Jul 21, 2016 3:15 pm

it is still unclear what do you mean under not working.
you should enable the serial prints to see what is going on….

brunof777 Thu Jul 21, 2016 3:19 pm

stevestrong wrote:it is still unclear what do you mean under not working.
you should enable the serial prints to see what is going on….

brunof777 Thu Jul 21, 2016 3:23 pm

brunof777 wrote:stevestrong wrote:it is still unclear what do you mean under not working.
you should enable the serial prints to see what is going on….

brunof777 Thu Jul 21, 2016 3:40 pm

Maybe i need change something in TouchScreen_STM.cpp file?
like this code :
uint16_t TouchScreen::pressure(void) {
// Set X+ to ground
pinMode(_xp, OUTPUT);
digitalWrite(_xp, LOW);

// Set Y- to VCC
pinMode(_ym, OUTPUT);
digitalWrite(_ym, HIGH);

// Hi-Z X- and Y+
digitalWrite(_xm, LOW);
pinMode(_xm, INPUT);
digitalWrite(_yp, LOW);
pinMode(_yp, INPUT);

int z1 = analogRead(_xm);
int z2 = analogRead(_yp);

if (_rxplate != 0) {
// now read the x
float rtouch;
rtouch = z2;
rtouch /= z1;
rtouch -= 1;
rtouch *= readTouchX();
rtouch *= _rxplate;
#if !defined (__STM32F1__)
rtouch /= 1024;
#else
rtouch /= 4095;
#endif

return rtouch;
} else {
#if !defined (__STM32F1__)
return (1023-(z2-z1));
#else
return (4095-(z2-z1));
#endif
}
}

konczakp Thu Jul 21, 2016 6:09 pm

There is some progress on my side :) Now the screen is working partially because when I’m giving him a command to change the image it is going white :/ and the touch is working also partially because it is working along only one side :/ Any suggestions what to check ?

EDIT: Problem with the screen arise when I’m adding touch settings to the screen preview code :/

stevestrong Thu Jul 21, 2016 6:57 pm

it is maybe the problem of sharing pins between touch and screen.
In the link I provided earlier, if you scroll further to bottom of page, it is another code snippet where is explicitly stated:
#define MINPRESSURE 10
#define MAXPRESSURE 1000

void loop()
{
digitalWrite(13, HIGH);
TSPoint p = ts.getPoint();
digitalWrite(13, LOW);

// ***** if sharing pins, you'll need to fix the directions of the touchscreen pins *****
//pinMode(XP, OUTPUT);
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
//pinMode(YM, OUTPUT);

// we have some minimum pressure we consider 'valid'
// pressure of 0 means no pressing!

if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
...

konczakp Thu Jul 21, 2016 7:18 pm

okey this worked for me. but still touch is working only on one short side while it was working fine on another pins

EDIT: no I didn’t measure it. to be honest I didn’t know how so I was trying what is the best configuration :/

stevestrong Thu Jul 21, 2016 7:22 pm

You cannot choose the touch pins as you like, you have to identify them by measuring resistance!

konczakp Thu Jul 21, 2016 7:24 pm

which pin measure with which ?

stevestrong Thu Jul 21, 2016 7:24 pm

In my case this is how my board is circuited:
// overlaps:
#define YP LCD_CD //(RS?) // 330 Ohm
#define XM LCD_D1 // 500 Ohm
#define YM LCD_D0 // 330 Ohm
#define XP LCD_CS // 500 Ohm

konczakp Thu Jul 21, 2016 7:31 pm

funny thing is that when I’ve changed to Your settings only working side has changed :) Changing YP and YM doesn’t change anything.

stevestrong Thu Jul 21, 2016 7:34 pm

konczakp wrote:only working side has changed

Sign in to reply