Sucess on an old TFT display

Anything not related to STM32
Post Reply
User avatar
sheepdoll
Posts: 241
Joined: Fri May 22, 2015 12:58 am
Location: Silicon Valley Vortex
Contact:

Sucess on an old TFT display

Post by sheepdoll » Mon Jan 29, 2018 3:50 am

Some years ago, around 2013, I was given a bunch of TD-T320 TFT displays. From time to time I would see If I could figure out how to get it to work.

There was a Yahoo group, which got filled with spam. It still seems to exist, with only two posts in it. So someone cleaned out the spam. I attempted to post my success, that group might be moderated. I did post an AVR asm program of my success which seems to have shown up.

I have had the datasheet open on my computer for over a year. I had made a breakout board on the side of another project. I then learned I needed a Level shifter as these displays are recommended for 2.8 volts. Anyway I finally found some time to sit down with the scope and trace out why I could not get it to work.

The controller is a HX8357B. I found a driver and the datasheet on the Adafruit site. The Yahoo group had a simple sheet, which turns out had a rather nasty error on it. The SPI is actually a 9 bit 3 wire mode. The config pins are not continued out on the flex cable which has 41 pins. The data sheet says that DE and RD are on pins. This FPC is tiny about 1CM across, so one needs a magnifier and microscope to work with it. Scoping it out was tricky too as the wire on the end of the probe acted like an antenna. The datasheet also had a cut and paste diagram of waveforms from the MFG sheet which is on the Adafruit website. These waveforms showed the 4 wire option not the 3, which is hard coded. There are also 18 data lines as well as the 'MPI DPI' (dlisplay pixel interface) which is the pclock/h& v sync. Not much use if one can not enter the parallel mode as the IMx pins are no where to be found. It is IMx 101 only.

I decided to simply write a 9bit SPI bitbang and see If I could talk to the thing. I found one bad solder joint on the SDA signal. (I am actually surprised I got it soldered as it is a bit misshapen from the heat.) Once that was fixed I got a screen full of random junk. Implementing the fill and some draw lines, I got a blue screen and the lines! I now have the answer I have been seeking for the last 5 years I have had these.

Searching on the terms 9bit SPI suggests that the STM32F4 might be able to do this. I had recently posted to AVR freaks about using a ILI9341 as a terminal display for a 1970s era terminal emulator. I now see what they meant by slooow. Interesting enough the responder on that thread suggested I look here on stm32duino for more info.

So has anyone here had experience with 9 bit 3 wire SPI? and I do not mean 16bit doubling the register, that only works when you can ignore the extra clocks. The 9th bit which is shifted first is the DE register select signal.

ag123
Posts: 854
Joined: Thu Jul 21, 2016 4:24 pm

Re: Sucess on an old TFT display

Post by ag123 » Mon Jan 29, 2018 5:07 am

i think there is a similar problem with 9 bit I2C on those ov7670 camera stuff, i'm not sure if the hardware spi/i2c is after all able to support 9 bit frames

a google search turn up some ancient threads
http://forums.leaflabs.com/forums.leafl ... tml?id=243
https://electronics.stackexchange.com/q ... with-stm32
apprently it seem possible to hack some 9 bit stuff using the usart

User avatar
RogerClark
Posts: 7680
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Sucess on an old TFT display

Post by RogerClark » Mon Jan 29, 2018 8:36 pm

Just a thought about 9 bit..

AFIK the F103 has a 16 bit mode, so I wonder what happens if you send 16 bits , but send zero in the last 7 bits?

The disolay may ignire them, or if it uses an internal shift register, perhaps you could send the data in the last 9 bits, and the first 7 bits may just overflow off the end.

It’s a bit wasteful and potentially slower than bit banging, but may be worth a try

User avatar
sheepdoll
Posts: 241
Joined: Fri May 22, 2015 12:58 am
Location: Silicon Valley Vortex
Contact:

Re: Sucess on an old TFT display

Post by sheepdoll » Tue Jan 30, 2018 3:39 am

I do not think that would work as there are still clocks being sent. The way these TFTs work is a command is sent followed by the data. The data is variable length. Every pixel has to be written, which is why these are so slow in SPI mode. The extra clocked bits would be seen as more data. Or else they would be an error condition. One could probably add some additional HW that gated the clocks with an enable. I suppose one could use the chip select, However this would have to be synced to the SPI. It seems that there is no need to de assert the chip select between the command and data bytes.
There is some discussion that one could disable the spi, but bang the DE bit then re-enable the spi. The main discussed issue, is this precludes using any sort of DMA access to the SPI, So once again the pixel writes slow down.

I suspect most of this is academic for the displays I have on hand. I thought there was a vague reference on one of the discussions, that The Stm32F4 might support some of this. Probably that is a reference to the TFT controller built into the STM32F429, Which is a parallel bus. To get that mode to work, one would have to figure out how to modify the glass FPC transition bonds to change the input mode. I have one glass I broke so I can sort of see where such pins are. Doubt if there is any way to connect a wire to such, without some sort of laser tool.

In the meantime, I built the second breakout board without the jumper wires. I should probably write all this up on my blog. I had some extra space on a board that uses the mega328, So I added an FTDI usb bridge on one side, and the TFT header to .1 spacing on the other. I had some rework tape, so I was able to barnacle on the level shifter. This looks like an Arduino to the IDE, so I can use that brain dead interface for testing.

The other board does not have the mega328 populated, so that could be connected direct to one of my Nucleo boards. This way comparisons between the two could be made.

victor_pv
Posts: 1860
Joined: Mon Apr 27, 2015 12:12 pm

Re: Sucess on an old TFT display

Post by victor_pv » Tue Jan 30, 2018 4:39 am

The UARTs support a 9bit mode, and can be used as 9bit spi. I remember reading a blog or something like it from someone that had to use it for sending 9bits of data. The only problem is that they can only send LSB or MSB mode, I don't remember which one, but only 1, and that can not be changed (at least in the F1)

User avatar
RogerClark
Posts: 7680
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Sucess on an old TFT display

Post by RogerClark » Tue Jan 30, 2018 4:44 am

Edit. Cross posted with Victor.

BTW. Serial did cross my mind as well.... ;-)

------------------------------ ORIGINAL POST --------------------------------

OK

I think bit banging may be your best option.

Well, there is a GPIO DMA way to do it, e.g. use 2 GPIO lines, one as the clock and the other as data, and build a data buffer, which alternately toggles one of the GPIO's on and off, and puts each data bit into the other GPIO

However the time taken to build the buffer would probably me more than to send the data

Alternatively, do what Ray often suggests, is dedicate a Blue Pill (or Maple mini) just to handle the comms to this board, so that it does all the bit banging, and accepts data via SPI and perhaps sends it back via SPI (or Serial etc)

User avatar
sheepdoll
Posts: 241
Joined: Fri May 22, 2015 12:58 am
Location: Silicon Valley Vortex
Contact:

Re: Sucess on an old TFT display

Post by sheepdoll » Tue Jan 30, 2018 5:49 am

I had already decided on a dedicated support board to handle the display, Which is to work as a terminal emulator such as was used in the 1970s. These often had intentionally slow phosphors to reduce the flicker, so I can probably live with some delay.

I did get some more progress on this tonight. I made the mods to the Adafruit HX8357B library and am running graphics test. This is on the mega328. Most of the drawing speed not too bad, it is the erase screen that takes about 8 seconds. Some of the fills take about a minute. The color and resolution is really nice. These are 480x320 displays.

Will be interesting to see how the F4 nucleo compares, that should have a much faster clock.

The serial comms, I use on the pipe organ, are already 9 bit. So I had considered that as an option as USARTs often contain a synchronous mode. Will need to look into that sometime.

Post Reply