Mystery with Teensy 3.6 and ILI9341_t3

Status
Not open for further replies.

rgmorales

Member
I'm working on a LapTimer using a Teensy 3.6, an Ublox GPS and an ILI9341 2.4 inches touch display. I go to the track with my motorcycle, and I would like to have a single device to measure my Laptimes. Currently I use a cellphone and a Bluetooth GPS.

I need the fastest 9341 lib possible, as the LapTimer shows the lap time with minutes, seconds and tenths of a second, and when a lap is detected, it shows the lap time updating the screen ten times per second, which is the GPS update rate. All the processing of GPS data, save the position to the SD card, check for a lap complete, and update the screen has to happen in less than 100 milliseconds.

Plans are to add an accelerometer and gyro in the future.

My application was working fine for a long time, and I was able to test the laps, speed and other things.

Suddenly, the TFT display stopped working. It goes blank and shows nothing. I tried everything, removed the pins, soldered wires on the display, tried the LED pin with and without the resistor, tried the vcc in the display on 3.3v, 5v, tried to use the Reset in another pin, verified my connections, tried other proto board, reconnected the cables, and now it has the pins suggested in the display page.

I also have a 2.8 inches 9341 display and the same thing happens to that one.

The biggest mystery is, it works perfectly with the Adafruit ILI9341 lib, but in order for it to work, I need to load the graphics test example ino file, unplug the USB cable, and plug it again. After that, I can upload any ino file using the Adafruit ILI9431 that it works fine.

As soon as I upload a file using the ILI9341_t3, it does not work anymore. Well, sometimes, if I leave the whole thing unplugged for a long time (a day for example), it works in the first try. After that, it does not work anymore. I can do a video to show what I'm describing. When I removed the original pins and soldered the cables on it, it worked the first time, I was happy, thought that I had fixed it, but it stopped working after that. I tried to power the whole thing with a Lipo, same issue. Tried different GPS, only thing I did not try was another Teensy, as I have only one to use with proto boards.

I also tried the t3n lib and it did not work.

I also have a 7735 display working fine on this Teensy board.

I could upload my ino file, but in fact I can test with any t3 example that the behaviour is the same.

Don't know what else to do. Any thoughts?
 
None of the samples with ILI9341_t3 work? Unless you run the DMA version of that - nothing is faster. But it should work on non-DMA first.

Seems like a hardware conflict - perhaps the software interface to that hardware? Or some bad array or pointer write trashing memory.

What compile option is being used? Fast(er/est) LTO on/off? Try a change to that - even going smallest to see it work.
 
Tried that too, did not work.

Also tried the beta version of Teensyduino, reinstalled everything... Ordered new displays, to check if it is the display. But they will take a long time to arrive.

Really lost here.
 
Might help to have some additional information:

Like what is all connected to your T3.6? i.e. what is connected to what pin... Pictures can help.
Source code? You said none of the examples work? Like Graphictest?

Are you using the exact same pins as used in graphic test? For example if you wired the RESET pin to an io pin and have not configured the program for it, maybe it is leaving the IO pin that reset is connected to in a RESET state...

Maybe the SPI on that display can not keep up. You might edit ili9341_t3.h and edit the SPICLOCK define to something slower. Like change 30000000 to 10000000 and rebuild. Does that make a difference.

Maybe the SPI pins for some reason went bad on your T3.6. You might try some alternate pins for MOSI/MISO/SCK and maybe CS and DC as well...

Could try on SPI1 or SPI2, but would require my ili9341_t3n with SPIN library.

Also hard to tell from your comments, is your program running OK, simply not displaying or is it hung... If hung would be good to start adding debug tracing code to get an idea of where it is hanging.
 
While playing with ili9341 libraries and Teensy 3.6 I was seeing a number of cases where init for the high speed libraries wouldn't actually get the LCD to work, but if I powered up and loaded the adafriuit version then loaded up the Teensy versions things would be fine.

I ended up with a combination of libraries that works but did see some interesting failure modes along the way, unsure if it's the teensy just plain coming up faster than the internal controller could handle or if there was some magic sauce in the init sequnce that is handled differently on the adafruit version.

Certainly my first suggestion would be to add a delay(1000) either side of the ili begin.

And just confirming, after you used 5V on the LCD the adafruit library still works to test your hardware and wiring doesn't it? Most LCDs have an onboard reg to drop the 5V to 3.3 but that step might have upset the LCD and or Teensy in a terminal manner.
 
Hi Kurt, thank you so much for spending the time to look into this.

I did the following tests:

Yes, exactly the same pins are being used for the Adafruit ILI9341 and the t3 version, the RESET was plugged to the 3.3v

Tested with lower speed on SPI clock, same behaviour.

Tested with different pins, same thing. I believe the pins are OK, because it works with the 7753 display.

Also tested with the DMA version of the lib, in this case, I can see the initial text of the example in blink, but it goes blank after that.

My code works fine, it does not hang. And in the sketches for the Graphics test, you can see in the serial the output of the program while it runs.

Attached pics of the wiring, and also a video. In this video, the board is running the graphics test with the Adafruit ILI9341, and as soon as I upload the t3 version, it goes white and do not change.

Thanks a lot for trying to help.

IMG_20170610_190246-1200x1024.jpg

 
... Suddenly, the TFT display stopped working. It goes blank and shows nothing.

When I read this 'blank' - I imagined - OFF. In later post #6 it shows and says WHITE.

You have to be careful with 5V as noted. So sticking with 3.3V I had a display I got go ALL WHITE. I got it replaced and then thinking I'd follow SD mods for this 'trashed' unit (and ignore the display) on he PJRC page I closed "J1" that bypasses the voltage regulator.

We do not recommend using the SD card socket on this display. It does not work, but this hardware modification may be able to get it working.

My display that worked - and gradually went from occasional WHITE - to rarely working and showing text began to fully function perfectly when J1 was closed. That may be the problem here if the display can work at all - and will only be given 3.3V what do you see soldering over J1?

Note: I've suggested this a few times and somehow what I saw work hasn't been confirmed - but it might be what helps here?
 
Thanks, I don't see much wrong. Not sure about the LED wire hookup. If my eyes are not crossed it looks like the resistor powering the + buss is connected to pin 23? but maybe 3.3v???

with some boards I have had better luck hooking up Reset pin to an IO pin (or at times to the reset line of the T3.6...)

You might also try what GreminWrangler mentioned and try adding a delay before the TFT call
 
Thanks guys, the LED wire hookup is correct, the pic is not good. It has the resistor coming from 3.3v, also tried it with 5v, no success.

The J1 is open, I will close it and see what happens.

I tried the delay before, with several seconds, and it did not work. I believe that I fried my ILI9341. I will post pictures with tests when the new ones arrive.

I tested today with the lib 7735_t3, and it worked, so I think the SPI pins are good.

What intrigues me is, if the display went bad, why the Adafruit (slow) lib works? What is the magic that the t3 and other libs based on it has that is not working with this display... There must be something in the lib that this display does not like.

Thanks guys, I will not lose my hope, I will build this lap timer with the 9341. Unless you guys have a better suggestion in the 2.2 inches sizer. (tried the nextion, not sure the cost is worth it)

I have a track day next Saturday, so I believe I will have to adapt my code to the small 7735 just to test it on the track.
 
What intrigues me is, if the display went bad, why the Adafruit (slow) lib works? What is the magic that the t3 and other libs based on it has that is not working with this display... There must be something in the lib that this display does not like.

Maybe it's having trouble with the fast SPI clock speed?

If you're up for trying to edit the library code, look for this in ILI9341_t3.cpp:

Code:
// Teensy 3.1 can only generate 30 MHz SPI when running at 120 MHz (overclock)
// At all other speeds, SPI.beginTransaction() will use the fastest available clock
#define SPICLOCK 30000000

https://github.com/PaulStoffregen/ILI9341_t3/blob/master/ILI9341_t3.cpp#L54

Maybe try reducing the speed?

I can tell you every ILI9431 display PJRC sells is tested with a Teensy 3.2 using 24 MHz SPI speed. Maybe some displays work at 24 but can't handle 30 MHz?

Or maybe something is simply failed with your display?
 
Hi Paul,

I tried to reduce the speed already. The new displays I ordered arrived, and they are working. So, it could only be a damaged display (probably for not using the resistor on the LED pin) but still a mystery why the standard lib works with the broken display, but the t3 version does not...

Thanks! I will post some videos of the lap timer next time I go to the track.
 
Just a blind guess - I had somewhat similar effects because of oxidized contacts(pinheaders). Sometimes it worked with slow speed only, sometimes not at all...
 
Status
Not open for further replies.
Back
Top