Wrong delay when use "delay ms" ESP32

Any bugs you encounter with Flowcode should be discussed here.
jgu1
Posts: 774
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 669 times
Been thanked: 173 times

Re: Wrong delay when use "delay ms" ESP32

Post by jgu1 »

Absolutely Ben, faster. Now I will try to test spi with ESP32. Can´t get it fast enough :lol:

Now I see in the configuration for the ILI9341 SPI component it is not possible to select "Use pin reference" like in the serial ILI component or am I not looking the rigth place?

Br. Jorgen

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: Wrong delay when use "delay ms" ESP32

Post by BenR »

Hi Jorgen,

For the SPI remap pins, sorry no this is currently not possible.

However it should be fairly simple to work out. PortA is GPIO pins 0-31 so PortA 19 would be GPIO 19. PortB is GPIO pins 32-63 so PortB 2 would be GPIO 34.

Hope this makes sense.

jgu1
Posts: 774
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 669 times
Been thanked: 173 times

Re: Wrong delay when use "delay ms" ESP32

Post by jgu1 »

OK Thank´s Ben!

Now I perform a test with Ili9341 SPI. It is extreeeeem slow?

Jorgen
Attachments
ESP32 ILI9341 BR .fcfx
(26.63 KiB) Downloaded 635 times

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: Wrong delay when use "delay ms" ESP32

Post by BenR »

Hi Jorgen,

The Prescale property sets how fast the SPI is output. It's currently at 400KHz in your program but can go a lot faster. I suggest trying it at 10MHz and see how you get on.

jgu1
Posts: 774
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 669 times
Been thanked: 173 times

Re: Wrong delay when use "delay ms" ESP32

Post by jgu1 »

Already done Ben. I try to step up to 30 Mhz max. over this the display stop working, But still not so fast as the as the serial.

If I measure with a scope on the MISO pin I don´t see any signal, and even if I remove the pin it still work, but slow compared with serial.

Jorgen

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: Wrong delay when use "delay ms" ESP32

Post by BenR »

Hi Jorgen,

Let me do some more testing and I'll see if I can find another bottleneck for you. The SPI is currently being run byte by byte but the ESP chip can work with SPI in transaction mode where you queue up a load of bytes and then let it go. This might be the way to let it run faster. 30MHz is a lot faster then the software version will go by say a factor of at least 10 so there must be a bottleneck somewhere.

I'll have a play and let you know.
If I measure with a scope on the MISO pin I don´t see any signal
For the GLCD MISO isn't used it's just the MOSI and the SCK.

jgu1
Posts: 774
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 669 times
Been thanked: 173 times

Re: Wrong delay when use "delay ms" ESP32

Post by jgu1 »

Thank you Ben. Look forward to see :D

Jorgen.

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: Wrong delay when use "delay ms" ESP32

Post by BenR »

It's pretty much as I had imagined, the SPI is faster but the overhead is killing it.

The top trace shows the software driven display and the bottom trace shows the SPI version @ 10MHz.
Logic.jpg
Logic.jpg (47.24 KiB) Viewed 8785 times
I'll keep chipping away at it. :D

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: Wrong delay when use "delay ms" ESP32

Post by BenR »

I've pushed a new version of the SPI display component which should be a lot faster.

I have a program that just clears each display version,

Using the new SPI display component the clear is now a lot faster, 630ms for the serial component vs 75ms for the SPI version @ 25MHz.
Logic2.jpg
Logic2.jpg (43.72 KiB) Viewed 8780 times
It will be interesting to see how it gets on with a test that's drawing data to the display. I've optimised where I can so hopefully it is still as fast if not faster.

jgu1
Posts: 774
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 669 times
Been thanked: 173 times

Re: Wrong delay when use "delay ms" ESP32

Post by jgu1 »

Hi Ben!
Thank you
Run an update, but sorry now it doesn´t work at all :(

I try to set the prescaler from 100 khZ and up to 25 mHz, bu it is not working at all. I try to go back to previus version 10 it work again. But slow.

Do you have an ILI9341 Spi display for test?

Br jorgen

Post Reply