RSHELL --buffer-size recommendation

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
ajie_dirgantara
Posts: 81
Joined: Fri Sep 02, 2016 9:26 am

RSHELL --buffer-size recommendation

Post by ajie_dirgantara » Fri Aug 18, 2017 10:24 am

I've got issue with --buffer-size=32 on rshell. sometimes it just stop there and do nothing. Eventually after stop and board reset, it will re-format and lost all data in flash. The problem isn't occuring if I set --buffer-size=1. What could be a problem? is it on the usb to serial converter or on the board itself?

User avatar
dbc
Posts: 89
Joined: Fri Aug 28, 2015 11:02 pm
Location: Sunnyvale, CA

Re: RSHELL --buffer-size recommendation

Post by dbc » Fri Aug 18, 2017 4:11 pm

So a while back I filed this issue: https://github.com/micropython/micropython/issues/3231 which has a similar smell, although it has nothing to do with rshell. Unfortunately, I haven't had a chance to get back to chasing it but I hope to get some bench time on it this weekend when I can set up a test rig again.

In my case, I was flooding the UART with a lot of data. After a while, the board resets and the flash file system is wiped. I suspect a race in the UART buffering, but really haven't done enough work to say that for certain. I was using an FTDI USB-to-serial converter cable. I want to try back-to-back pyboards and other scenarios and just collect more data and see if I can characterize exactly what sensitises the issue.

You might actually be more quickly able to find repeatable sensitization stimulus, since you are coming in through rshell. I have to pare down some other code in order to narrow things down. In my case I see the issue with a buffer size of 64.

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

Re: RSHELL --buffer-size recommendation

Post by dhylands » Fri Aug 18, 2017 7:23 pm

The current mechanism used by rshell to send files is not particularly robust. If a single character is dropped then the receiving end will hang, waiting for that additional character.

The ideal buffer size is one where the host can send continuous bursts of data of buffer-size bytes and the device won't lose any characters. For the ESP8266, this seems to be about 30. The default is 512, which works fine on the pyboard using a direct USB connection.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: RSHELL --buffer-size recommendation

Post by pythoncoder » Sat Aug 19, 2017 4:41 am

@ajie_dirgantara Out of interest what MicroPython target board are you using?
Peter Hinch
Index to my micropython libraries.

ajie_dirgantara
Posts: 81
Joined: Fri Sep 02, 2016 9:26 am

Re: RSHELL --buffer-size recommendation

Post by ajie_dirgantara » Mon Aug 21, 2017 4:08 am

pythoncoder wrote:@ajie_dirgantara Out of interest what MicroPython target board are you using?
The board is our own custom board with STM32L451VE chip (hence I port from L476) with some modifications. It has 160KB contiguous RAM, and we didn't use USB at all, hence I am using rshell with native uart for comm.

The problem arise when I've done porting flash for that particular chip. erasing and writing was never be a problem. but when using rshell, it failing on buffer size above 1.

please note also that the main clock is using HSE with 16.384 MHz, do you think this has to do with the uart baudrate? It is not occuring in L476 with same settings though, so I don't think this is the problem.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: RSHELL --buffer-size recommendation

Post by pythoncoder » Mon Aug 21, 2017 4:48 am

An accurate measurement of the baudrate with a scope or LA would settle that one.
Peter Hinch
Index to my micropython libraries.

Post Reply