Hello World! Finally, the project is ready to go public. If you have any ideas, improvements or comments to share, feel free!
During the last days, I struggled a bit with getting the timing for the gray scale output right. Each row has to be activated for a only a few microseconds to only dim it slightly. While this worked most of the time, sometimes, the code took much longer, resulting in dark horizontal stripes. Debugging this was quite a journey, since I was new to the ESP32:
- Coming from the world of Arduino, having a real-time OS running on the chip was new. Disabling interrupts during the critical sections helped, the fact that the noInterrupts() function of the Arduino framework for the ESP32 is just a dummy did not.
- At this point, most bad stipes where gone, but timing was still somewhat irregular, even when using the hardware timer. I thought using hardware timer interrupts is as good as it gets when trying to do exact timing, but apparently I was wrong. If someone has an idea why this could be, please tell me!
- Finally, tagging the critical function with IRAM_ATTR and busy waiting for a set number of CPU cycles did the trick.
Busy waiting does not seem like the most elegant solution, but it works. Refresh times are now at about 2 seconds for a gull grayscale image of 1200x825 pixels. If I could manage to already shift in new data while waiting for the current row to fade, this could be even faster. I'll have to try some things :)
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.