When running any code that uses asyncio.run() or asyncio.create_task() on the Adafruit Feather Bluefruit Sense (nRF52840), the program fails with the following error:
Traceback (most recent call last):
File "code.py", line XX, in
File "/lib/asyncio/core.py", line XXX, in run
File "/lib/asyncio/core.py", line XXX, in create_task
AttributeError: 'TaskQueue' object has no attribute 'push_head'
Steps to reproduce:
- Use Feather Bluefruit Sense (nRF52840) with CircuitPython 10.x.
- Install adafruit_asyncio from the Adafruit bundle.
- Run a minimal asyncio script such as:
import asyncio
async def main():
while True:
print("Hello")
await asyncio.sleep(0.5)
asyncio.run(main())
Expected behavior:
- The coroutine should run, printing “Hello” every 0.5 seconds.
Observed behavior:
- The program crashes immediately with TaskQueue push_head AttributeError.
Additional context:
- This appears to be a hardware/library limitation.
- Using a single while loop without asyncio.run() works as a workaround.
Environment:
Board: Feather Bluefruit Sense (nRF52840)
- CircuitPython: 10.x
- adafruit_asyncio version: latest bundle
Workaround:
- Use a normal while loop or a single async function without create_task() or asyncio.run().