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

Pito Mon Oct 03, 2016 7:55 pm

Use PNP or P-mosfet.
EDIT: Always USE A 100ohm resitor in series with the display’s LEDs.
Highsideswitch.JPG
Highsideswitch.JPG (13.47 KiB) Viewed 469 times

Rick Kimball Mon Oct 03, 2016 8:08 pm

@stevestrong Is that an NPN or PNP transistor?

PNP doesn’t seem to work with that schematic

A falstad circuit using a PNP, if you swap out the PNP for an NPN, it seems to alternate between 1.6 v and 5.
https://goo.gl/4n91QE

martinayotte Mon Oct 03, 2016 8:12 pm

This is PNP !
I personally like more the P-Chan MOSFETs, they are easier to saturate.

stevestrong Mon Oct 03, 2016 10:57 pm

Rick Kimball wrote:
A falstad circuit using a PNP, if you swap out the PNP for an NPN, it seems to alternate between 1.6 v and 5.
https://goo.gl/4n91QE

konczakp Tue Oct 04, 2016 6:56 pm

I’ve tried the circuit and it is switching on and off but there is still some problem because it is blinking. I’ve checked the output voltage and it is floating in about 0.1V. It is floating in a rythm (if I can say that) of a serial println and delay in the sketch. It is like: blink, check register of nrf24l01, read sd card, serial.println and again blink, check reg ….. etc.

EDIT1:
It is worth to say that I have connected to my maple mini tft with sd and nrf24l01+ and when I disable any operation in my code responsible for nrf24l01 in the software it is not blinking.

EDIT2:
It seems that radio.flush(); from Enrf24 library is responsible for that because If I disable it everything works fine. Any Idea why?

stevestrong Tue Oct 04, 2016 8:59 pm

Check the 5V and 3.3V levels, take another 5V adapter with higher power, radio circuits need a lot of power…

Pito Tue Oct 04, 2016 9:34 pm

You must use open drain otput at PB2 otherwise the high side switch will not close fully. Also Pmosfet must not work in above schematics fully closed.
That is because the PB2 output (when not configured as the open drain) gives 0..3.3V, and the emitter (source) of the PNP high side switch is at 5V. Therefore there is still 1.7V (=5-3.3) remaining between PB2 and the emitter (source) thus the PNP or Pmosfet will be not closed fully (you will not get 0V at TFT+).
Other option is to use an NPN transistor as a driver of the high-side PNP switch (see below).
EDIT: Always USE A 100ohm resitor in series with the display’s LEDs.
NPN driver and PNP high side switch.JPG
NPN driver and PNP high side switch.JPG (21.8 KiB) Viewed 427 times

RogerClark Tue Oct 04, 2016 11:24 pm

I’m not sure if you guys use it, but I find LTSpice very good for simulating this sort of stuff. Its UI is a bit clunky, but it is free and does good analogue analysis

(But it does take some getting used to, ie to setup the simulation stuff)

konczakp Wed Oct 05, 2016 6:07 pm

I have built the modified circuit but it is not working. It started to work when I removed 22Ohm resistor from the GND but without this resistor there is no difference in working while considering the first circuit. I have noticed also a strange thing. While it is blinking (as I mentioned before) when I put TFT +5 to GND and after that to +5 it is stopping to blink. At the beginning I thought I will have to switch only +5 but now I thing I have to be able to switch between GND and +5. How I can accomplish that ? Or maybe how to improve this circuit ? Or maybe I’m wrong somehow?

stevestrong Wed Oct 05, 2016 6:56 pm

If you set the pin to open drain with

pinMode(PB2,OUTPUT_OPEN_DRAIN); // in setup()

then the first circuit variant should work.
The blinking very strongly looks like power supply is colapsing when calling radio chip function.
Try to power the radio chip separately.

konczakp Wed Oct 05, 2016 8:12 pm

This didn’t change anything unfortunately. It is still blinking. Disconnecting radio from maple is not changing anything so this is not a problem collapsing power supply when calling radio. If I power up everything and it start to blink then when I touch tft +5 to GND it stops blinking and from now on it is working without blinking. Even screen on/off is almost working as it should. I wrote almost because when LOW then still little lighted up but this is not a big problem. So the problem is still with this screen. Unfortunately this is the cheapest one. What next can I do ?

stevestrong Wed Oct 05, 2016 8:51 pm

The only thing which i can think on is that the LCD backlight control pin is used also in the radio library, so that the pin gets toggled inside the function you wrote that causes the problem.

konczakp Thu Oct 06, 2016 11:02 am

Unfortunately this problem is not caused by the pin and neither nrf24l01 because when I change the pin or even delete everything from loop leaving only delay(1000); this problem remains :(

ahull Thu Oct 06, 2016 11:31 am

If I power up everything and it start to blink then when I touch tft +5 to GND it stops blinking and from now on it is working without blinking.
What does it do if you add a weak pull down (47K, or 100K or even larger) on that pin to GND?
What if you add a 1uf capacitor between the pin and GND?
What if you add a weak pull up to that pin?
Have you checked the soldering on the display? One of the ones I had was dreadful, and would blank out, show a white display, flicker and do all sorts of weird stuff, until I touched up the soldering and cleaned off the humongous quantities of flux residue.

stevestrong Thu Oct 06, 2016 11:37 am

Sorry, but I cannot suggest any other ideas unless you show us your hardware connections and the software.

konczakp Thu Oct 06, 2016 12:20 pm

ahull wrote:What does it do if you add a weak pull down (47K, or 100K or even larger) on that pin to GND?

ahull Thu Oct 06, 2016 12:36 pm

konczakp wrote:
2. Maybe te expensive one is able to switch off the backlight by register? I’ve seen in datascheet from ili9241 that it is possible. What do You think? How to do that ? https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf starting from page no 169

Pito Thu Oct 06, 2016 1:01 pm

The backlight on those displays are usually 2 pins = positive and negative.
Some use only 1 pin called LED (positive).

On the pcb there are 4-6 LEDs wired in serial/parallel combination.

2pins:
The positive pin must be connected to +TFT on the above schematics (collector or drain of the PNP or PMOS high side switch) via say 100ohm resistor in series.
DO NOT wire the backlight LEDs without a limiting resistor!! There is NONE resistor on the display’s pcb.
The negative pin should be connected to GND.

1pin called LED:
The pin must be connected to +TFT on the above schematics (collector or drain of the PNP or PMOS high side switch) via say 100ohm resistor in series.
DO NOT wire the backlight LEDs without a limiting resistor!! There is NONE resistor on the display’s pcb.
The negative pin is wired to GND on the display’s pcb.

stevestrong Thu Oct 06, 2016 1:05 pm

@konczakp
I cannot see the hardware connection part where you control the backlight…
Is it port pin PB2 of the STM32? It seems to be used already as data pin D2.
Which pin of the LCD board do you control for backlight? The 5V pin? It seems that it is already used to supply the 3V3 for SD…

konczakp Thu Oct 06, 2016 2:12 pm

I’m using this circuit to switch +5V to TFT. Pin 12 (PC15) is giving High and Low to the base of PNP transistor. On the TFT there are 2 GND marked so I’ve connected them both to GND. This screen seems to work even without +5 because if I’ll give him just for a second at the beginning +5 then sd is working perfectly even without +5 connected. If I put 120Ohm resistor just before TFT +5 with usage of above circuit I’m getting only white screen a little bit dimmed. I cannot see any pin marked as LED so I assume that +5 is the only pin responsible for this. More over pin marked as 3.3v is not connected to anything :?

Post a reply