ESP32 and IL9341 Speed Test - Teaser Video

Use this section to discuss your embedded Flowcode projects.
Post Reply
mnfisher
Valued Contributor
Posts: 955
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

ESP32 and IL9341 Speed Test - Teaser Video

Post by mnfisher »

I had some ideas for the esp32 and a small display. The speed though was a little disappointing.

The esp32 is capable of some good speed - here running a Il9341 display on 30MHz SPI. Displaying a 3d rotating cube on a 'grid' background.

Yes - that is a frame count at the top left - and everything is calculated (cube rotation) and drawn each frame.

Immense kudos for the best (or funniest) suggestion as to how I did it :-)

https://youtu.be/is-FO8p-7gU

Martin

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: ESP32 and IL9341 Speed Test - Teaser Video

Post by BenR »

That's very impressive Martin.

Very interested to see how you achieved that.

I'm guessing you dipped it in some type of cheeter blood.

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Re: ESP32 and IL9341 Speed Test - Teaser Video

Post by mnfisher »

Thanks Ben,

No - definitely no cheeting here :-)

Martin

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 and IL9341 Speed Test - Teaser Video

Post by stefan.erni »

Hi Martin

Very good and good to know that Flowcode 9 with ESP32 is already running so well.
I'm trying something similar with FC10 App Developper. Also in 3D.

regards

Stefan

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: ESP32 and IL9341 Speed Test - Teaser Video

Post by jgu1 »

Wow Martin, look good, I dare to ask, Will you share your program. :D
?
Ben really managed to speed this display up with ESP32 ;)

Br jorgen

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Re: ESP32 and IL9341 Speed Test - Teaser Video

Post by mnfisher »

Hi Jorgen,

Yes, though a bit more to do - just working on bitmap support 1 bit it's nearly working at the moment.

I was also going to do a before and after video😛

Martin

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Re: ESP32 and IL9341 Speed Test - Teaser Video

Post by mnfisher »

Ok - this is the 'how it works'. Just in time for Christmas! Sadly work gets in the way of fun too often :-(

So - for speed - I output the complete screen data in a single 'lump' (see BlitBuffer) This means that the whole display can be drawn at the maximum speed (I got SPI working at 30MHz - and faster may be possible with newer esp32 variants or by 'tweaking' some of the SPI settings - see the error messages sent to UART when attempting faster speeds)

To do this - the whole display must be buffered in RAM - and I went with a 4 colour display (2 bits per pixel, with 0 as black and 3 as white) Note that it would be possible to do a black and white display (one bit per pixel - my first attempt did this) or up to 256 colour (8 bits per pixel) - the trade off is RAM usage - 2 bits per pixel uses 19.2KB RAM and 8 bits would be 4 times this. The only macros that need changing are Plot, Clear and BlitBuffer.

I added a Plot, DrawLine and CopyBM (Copy bitmap - currently just monochrome 1 bit per pixel)as well as a simple text.

The only macros I use from the component are Initialise and Window. The wiring to the display uses A15 for Chip Select - and if you change this then you MUST change the pin used in BlitBuffer (where this is hard-coded - I couldn't find an easy way to 'pull' the value from FC) It's fairly easy to modify to use the component (for example the cube rotation) - if you want to see the speed improvement.

Bitmaps - these are added using #include statements in supplementary code. There is a simple Python program to convert a bitmap to a C file in the attachment (tohex.py usage tohex.py fname.abc -> creates fname.dat) I used ImageMagick to convert pngs to mono bitmaps. There is a 'draw background' option - if there are large areas of background it is quicker to use clear and set this to false. This is also used to give the 'transparent' images.

Unfortunately FC doesn't support pointers - so I use 32 bit integers and a little bit of C to get the address of the bitmaps and to read data from the memory referenced.

Compilation - save then attempt to compile the program (demo.fcfx) this will fail - but it will create the directory structure - and then copy the attached files (extract the zip) to demo\main. Then recompile and enjoy(?) There are '4' distinct demos - one with a suitably seasonal message!
I toyed with different fonts for the final 'scrollie' - The 'F' is still different...

I used (pseudo) random colours - output may not always be harmonious!
demo.fcfx
(80.56 KiB) Downloaded 95 times
main.zip
(59.75 KiB) Downloaded 86 times
Good luck to anyone brave enough to try - and to everyone at Matrix and Flowocode users everywhere my best wishes for a happy Christmas and a prosperous and peaceful New Year.

Martin

Post Reply