Problems With Slow GPIO Toggling Test

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
jfet
Posts: 3
Joined: Fri Feb 17, 2017 2:21 am

Problems With Slow GPIO Toggling Test

Post by jfet » Tue Feb 21, 2017 7:44 pm

I've been working with the Adafruit Feather Huzzah ESP8266 lately, using Micropython 1.8.5. Recently I was testing how fast the GPIO could toggle without anything else running on the board, and I was quite surprised at how slow the GPIO seemed to be toggling.

My code looked like this, and I ran it from the REPL:

import machine
a = machine.Pin(0, machine.Pin.OUT)
while True:
a.low()
a.high()

I hooked up my scope to pin 0 to find the approximate frequency that the GPIO was toggling at, and to my surprise it was at around 1MHz; this is much slower than what I would expect from the 80MHz EPS8266.

I'm not sure if this slow GPIO speed is just inherit with using all the overhead involved in Micropython, or if there's something I'm doing wrong in testing this GPIO toggle speed, but I would appreciate if someone could verify that this is normal behaviour for a Feather Huzzah ESP8266. I'm puzzled as to why such simple GPIO commands could behave so slowly.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Problems With Slow GPIO Toggling Test

Post by dhylands » Tue Feb 21, 2017 9:07 pm

You may want to look at this thread: http://forum.micropython.org/viewtopic.php?f=16&t=2766

jfet
Posts: 3
Joined: Fri Feb 17, 2017 2:21 am

Re: Problems With Slow GPIO Toggling Test

Post by jfet » Wed Feb 22, 2017 12:31 am

[quote="dhylands"]You may want to look at this thread: http://forum.micropython.org/viewtopic.php?f=16&t=2766[/quote]

That clears things up - thank you!

Post Reply