Good day guys! Please could you help me, I've stumbled upon LEDStick project on Github and trying to get in running on ILI9341_16 screen and I have a problem that the touchscreen stops working after the stage of reading the memory card (tried to load the menu by turning off the memory card and the buttons still did not work).
I shot a problem on this video : TFT LCD Touch Screen - YouTube
WiFi R3 ATmega2560 + ESP8266
TFT LCD Mega Shield V3.0 (34 pin)
3.2 inch TFT LCD Touch Screen (34 pin)
At the attached firmware file is a screen setup.
After loading the firmware and pressing a key "Painting BMP", LCD screen shows:
[ Previous ] [ -5 ]
CROSS100.BMP 10
[ Next ] [ +5 ]
200 x 137
7 Seconds
[ File Information ]
[ Paint BMP ]
and at this moment it seems like a firmware freezes, doesn't respond to any key presses.
Most likely, a problem is in a cycle which is situated inside a function "void bmploop()" line 273. It will be very nice of you if you could tell a good idea how to solve it.
while (true)
{
if (myTouch.dataAvailable() == true)
{
pressed_button = myButtons.checkButtons();
if (pressed_button==prev)
{
if (m_FileIndex > 0)
{
m_FileIndex--;
}
else
{
m_FileIndex = m_NumberOfFiles -1; //wrap round to the last file
}
DisplayCurrentFilename();
delay(500);
keypress = 0;
}
if (pressed_button==next)
{
if (m_FileIndex < m_NumberOfFiles -1)
{
m_FileIndex++;
}
else
{
m_FileIndex = 0;
}
DisplayCurrentFilename();
delay(500);
keypress = 0;
}
if (pressed_button==plus)
{
if (frameDelay > 5)
{
frameDelay-=5;
}
ShowFrameDelay();
}
if (pressed_button==minus)
{
if (frameDelay < 200)
{
frameDelay+=5;
}
ShowFrameDelay();
}
if (pressed_button==paint)
{
Paint();
}
if(pressed_button==info)
{
DisplayFile(m_FileNames[m_FileIndex]);
}
}
}
david_prentice:
Your MEGA2560 has got 8192 bytes of SRAM. I would still be careful with using too much.
I am not sure what your video is supposed to show.
I have never seen a 34-pin Adapter Shield. Please can you post a link.
David.
Dear David, in the video I show that - while loading - a button in first menu is working, but after searching the images on a memory card, the next menu does not respond to touches - buttons stop working.
I found this 34-pin shield only at one store on Taobao because for a screen with a 34pin version, this shield is not sold on Aliexpress and in other stores. When I ordered the screen, the seller sent a Screen of the new version but of 34pin instead of 40pin. After this I had to order this shield, because in an assembly - if you connect all the elements directly without a shield - you get a bulky structure that doesn 't fit in a small box
david_prentice:
I would reduce your String m_FileNames[200];
Great advice, but it seems that OP has encountered a conflict between XPT2046 touch screen controller and the SD card of ILI9341 screen: they are sharing the same SPI bus, and OP's project tries to use both of them. There is a workaround, could be found if to search by " "xpt2046" "sd" "conflict" "ili9341" " - i.e. at pjrc forum - however it's not easy to implement, as the touch screen library needs to be written with this possible problem in mind and it seems URTouch hasn't been created this way. I'd suggest contacting an author of URTouch library and maybe he could implement this workaround.
david_prentice:
The OP is using different pins for TFT, XPT2046, SD
Only their CS is separate (see the attached picture), meanwhile the other SPI bus pins - MOSI, MISO, CLK - are shared between them, and it seems there's a conflict between XPT2046 touch and SD card.
david_prentice:
I would reduce the String memory use. And see if it affects the behaviour.
As I have the same components and a similar problem, I've tried your suggestion now but sadly it didn't help. Perhaps the only software-independent solution to have both XP2046 touch and SD card at the same time on these ILI9341 screen - is to solder a separate SD card to the free pins and somehow set up a secondary SPI bus for it. Could be a bit tricky, considering every online example sets up only CS. Do you know where to find the settings for MOSI, MISO, CLK?
There is no problem with having multiple SPI devices.
F_CS is for a Font chip. Probably unmounted
SDCS is for an SD card.
T_CS is for XPT2046 Touch controller
Obviously all the Slaves that share the SPI bus must use HW SPI.
Do not try to mix SW SPI and HW SPI on the same pins.
CS is for the TFT parallel interface.
Pure guesswork. We have no idea what components are mounted on the pcb. The photo in #6 only shows part of the pcb.
If xpt2046sd cares to provide the information, he would get an accurate answer.
@Rudi_i, if you have a spare SD card adapter board like this, you could somehow connect or solder it to the Arduino Mega2560 10-13 pins: a bit tricky to be honest, because a shield is covering them, but you can solder the extra pins to the shield's parallel unused holes which are above the Arduino Mega2560 holes of 10-13 pins.
By the way, I got this rare 34-pin shield not from a Taobao directly, but asked the same AliExpress seller who sold this ILI9341 screen to me, and he resell 2pcs of rare adapter (one spare) for just 8 usd total with shipping included. A few others also offered their help, although their prices were higher - 8.8 usd and above. So - if you need any rare Taobao item and don't know how to get it directly - just spam a lot of Ali sellers (only those who are reputable, of course!), choose the best offer and get a multiple of $1 usd "add shipping" fake items from their store - equivalent to your agreement's price - while writing a Taobao link at order description.