Post
by dhylands » Thu Jun 14, 2018 4:49 pm
When I wrote rshell, it was focused on the pyboard, which has a native USB peripheral, and the default buffer size was set to 512 bytes.
Devices which use a serial interface typically have much smaller buffers. rshell can do ascii or binary. The ascii mode transfer send 2 bytes for each byte of data.
The default serial buffer size is 64 bytes. In ascii mode, this would drop to 32 bytes of data being transferred. Setting a wee bit smaller for good measure yields a buffer size of 30 bytes,
When transferring files, the host will send "buffer size" bytes of data and then wait for an ACK. The host can typically send data at full serial speeds and the receiving device often cab't keep up, especially when writing to flash. The serial driver on the device typically uses hardware ISRs to store the data into the serial buffer, and it can normally keep up to whatever the full serial rate is, but the python code often gets delayed waiting for data writes to flash to finish etc.