Moteino and UTFT ILI9325C

Started by bauderline, December 09, 2013, 02:00:52 PM

bauderline


Folks,

Has anyone had any success getting the Moteino to work with the UTFT library, as it uses (amongst others) pins D0 to D7 we will have a pin conflict with D2 as this is used by the radio according to the docs.

I am wondering if there is a way around this conflict...

BR Peter.

Felix

If you use the Serial port then D0-D1 are off limits as well in addition to D2 which is used as a hardware interrupt by the RFM radios.
There's many other pins on the mega328, I'm guessing you could change them to something else in whatever code/lib you're using.

bauderline

It would seem that this might be possible...

The ILI9325C requires the following pins when used with an UNO and the UTFT lib.

DB0 - DB7 -> D0 - D7
RD -> 3.3v
RSET -> A2
CS -> A3
RW -> A4
RS -> A5
BL 5v -> 5v
BL GND -> GND

In addition the touchscreen requires the following pins when used with the UTouch lib.

TCLK -> A1
TCS -> D10
TDIN -> A0
TDOUT -> D9
IRQ -> D8

All of the above are configurable via the initial function call to the lib apart from DB0 - DB7 which seem to be hard coded to a certain extent. The following document appears to describe how this can be worked around...

http://www.henningkarlsen.com/electronics/h_utft_arduino_shield_on_mega.php

In terms of mapping this to the Moteino I had the following in mind.....

DB0 -> PD0
DB1 -> PD1
DB2 -> PD3
DB3 -> PD4
DB4 -> PD5
DB5 -> PD6
DB6 -> PD7
DB7 -> PB3

RD -> 3.3v
RSET -> A2
CS -> A3
RW -> A4
RS -> A5
BL 5v -> 5v
BL GND -> GND

TCLK -> A7
TCS -> D12
TDIN -> A6
TDOUT -> D13
IRQ -> D14

That should leave me with D15 for Dallas 1 wire temp sensor, and D9 for relay control.

Do you envisage any issues with this setup on the Moteino ?

BR Peter.


jbeale

seems to me the library is using DB0-DB7 as a 8-bit wide parallel interface which it's going to load one byte at a time, so you can't split up the bits that way.

KanyonKris

The UTFT site mentions that if the display is serial you can use whatever pins you want. Are there no serial touch screens? Maybe you have to use a parallel display.

jbeale

Serial touch screens certainly do exist. For example I have a 2.8-inch TFT touchscreen made to mount on the Raspberry Pi which uses the SPI interface, it is this one: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=53144

Felix

Hey for that parallel load interface - could you use a chip like 74hc595 serial to parallel shift register?
Otherwise I'd look for a serial display, there's many options out there. It's a waste to use all the pins on the mega328 just to drive a display.
And since you mentioned the pins ... A6.7 are analog only pins, D12,13 are SPI pins so ... might cause interference with the RFM or FLASH chips onboard Moteino (even though theoretically it should not as long as their respective CS lines are not asserted).

bauderline

Well it works, had to move D14 -> D8 and A7/A6 to A1/A0 for the touchscreen to work...

Not sure if I have any useful pins left though, LOL!

BR Peter.

bauderline

Well the touchscreen stops working as soon as I enable the radio, I guess we have an SPI conflict..... just not enough pins....

Ordered a couple of these to play with....

http://www.hotmcu.com/28-touch-screen-tft-lcd-with-all-interface-p-63.html?cPath=6_16

Should make the project a lot more viable.

Felix

Yeah the mega328 is not the best if you plan to use a parallel interface LCD. I tried those once, never again, just makes no sense...
Ha, those are nice LCDs for $12. I wonder if all the scratches come as a bonus :)