ZMODEM transfer with mini shell

Please do not post requests
Post Reply
User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

ZMODEM transfer with mini shell

Post by Pito » Sun Jun 18, 2017 10:10 am

I've tried this ZMODEM app
https://forum.arduino.cc/index.php?topic=382044.0
with Black F407ZET and STM32Generic. SerialUSB as the console and Serial1 (115k2, FTDI dongle) as the ZMODEM link. TeraTerm with its built in ZMODEM. SDIO with SdFat.

As usual the "sz" (sending files from Black to PC) works somehow, the issue seems to be with "rz" (sending files from PC to Black).
It seems to me there is a bug in "rz" - it starts well, after a while (usually at >100kB) the transfer speed drops down while the packets often repeats (a stall basically) and the effective transfer rate drops to maybe 1kB/sec.
It mostly fails with larger files (>100kB), but when the rz is restarted again (with the same file) it usually finishes the file upload with good speed.

With 115k2 the "sz" mostly transfers at ~10kB/sec, the same with "rz" with smaller files.

There is a simple Command Shell which allows you do cd/dir/ls/mkdir/rm/sz/rz etc.

Code: Select all

Arduino ZModem V2.1
Transfer rate: 115200
About to initialize SdCard
About to change directory
SdCard setup complete
Arduino ZModem V2.1 - Transfer rate: 115200
Available Commands:
HELP     - Print this list of commands
DIR      - List files in current working directory - alternate LS
PWD      - Print current working directory
CD       - Change current working directory
DEL file - Delete file - alternate RM
MD  dir  - Create dir - alternate MKDIR
RD  dir  - Delete dir - alternate RMDIR
SZ  file - Send file from Arduino to terminal (* = all files)
RZ       - Receive a file from terminal to Arduino (Hyperterminal sends this
              automatically when you select Transfer->Send File...)
dir
Directory Listing:
MANDEL.BMP      480054
RAINBOW.BMP     307254
mydir1          DIR
test_in.bin     2069609
mydir           DIR
freq.pdf        251390
sdio.bin        32584
End of Directory
rm test_in.bin
File test_in.bin deleted
rz
 Zmodem transfer failed
rz
 Zmodem transfer successful
dir
Directory Listing:
MANDEL.BMP      480054
RAINBOW.BMP     307254
mydir1          DIR
test_in.bin     2069609
mydir           DIR
freq.pdf        251390
sdio.bin        32584
End of Directory
We messed a lot with Zmodem at retrobsd, I think the latest rz version there worked much better (there is a lot of posts on the topic there). I think the "rz" with a 168MHz stm32, SDIO and built-in hw crc32 cannot have any issue while receiving Zmodem files at 1Mbaud :)
Last edited by Pito on Sun Jun 18, 2017 12:37 pm, edited 3 times in total.
Pukao Hats Cleaning Services Ltd.

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: ZMODEM

Post by Pito » Sun Jun 18, 2017 11:24 am

And the .bin for the advanced users :P
Black F407, 168/24MHz, Sdcard on the SDIO, SerialUSB is the Console, Serial1 (115k2, 8n1, the header on the board) is the ZMODEM link.
Zmodem_SDIO.rar
(32.59 KiB) Downloaded 26 times
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1820
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: ZMODEM transfer with mini shell

Post by stevestrong » Sun Jun 18, 2017 12:01 pm

Any app for the PC to try that?

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: ZMODEM transfer with mini shell

Post by Pito » Sun Jun 18, 2017 12:04 pm

For example the TeraTerm as I wrote above:

http://logmett.com/tera-term-the-latest-version
.
TT and ZMODEM.JPG
TT and ZMODEM.JPG (77.56 KiB) Viewed 424 times

You have to open 2x TT windows:
=================================
1. Console with the shell (SerialUSB port)
2. Zmodem link (zlink) (Serial1 port, 115k2 8N1)

Upload a file from PC to Black:
=================================
In the Console you type rz, in the zlink window it shows a weird transfer ID string, something like

Code: Select all

**B0100400023a3fd
then in the zlink window select Send (see above the screenshot) and chose a file to send, after a moment it starts to upload to the Black.

Download a file from Black to PC:
=================================
In the Console you type sz filename (the file must exist on the SdCard, mind the current directory, / is the root), then in the zlink window select Receive, after a moment it starts to download to the PC.

Console:

Code: Select all

dir
Directory Listing:
MANDEL.BMP      480054
RAINBOW.BMP     307254
mydir1          DIR
test_in.bin     2069609
mydir           DIR
freq.pdf        251390
sdio.bin        32584
End of Directory
pwd
Current working directory is /
cd mydir1
Current directory changed to mydir1
ls
Directory Listing:
test_in.bin     2069609
WLX_AN~1.ZIP    242157
End of Directory
sz test_in.bin
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1820
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: ZMODEM transfer with mini shell

Post by stevestrong » Mon Jun 19, 2017 5:42 pm

Pito, do you have the (adapted) sketch on your github?
Or it is fairly simple to adapt to STM32?

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: ZMODEM transfer with mini shell

Post by Pito » Mon Jun 19, 2017 5:47 pm

It is an arduino sketch, so it is easy to adapt.. :)
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1820
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: ZMODEM transfer with mini shell

Post by stevestrong » Mon Jun 19, 2017 9:10 pm

here is the libmaple F4 throughput:
stm32f4_zmodem_throughput.jpg
stm32f4_zmodem_throughput.jpg (42.86 KiB) Viewed 363 times
.
yields ~150kBps over USB serial.

The speed can be eventually increased by increasing the size of the read data block from the card, but I cannot detect where to do this, the CPP files are pretty badly coded, I have no oversight what is going on there...

Post Reply