micropython / micropython/micropython-lib
Cannot init USB devices in boot.py
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.1k
- Avg merge
- 7d 6h
- Merged PRs (30d)
- 3
Description
I tested this on a pico running MP 1.23 and the latest release of usb-device-cdc.
boot.py:
import usb.device
from usb.device.cdc import CDCInterface
IFACE_TWO = CDCInterface()
IFACE_TWO.init(timeout=0)
#usb.device.get().init(IFACE_TWO, builtin_driver=True)
main.py:
from time import sleep_ms
def main():
while True:
print(IFACE_TWO)
sleep_ms(1000)
if __name__ == "__main__": main()
Running this as-is, IFACE_TWO does show up in main.py, but uncommenting the init function causes the process to error out. This discord post suggests you can call usb.device.get.init() in boot.py, is this no longer true?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example using boot.py and main.py on MicroPython 1.23 with the latest usb-device-cdc release. Start by tracing usb.device.get().init() and CDCInterface.init(timeout=0) to compare initialization in boot.py with later execution. Done when the supported boot.py behavior is established and the process error is fixed or clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100