GPIO bit-banging - what are the actual limitations and sources of interference?
Posted: Fri Feb 10, 2017 11:58 pm
[Though this question refers to Arduino-ESP32 it's more of a general question about the ESP32 platform.]
When speaking of Arduino below, I'm using Arduino-ESP32 - however, as that simply runs and loopTask is quite simple in itself (effectively whatever code you specify in setup() and loop()), that part should translate easily to a non-Arduino setup.
My question is, given a simple program that simply bit-bangs a GPIO pin, what are some sources of interruption or unexpected delay that would cause that to vary in terms of timing? As this is run on CPU 1, would WiFi or Bluetooth (not in-use for my little sketch) be interrupting things? Is there some memory caching going on that leads to timing variances? Are other things still happening on CPU1 in this regime?
I realize there are other ways to deal with this (e.g., RMT) - though they aren't in wide use when it comes to Arduino-ESP32 and in general mean a fair amount of code refactoring. For those times when bit-banging may be preferable it'd be useful to know what the actual limitations and sources of interference and delay are when it comes to GPIO bit-banging and the ESP32.
When speaking of Arduino below, I'm using Arduino-ESP32 - however, as that simply runs
Code: Select all
xTaskCreatePinnedToCore(loopTask, "loopTask", 4096, NULL, 1, NULL, 1);
My question is, given a simple program that simply bit-bangs a GPIO pin, what are some sources of interruption or unexpected delay that would cause that to vary in terms of timing? As this is run on CPU 1, would WiFi or Bluetooth (not in-use for my little sketch) be interrupting things? Is there some memory caching going on that leads to timing variances? Are other things still happening on CPU1 in this regime?
I realize there are other ways to deal with this (e.g., RMT) - though they aren't in wide use when it comes to Arduino-ESP32 and in general mean a fair amount of code refactoring. For those times when bit-banging may be preferable it'd be useful to know what the actual limitations and sources of interference and delay are when it comes to GPIO bit-banging and the ESP32.