As the title says... Chat on...

User avatar
By Fr4gg0r
#8872 gpio.HIGH and gpio.LOW are complete bollocks and a waste of at least 7 bytes of RAM lol.
Should be removed from the firmware entirely.

Anyway, you can switch from 80MHz to 160MHz. ;)

In C the CPU will not be the limiting factor.
With loop unrolling you could toggle at 80MHz if the cpu runs at 160MHz, if the gpio peripheral is fast enough.
User avatar
By raz123
#8919
Fr4gg0r wrote:Anyway, you can switch from 80MHz to 160MHz. ;)


Sweet! Can't wait to try your 160 Mhz build! It should push GPIO around 18 KHz.

Fr4gg0r wrote:In C the CPU will not be the limiting factor.
With loop unrolling you could toggle at 80MHz if the cpu runs at 160MHz, if the gpio peripheral is fast enough.


Are you sure about that? The following poster seems to say that the fastest he could get GPIO to toggle, in C, was 1 MHz:
viewtopic.php?p=1191#p1191

Do you see a different/faster way?
User avatar
By RichardS
#8920 I was refering to a simple loop, on a 8 bit AVR at 1Mhz, 32 bit ESP more like 10Mhz....

i = 1000;
while(i--) {
gpio = 1;
gpio = 0;
}

scenario maybe 1Mhz was a little low but it could be anwhere from 8-25cycles depending on how you code the gpio.... if you do an unroll, then of course faster yet.....

i = 200;
while(i--) {
gpio = 1;
gpio = 0;
gpio = 1;
gpio = 0;
gpio = 1;
gpio = 0;
gpio = 1;
gpio = 0;
gpio = 1;
gpio = 0;
}

typcially kind of useless as in the realworld its not this easy, lots of other stuff gets in the way.

Richard.
User avatar
By raz123
#9015 Just thought I'd update this thread with my latest findings:

GPIO toggling speed results:

nodemcu (CPU @ 80 Mhz): ~10 Khz
nodemcu (CPU @ 160 Mhz): ~20 Khz
nodelua (CPU @ 80 Mhz): ~44 Khz

Yes, the nodelua firmware is about 4 times faster at toggling the GPIO than nodemcu is.
I, for one, would love to see nodemcu perform as well as its counterpart.