Go Down

Topic: ILI9488 communication questions (Read 208 times) previous topic - next topic

jrmymllr

I want to start out by saying that I've used Arduinos before and the only one I have is being used for another purpose. But this particular question is display-centric. I'm asking here because it seems there's some display experts who frequent the forum. I have a good amount of electronics and microcontroller experience but LCDs frequently give me problems.

I purchased a TFT (https://www.ebay.com/itm/302113853801) based on ILI9488. I've spent time looking through the datasheet but one thing that isn't clear is if it's acceptable for the /SS (or chip select) to be asserted and de-asserted for each byte transferred, even if there's data bytes following a command. The datasheet seems to hint this is Ok, but in not very clear terms. Or, is it required that /SS remains asserted during the entirety of a command and the following data bytes? Someone who has used an ILI94xx driver may know this right off the top of their head.

A second question is regarding general communication trouble. I am able to alternate between the "display off" and "display on" command, or "all pixels off" and "all pixels on" commands and can clearly see the display become brighter and more dim as would be expected. However, I'm not able to make it do anything else. So I decided to try writing to a register and read it back to verify this works. I tried writing the CTRL (53h) and reading it back (54h). I get a 0 back regardless of what I write. This is frustrating because I can plainly see on my logic analyzer that everything is as it should be. Clearly I'm doing something incorrect.

The attached images shows the logic analyzer screenshot. D0 - D5 is as follows:
/SS (chip select)
MOSI
SCK
data/command
LCD reset
MISO

In one image you can see I'm writing 82h to CTRL by using command 53h. In the other image you can see I'm attempting to read CTRL back with command 54h, but I get 02h during the dummy byte, and 0 for what should have been 82h.

I've also modified my code so the /SS remains low during the entirety of each command and data byte sequence, but this results in the same. This is frustrating because it seems it should work. Any advice appreciated.



david_prentice

Go on.   Do you honestly think you can operate a SPI device when /RST is active ?

Life is much simpler with a Logic Analyser.   You can attach labels to each trace.

Regarding /CS.   Many TFT controllers are quite relaxed about stop-start in a Write sequence.   They require sensible behaviour during a Read sequence.

Personally,   I would assert /CS at the start of a sequence and keep it active throughout the whole sequence.

You are using 4-wire SPI interface.   Even more reason to treat /CS consistently.    And I would definitely refer to it as /CS.    Yes,  you can use the haywire-ability SS pin on an AVR.

David.

jrmymllr

#2
Jan 17, 2018, 03:08 pm Last Edit: Jan 17, 2018, 03:13 pm by jrmymllr
Go on.   Do you honestly think you can operate a SPI device when /RST is active ?
But it's not active. The trace shows it's logic high, while the display and controller datasheet indicate to drive it low to reset it. And I'm able to send some commands and get a response.

Life is much simpler with a Logic Analyser.   You can attach labels to each trace.
I believe I can label these but have been lazy about doing so.

Regarding /CS.   Many TFT controllers are quite relaxed about stop-start in a Write sequence.   They require sensible behaviour during a Read sequence.

Personally,   I would assert /CS at the start of a sequence and keep it active throughout the whole sequence.

You are using 4-wire SPI interface.   Even more reason to treat /CS consistently.    And I would definitely refer to it as /CS.    Yes,  you can use the haywire-ability SS pin on an AVR.

David.
So as I read it, you're saying when issuing a Read command, /CS should remain asserted throughout. I'm actually using a PIC32MZ because I need a few hundred KB of RAM and high performance, but once I get this functioning I can work on streamlining the SPI communication part.

I'm still confused as to why I'm not reading back the same value I wrote even though I also tried maintaining /CS active during each command sequence. If worst comes to worst, I can pick up another Arduino and use a library to get it working then reverse engineer that. What TFT library do you recommend?

david_prentice

#3
Jan 17, 2018, 03:33 pm Last Edit: Jan 17, 2018, 03:36 pm by david_prentice
My apologies.   I had misread D5 as being /RST.   Yes,  D4 is high throughout.
Your SCK looks like SPI mode#2.   Life is easier with a Logic Analyser.
Most controllers work with SPI #0 and #3.

Your display comes from BuyDisplay.   I have the version that is on a pcb.   It works fine.

I have a library that works on Uno(3.3V), Zero, Due, Teensy, STM32, ...

I have never owned a PIC32.   So I have never supported a PIC32.

David.


jrmymllr

My apologies.   I had misread D5 as being /RST.   Yes,  D4 is high throughout.
Your SCK looks like SPI mode#2.   Life is easier with a Logic Analyser.
Most controllers work with SPI #0 and #3.

Your display comes from BuyDisplay.   I have the version that is on a pcb.   It works fine.

I have a library that works on Uno(3.3V), Zero, Due, Teensy, STM32, ...

I have never owned a PIC32.   So I have never supported a PIC32.

David.


Good thought on the SPI mode, although data is on the rising edge as the datasheet indicates it should be which is mode #0 or #3 if I'm correct. Mode #2 looks like it's on the falling edge, and I believe mine is mode #3. I could try #0.

I can't justify buying a standalone logic analyzer for hobby use. It's more than I used to have, which was a 4 channel oscope only.

Thanks for your help. The micro I'm using isn't such an issue, other than not being able to drop a tested library on it. Maybe it's the SPI mode: I'm comparing the datasheet SPI transaction diagram and notice there is no SCK transition once /CS drops except for the rising edge where the first bit is sampled. On my SPI trace, SCK starts out high, drops, then rises on the first bit. It's a possible issue.

david_prentice

Go on.    A Saleae clone cost less than $10.     Mind you,  my upgraded Saleae software has stopped working on my Win10-64.   It does work on a Win7-32 laptop.

Seriously,   if you want help,   you should provide readable pictures / diagrams.
If you don't want to use existing public library code,   you should post your own code.

Ok,   very few people will have a PIC32 to run it on.    But if it is regular Arduino code,   you will probably get some sensible replies.

David.

jrmymllr

Go on.    A Saleae clone cost less than $10.     Mind you,  my upgraded Saleae software has stopped working on my Win10-64.   It does work on a Win7-32 laptop.

Seriously,   if you want help,   you should provide readable pictures / diagrams.
If you don't want to use existing public library code,   you should post your own code.

Ok,   very few people will have a PIC32 to run it on.    But if it is regular Arduino code,   you will probably get some sensible replies.

David.
When you said "logic analyzer" I was imagining something much more expensive. I can buy a $10 device, although it's not clear what this would do for me at this time. I can see the advantage when I want to capture long sequences of serial data, for example during initialization.

I assumed a screenshot of logic data was best since it's processor independent. I don't expect anyone to debug my code (I won't turn it down) as it can sometimes get quite lengthy.

I'll try changing SPI modes later when I'm home and hopefully that improves things. If that allows me to write and read back a register, I'm almost there.

jrmymllr

Go on.    A Saleae clone cost less than $10.     Mind you,  my upgraded Saleae software has stopped working on my Win10-64.   It does work on a Win7-32 laptop.

Seriously,   if you want help,   you should provide readable pictures / diagrams.
If you don't want to use existing public library code,   you should post your own code.

Ok,   very few people will have a PIC32 to run it on.    But if it is regular Arduino code,   you will probably get some sensible replies.

David.
Changing SPI mode did nothing. But I realized something: I left all those display inputs floating that I'm not using because they're for different interfaces. It's not because I didn't know better, but rather because I was impatient and thought I may get by with it for my jumble of wires prototype.

So I wonder how much of an effect this really has. Leaving digital inputs open can cause undesirable effects in general, but could it cause the issues I'm having......I guess there's only one way to find out.

Go Up