USB_VCP buffer

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
User avatar
kamikaze
Posts: 154
Joined: Tue Aug 16, 2016 10:10 am
Location: Latvia
Contact:

USB_VCP buffer

Post by kamikaze » Wed Feb 01, 2017 3:10 pm

I'm sending data to PyBoard from my laptop via USB. As you can see - I have to sleep() on each send, otherwise PyBoard blinks with green and red LEDs and just hangs its work.
Here is the receiver part.

I would agree to sleep() once per while-loop iteration, not per line being sent. Is there any limits regarding to that? Speed, amount of data, amount of "write()" calls etc. :roll:

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: USB_VCP buffer

Post by dhylands » Wed Feb 01, 2017 4:26 pm

If it's doing the blinky light thing (probably a hard fault) then I think that's a bug.

Sending data from the pyboard to the host there is a 1K buffer for USB data. Once the buffer fills up, and there is a host connected, then I think that the sender is supposed to block and wait for the buffer to go down. If there is no host connected then I think that the data winds up getting dropped.

Sending data to the pyboard from the host there is also a 1K buffer. I believe that in this direction, the pyboard winds up dropping the data once the buffer gets full since it doesn't have anyplace to put it.

What I do in rshell is that I sent some data (upto about 512 bytes) and then wait for an ACK. Then send some more data, etc.

User avatar
kamikaze
Posts: 154
Joined: Tue Aug 16, 2016 10:10 am
Location: Latvia
Contact:

Re: USB_VCP buffer

Post by kamikaze » Wed Feb 01, 2017 4:30 pm

hm... I'm sending 3 lines that may not reach even 512 bytes in total. Need to investigate more then...

User avatar
kamikaze
Posts: 154
Joined: Tue Aug 16, 2016 10:10 am
Location: Latvia
Contact:

Re: USB_VCP buffer

Post by kamikaze » Sat Feb 04, 2017 12:10 am

Ok, my double fault. First is that I'm sending "lines" without line endings, while reading them with "readline()". So I'm getting all 3 at once. Then happens second fault - code unable to handle so many parts from such big string explosion by comma.
Thanks for info )

Post Reply