Previous journal: | Next journal: |
---|---|
0098-2023-06-19.md | 0100-2023-06-21.md |
Continuing the Python pico_deo client:
- Slightly better-structured command/read cycle.
- Seems to work, though it is a bit slow: Typically 2ms between commands. For Raybox purposes, a "bit-banging" approach at this speed would allow only about 8 commands per frame, and this is probably too slow. Might need special combo commands, then, and a way to attach them to interrupts.
- Can we use CircuitPython and usb_cdc.
- Would've been nice to come across rp2daq early on.
- Try disabling CRLF conversion. See here which should refer to this.
- Try overclocking RP2040 to 250MHz and see if it improves USB speed. This gave me the idea.
- Why am I finding PySerial slow? Is it PySerial itself (and maybe just the speed of interpreted Python); or the approach I'm taking with it (inc. bin/ASCII conversion); or the USB speed; or the RP2040 speed? Could even be internal USB buffering so maybe we need to find a way to make PySerial do a flush at the end of each command, as well as make the RP2040 firmware do the same for each response.
- Is PySerial's
read_until
likely to be any faster thanreadline()
, which maybe includes a timeout for CRLF or something? - Some thoughts on improving PySerial throughput, but I think this is more for handling long data streams (esp. bulk reads) rather than the command/response stuff we need.
- Though there's an option to specify serial baud rate, it appears to be ignored
when using USB-Serial (i.e. USB-CDC).
An example
(though for Arduino, not Pico) suggests:
Serial.begin(9600); // USB is always 12 or 480 Mbit/sec
- NOTE: Opening USB-serial at 1200 baud specifically seems to be an intentionally-designed way to reset the RP2040 to BOOTSEL mode. For more info see this, this, and this.
- GPIO speeds for various embedded devices, and an interesting related note on RP2040 PIO using C and MicroPython. Also, this PIO logic analyser.
- Notes on possible direct USB-to-USB instead of USB-CDC?
- Unrelated to this project, this could be an interesting read re x86-64 assembly on Linux, and X11/network stuff: https://gaultier.github.io/blog/x11_x64.html