Closed mingpepe closed 1 year ago
Oh, I miss the detail in endpointReadDone
. Just think it is missing. This PR should be closed.
One of issues is small packet (size < max_packet_size) not received. After rp2040 write to DPRAM, the emulator indicate buffer ready immediately, the timing is obviously different from real chip. Though my code should not assume about timing. https://github.com/wokwi/rp2040js/blob/cac702d96ba358d73da4226b6259488c4671fd59/src/peripherals/usb.ts#L199-L209
this.rp2040.clock.createTimer
for this.indicateBufferReady
solved my problem, but finally I decided to modify my code since the timing assumption is not good. But maybe a delay for this.indicateBufferReady
can be considered and seems like it can combine with this.writeDelayMicroseconds
.
Do you mind testing if adding a timer for indicateBufferReady
fixes MicroPython 1.19.1?
USB CDC is broken with the latest release of MicroPython (see #101), and I've not yet been able to figure out how to fix that
Sadly, this does not fix it. After adding a timer, even the ">>>" prompt not shown.
Bummer! Did you try to send Ctrl+C or a newline? Sometimes these are required to drop into the prompt
Yes, it's still not working.
Thanks for testing!
Does it fix some problem for you?
Because the read delay is currently implemented by
endpointReadDone()
:https://github.com/wokwi/rp2040js/blob/cac702d96ba358d73da4226b6259488c4671fd59/src/peripherals/usb.ts#L214-L219