uasyncio in MicroPython
Posted: Sun Jul 28, 2019 9:57 pm
Hi,
I've inherited a project based on ESP32 and MicroPython.
Some components already in production use threads, but are scheduled for a rewrite.
The component I'm working on now has been prototyped using MicroPython (not Pycopy) and uasyncio/picoweb.
I won't be keeping the web server but do need a TCP server, as well as other I/O.
According to https://pypi.org/project/micropython-uasyncio/ uasyncio "is intended to be used with" Pycopy. How stable is it on MicroPython trunk? And what are the differences with and future plans for Pycopy? Is it pure luck that the uasync/picoweb code is working now on MicroPython trunk, or can I avoid the unsupported features?
My other question is about the dual core ESP32. As I understand it, by default (on arduino style SBC's at least), one core is dedicated to radio services and one to the interpreter. Do MicroPython threads on ESP32 ever provide processing on both cores? Ie, do threads provide any performance advantage to compensate for the extra memory use, etc?
I would prefer coroutines to threads. I've used C Protothreads in the past (albeit where threading was not an option) and I think they are a great option for concurrency on uC's.
Thanks!
I've inherited a project based on ESP32 and MicroPython.
Some components already in production use threads, but are scheduled for a rewrite.
The component I'm working on now has been prototyped using MicroPython (not Pycopy) and uasyncio/picoweb.
I won't be keeping the web server but do need a TCP server, as well as other I/O.
According to https://pypi.org/project/micropython-uasyncio/ uasyncio "is intended to be used with" Pycopy. How stable is it on MicroPython trunk? And what are the differences with and future plans for Pycopy? Is it pure luck that the uasync/picoweb code is working now on MicroPython trunk, or can I avoid the unsupported features?
My other question is about the dual core ESP32. As I understand it, by default (on arduino style SBC's at least), one core is dedicated to radio services and one to the interpreter. Do MicroPython threads on ESP32 ever provide processing on both cores? Ie, do threads provide any performance advantage to compensate for the extra memory use, etc?
I would prefer coroutines to threads. I've used C Protothreads in the past (albeit where threading was not an option) and I think they are a great option for concurrency on uC's.
Thanks!