Teensy 4.0 First Beta Test

Status
Not open for further replies.
@defragster
If you look at the pinout spreadsheet pin 4 is for I2S2 BLCK(TX just to be exact) and pin #21 is for I2S1 BLCK(RX to be exact). Think that is where the difference may come in since I am using I2S1.

Also just for reference pin#23 is BLCK for I2S1 and pin#5 is for MLCK I2S2.

Think I got this right. That was why I was asking about the switch.
 
@defragster
If you look at the pinout spreadsheet pin 4 is for I2S2 BLCK(TX just to be exact) and pin #21 is for I2S1 BLCK(RX to be exact). Think that is where the difference may come in since I am using I2S1.

Also just for reference pin#23 is BLCK for I2S1 and pin#5 is for MLCK I2S2.

Think I got this right. That was why I was asking about the switch.

Thanks - switch is part of this … - that explains the BLCK to T4 pin #4 I saw

> When set I2S1 there is No DVM continuity to any pin I can find.

> opps … BEFORE switch was on I2S2 - but not a pure connect - won't see #4 unless I DVM probe #5 first?

So there is something active tied there and I broke mine?
 
@defragster

Maybe not - those pins are tied to a multiplexer and they wont ring out unless you have power to the board - I forgot what it should be with power on - its in this thread somewhere. I asked the question a while ago on ringing out the breakout board.
 
@defragster

Maybe not - those pins are tied to a multiplexer and they wont ring out unless you have power to the board - I forgot what it should be with power on - its in this thread somewhere. I asked the question a while ago on ringing out the breakout board.

Okay - I'll just avoid using those and see about the others making it work ...
 
@KurtE, @defragster and others :) RE: ILI9488 DISPLAY

First Good morning all. Any in the other thread I started looking the ILI9488 library and what it would take to get a version for the ILI9488 or incorporate it into the existing 9341 lib. First - all the registers look the same from what I see. From the readme that for the lib that we are using:
I have made some heavy modifications, as the typical Adafruit TFT libraries are designed to work with 16bit color (RGB565), and the ILI9488 can only do 24bit (RGB888) color in 4 wire SPI mode. You can still use the library EXACTLY like you would for 16bit mode color, the colors are converted before sending to the display. What this means is, things will be slower than normal. Not only do you have to write twice as many pixels as a normal 240x320 display, 153,600px (320x480) vs 76,800px (240x320), but you also have to do a lightweight conversion on each color, and write 3 bytes vs 2bytes per pixel.

For this reason, I do not recommend an AVR based Arduino for this library, although it will still work. I highly recommend a faster microcontroller based on ARM such as the Teensy, STM32duino, Arduino Zero, or the Arduing Due.

On the STM32duino, DMA is supported and is therefore much faster.
I did notice in the library there is a an initialization for the display but did not see that for the _t3/_t3n libs. So have to figure all that out.
 
The ILI9488 is more ot less the same as the ILI9341. There are some differences in the details of the registers (the maximum refresh rate for example). The version Paul, Tim and I have does not even need the initialization - it works without (Only the sleep-out switch-on cmd is needed). The other difference with this display is the MISO problem. I was thinking about adding some chips (quad serial -> parallel convert) and to use a parallel interface version. Not sure if it's worth that effort.

It is slower, and does not fit my needs...
I'd be more happy with the same resolution with 2x the size + capacitive touch.
 
Last edited:
@Frank B
Thanks for the pointers, going to look at it a bit more today between things. Think I am going to have to read the data sheet and look up what is the sleep-out command and register for max refresh rate.
 
Good Morning @mjs513 and ... As for this display:

As I mentioned earlier I have a version of that library https://github.com/KurtE/ILI9488/tree/Teensy_4_beta that runs on T4...
Not much of a change, just needed to change the size of hardware registers to 32 bit instead of 8...

As for the usage of DMA, again not sure how much that would help here, assuming that one can keep the FIFO queue non-empty, except when you need to change DC (and lesser extent) CS...
But assuming similar SPI speed, best case is that it will take 3 times as long to update this display as ILI9341 display as you have to transfer 3 times as much data. And I don't believe there is any way to do DMA operations directly from a 16 bit frame buffer to the display (i.e. need to translate into 3 bytes of data...

My guess is that this current library is slower than we can do... That is it is using
Code:
void ILI9488::write16BitColor(uint16_t color){
  // #if (__STM32F1__)
  //     uint8_t buff[4] = {
  //       (((color & 0xF800) >> 11)* 255) / 31,
  //       (((color & 0x07E0) >> 5) * 255) / 63,
  //       ((color & 0x001F)* 255) / 31
  //     };
  //     SPI.dmaSend(buff, 3);
  // #else
  uint8_t r = (color & 0xF800) >> 11;
  uint8_t g = (color & 0x07E0) >> 5;
  uint8_t b = color & 0x001F;

  r = (r * 255) / 31;
  g = (g * 255) / 63;
  b = (b * 255) / 31;

  spiwrite(r);
  spiwrite(g);
  spiwrite(b);
  // #endif
}
To output each pixel... Where spiwrite translates to SPI.transfer
So no queue of data...

So could make a version of library like ili9341_t3 to support it using the FIFO. could start from _t3 or _t3n... But with _t3n not sure yet on best way to do frame buffer...

However where the ili9341_t3(n) and ili9488_t3(n) would/could have some interesting changes in functions are in pushing colors.
That is with both libraries, they use mainly writedata16_cont and writedata16_last to output the colors. Problem is that these helper functions are not only used to output the colors, they also are used to output other things. Like the X, Y coordinates... SO may need to change a lot of these to something like writecolor_cont... which for t3.x would probably translate into 3 push 8 bit values...

For T4, we could instead have it directly output 24 bits, by setting the framesize to this in the TCR register...

Again not sure what all would have to do for DMA...
 
@KurtE/@Frank B
Maybe it would be easier to start with _t3 version.

However where the ili9341_t3(n) and ili9488_t3(n) would/could have some interesting changes in functions are in pushing colors.
That is with both libraries, they use mainly writedata16_cont and writedata16_last to output the colors. Problem is that these helper functions are not only used to output the colors, they also are used to output other things. Like the X, Y coordinates... SO may need to change a lot of these to something like writecolor_cont... which for t3.x would probably translate into 3 push 8 bit values...

For T4, we could instead have it directly output 24 bits, by setting the framesize to this in the TCR register...
Er yes. Been playing around with _t3n just to see if I can get anything but no luck, mostly because I don't know what I am doing …. :) …..

What is the difference between writecommandx_cont, writecommandx_cont, writedataX_last and writedataX_cont etc. Think I am confused on what to use where.
 
some time ago I linked a Chinese 9488 display which seems to have quadspi. I think it makes more sense to play with this one - if we can make flexio qspi fast enough. All the higher resolution displays need higher speed interfaces - qspi seems to be the only solution which we have now? or maybe a solution with >100MHz SPI -a chip with shiftregister and parallel output?
 
some time ago I linked a Chinese 9488 display which seems to have quadspi. I think it makes more sense to play with this one - if we can make flexio qspi fast enough. All the higher resolution displays need higher speed interfaces - qspi seems to be the only solution which we have now? or maybe a solution with >100MHz SPI -a chip with shiftregister and parallel output?

Ok, since I am known for my "sick" ideas... the smaller IMXRT chips are relatively cheap - maybe @Paul can make a simple display "breakout" with an IMXRT chip, with fast USB and display interface. Just like the Audioshield but with its own CPU and display (or, more general, 8080 interface)... it would be usable for the 3.6 (USB-HOST), too...
I'd say the "makers" -- not only Teensy-users - would love it..

edit: The nice thing is, once he has the T4-USB working, there would be not much software-development.. a simplistic API would be enough. :) - hehe.. and we as users, can write our own "drivers" in Arduino which we transfer to the breakout-board where they are executed in RAM... so much fun!
 
Last edited:
Ok, since I am known for my "sick" ideas... the smaller IMXRT chips are relatively cheap - maybe @Paul can make a simple display "breakout" with an IMXRT chip, with fast USB and display interface. Just like the Audioshield but with its own CPU and display (or, more general 8080 interface)... it would be usable for the 3.6 (USB-HOST), too...
I'd say the "makers" -- not only Teensy-users - would love it..
Oh boy - not "sick" idea but...… as I usually Argh!

Anyway, started modify _t3 lib. Nothing getting displayed - have to figure out what I did! Attaching it just in case anyone wants to play.

View attachment ILI9488_t3.zip
 
@KurtE, @Frank B, @defragster and others interested.

I finally got the ILI9488 working with the _t3 library. It runs with the follow caveats - colors a little off and lines not quite right - no all are drawn seem to be drawn or it might just be me..... Demo sauce even runs :)

Here is the version that works.
 

Attachments

  • ILI9488_t3.zip
    919.7 KB · Views: 72
Ok, since I am known for my "sick" ideas... the smaller IMXRT chips are relatively cheap - maybe @Paul can make a simple display "breakout" with an IMXRT chip, with fast USB and display interface. Just like the Audioshield but with its own CPU and display (or, more general, 8080 interface)... it would be usable for the 3.6 (USB-HOST), too...
I'd say the "makers" -- not only Teensy-users - would love it..

edit: The nice thing is, once he has the T4-USB working, there would be not much software-development.. a simplistic API would be enough. :) - hehe.. and we as users, can write our own "drivers" in Arduino which we transfer to the breakout-board where they are executed in RAM... so much fun!

Maybe this is what Paul was thinking here: How about a 3.5 inch 480x320 tochscreen display? :: 04-01-2017, 05:28 PM

@mjs513 - just got your p#2165 zip - hope to get that and USBHost to see what is up.
 
@defragster - enjoy. Think I know the problem with the colors. Think the 9488 wants rgb666 and the code is using RGB565. Again this is a guess.
 
@defragster - enjoy. Think I know the problem with the colors. Think the 9488 wants rgb666 and the code is using RGB565. Again this is a guess.

Seems right those two bits go somewhere :) Didn't get to unzip yet - so will look for any updates - need to get the most current other libs as well?
 
Hm, I think that was the display only.

Yeah - but specifying it to work well … just a minor 'sick' :) upgrade . … the imxRt1020 drops the display interface elements. Though Paul does have a pile of 1052's on hand . . . .

NXP page gave this large quantity - low price :: 10K @ US $4.40

Question: The 1062 unused "Boot ROM (128 KB)" - does the processor have any ability to write and update that area internally while running? For EEPROM or other storage when not used during boot?
 
Seems right those two bits go somewhere :) Didn't get to unzip yet - so will look for any updates - need to get the most current other libs as well?
My guess is the code is already sort of handling it.

That is in your code you have:
Code:
void ILI9488_t3::write16BitColor(uint16_t color){
  // #if (__STM32F1__)
  //     uint8_t buff[4] = {
  //       (((color & 0xF800) >> 11)* 255) / 31,
  //       (((color & 0x07E0) >> 5) * 255) / 63,
  //       ((color & 0x001F)* 255) / 31
  //     };
  //     SPI.dmaSend(buff, 3);
  // #else
  uint8_t r = (color & 0xF800) >> 11;
  uint8_t g = (color & 0x07E0) >> 5;
  uint8_t b = color & 0x001F;

  r = (r * 255) / 31;
  g = (g * 255) / 63;
  b = (b * 255) / 31;

  writedata8_last(r);
  writedata8_last(g);
  writedata8_last(b);
  // #endif
}
So the first part is extracting the 5 6 5 bits into the variables r g b and then it is doing some scaling on them, probably to get to the right color range (at least hopefully).

Notes the last part is probably not as fast it can/should be...

The difference between writedata8_last and writedata8_cont is the cont (continue version), is with the writedata8_cont it simply puts the data onto the queue and waits until there is a least one free spot free in the queue before it returns... Whereas the writedata8_last, says wait until all data in the queue has been fully transferred (that is the queue is empty, and the shift register completes shifting out the last bits and it can return the data from the MISO side...) So typically you use that one if/when you are going to need to change CS (and in our case DC) pin states.

The _cont names were also chosen as the T3.x SPI registers have a a CONT bit that says hold the state of the CS pin after transfer completes, which we use and in addition when this is set it reduces the time between SPI outputs. (No CS change...)

SO at minimum, the above, the first two should be _cont and the last one maybe _last or you will see in the code that we call writedata16_cont for all pixels except the last one we are going to output...

Sorry if I am a little too verbose here ;)

Edit: forgot to mention that your _t3 library ran for me :D (I did change the library properties file to change name and description as to have it show up in examples) Also edited GraphicTest to use the right stuff... (Also in my case needed to pass 8 for Reset pin).
Current timings without changes:
Code:
ILI9488 Test!
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark                Time (microseconds)
Screen fill              1536830
Text                     21626
Lines                    193061
Horiz/Vert Lines         123927
Rectangles (outline)     23996
Rectangles (filled)      3712437
Circles (filled)         387853
Circles (outline)        195852
Triangles (outline)      47116
Triangles (filled)       1098853
Rounded rects (outline)  104807
Rounded rects (filled)   4009016

Edit2: with first two changed to _cont, the timings are:
Code:
ILI9488 Test!
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark                Time (microseconds)
Screen fill              1119266
Text                     18600
Lines                    193062
Horiz/Vert Lines         91549
Rectangles (outline)     23996
Rectangles (filled)      2706663
Circles (filled)         303911
Circles (outline)        182851
Triangles (outline)      44485
Triangles (filled)       818235
Rounded rects (outline)  87706
Rounded rects (filled)   2936985
Done!
 
Last edited:
@KurtE

The difference between writedata8_last and writedata8_cont is the cont (continue version), is with the writedata8_cont it simply puts the data onto the queue and waits until there is a least one free spot free in the queue before it returns... Whereas the writedata8_last, says wait until all data in the queue has been fully transferred (that is the queue is empty, and the shift register completes shifting out the last bits and it can return the data from the MISO side...) So typically you use that one if/when you are going to need to change CS (and in our case DC) pin states.

The _cont names were also chosen as the T3.x SPI registers have a a CONT bit that says hold the state of the CS pin after transfer completes, which we use and in addition when this is set it reduces the time between SPI outputs. (No CS change...)

SO at minimum, the above, the first two should be _cont and the last one maybe _last or you will see in the code that we call writedata16_cont for all pixels except the last one we are going to output...
Thanks for the explanation, wasn't sure what they were doing. Was just happy it was working. Been kind of out of it this afternoon - sorry

EDIT: Changed that last line as you suggested and got almost identical results as you show in post 2171
 
@mjs513 (and others) - Been there took me awhile to figure out some of this stuff after Paul did it in original _t3 code...

I did a first pass at hacking to have the write16BitColor_cont and write16BitColor_last and change the calls...

I think I may have screwed up some places, as the DEADBEEF text page is somewhat garbled...

But timing improved again
Code:
ILI9488 Test!
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark                Time (microseconds)
Screen fill              810750
Text                     16854
Lines                    193081
Horiz/Vert Lines         67481
Rectangles (outline)     23996
Rectangles (filled)      1958636
Circles (filled)         243329
Circles (outline)        175583
Triangles (outline)      42535
Triangles (filled)       611539
Rounded rects (outline)  75856
Rounded rects (filled)   2140427
Done!
 
@mjs513 (and others) - Been there took me awhile to figure out some of this stuff after Paul did it in original _t3 code...

I did a first pass at hacking to have the write16BitColor_cont and write16BitColor_last and change the calls...

I think I may have screwed up some places, as the DEADBEEF text page is somewhat garbled...

But timing improved again
Code:
ILI9488 Test!
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark                Time (microseconds)
Screen fill              810750
Text                     16854
Lines                    193081
Horiz/Vert Lines         67481
Rectangles (outline)     23996
Rectangles (filled)      1958636
Circles (filled)         243329
Circles (outline)        175583
Triangles (outline)      42535
Triangles (filled)       611539
Rounded rects (outline)  75856
Rounded rects (filled)   2140427
Done!

That's a nice improvement to the original performance numbers :)
 
Thanks, Still more stuff to try and test... Like what if I actually use DC on CS pin here? Or use 24 bit SPI writes?
In case you want to see the current stuff:

I think I fixed the screw up on text line... Updated graphictest (still has my pin 8 hard coded as reset...)

Not much difference with DC=10, CS=9
Code:
ILI9488 Test!
Display Power Mode: 0x9C
MADCTL Mode: 0x88
Pixel Format: 0x6
Image Format: 0x0
Self Diagnostic: 0xC0
Benchmark                Time (microseconds)
Screen fill              813691
Text                     14391
Lines                    138049
Horiz/Vert Lines         65725
Rectangles (outline)     22222
Rectangles (filled)      1966068
Circles (filled)         224702
Circles (outline)        141760
Triangles (outline)      31568
Triangles (filled)       587419
Rounded rects (outline)  65809
Rounded rects (filled)   2128516
Done!
 

Attachments

  • ILI9488_t3.zip
    902.1 KB · Views: 61
Status
Not open for further replies.
Back
Top