However, I can successfully transfer to the board very short files, e.g.
a few tens of bytes. Transferring files from the board to Linux works
fine.
Minicom shows these status messages, nothing happens, and the file is
not transferred: [...] The Z80-MBC2 is connected via serial USB
I'm troubleshooting a file transfer issue with sending files via XMODEM from a Linux system to a Z80-MBC2[1] CP/M system. The Z80-MBC2 is a great 8 MHz Z80 homebrew computer kit that can boot a number of operating systems, including CP/M 2.2 and CP/M 3.0.
On the Z80-MBC2, under CP/M 3.0 I execute the command XMODEM TEST.TXT /R. Then, on the Linux side, from a Minicom session I initiate a file transfer and select the TEST.TXT file. Minicom shows these status messages, nothing happens, and the file is nottransferred:
Dennis, I can no longer reproduce a successfull transfer, even for a
file that worked earlier.
It has been a long time since I used xmodem but I think you have this sequence backwards. Or at least the example in the sz documentation
(used by minicom to do the transfer) does it this way:
Dennis, I can no longer reproduce a successfull transfer, even for aIs this file text or binary?
file that worked earlier.
On Wednesday, June 22, 2022 at 4:17:38 PM UTC+2, Dennis Boone wrote:When it's small text files being sent to CPM it is easiest to open ED with the desired file name then send the ascii file then save it in ED.
It's a 104 bytes text file, specifically an Intel HEX file.Dennis, I can no longer reproduce a successful transfer, even for aIs this file text or binary?
file that worked earlier.
It's a 104 bytes text file, specifically an Intel HEX file.
If you add "-vv" to the sz command in minicom, do you get a log file
called /tmp/szlog (or maybe sxlog) after an attempted transfer?
You might also try calculating the checksum of the first block of the
file by hand to see what the checksum byte should be. Does it come out
to be 0x13?
I'm not sure how to calculate the checksum. Is it one of the algorithms this CRC calculator provides? https://crccalc.com
Anyway, here's greet.hex in full, i.e. the successfully transferred 104 bytes file (by the way, it's an 8080 hello world demo in Intel HEX
format):
I was hoping the log could be made to show actual serial port traffic.
Any chance you're free to post the first couple hundred bytes worth
of the te file?
Minicom runs sx -vv by default. I tried -vvvv but the only additional
info it logs is pretty much only the file size.
te.hex is the HEX version of the te text editor by Miguel López. Here's the beginning of the file:
I run the following command, where I added the Minicon configuration file with the Z80-MBC2 connection settings:
strace -s9999 -o /tmp/minicom.strace -eread,write,ioctl minicom z80mbc2
strace -s9999 -o /tmp/minicom.strace -eread,write,ioctl minicom
write(1, "\1\1\376:200100002A06002E00F9110002B7ED522B22910111774BED538F01B7ED52232293013024DA\n:200120000E09112B01CD0500C3000052756E74696D652045727\267", 132) = 132
read(0, 0x5bd9939fec60, 128) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
write(2, "Retry 0: ", 9) = 9
write(2, "Timeout on sector ACK", 21) = 21
write(2, "\n", 1) = 1
write(1, "\1\1\376:200100002A06002E00F9110002B7ED522B22910111774BED538F01B7ED52232293013024DA\n:200120000E09112B01CD0500C3000052756E74696D652045727\267", 132) = 132
read(0, 0x5bd9939fec60, 128) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
write(2, "Retry 0: ", 9) = 9
write(2, "Timeout on sector ACK", 21) = 21
write(2, "\n", 1) = 1
write(1, "\1\1\376:200100002A06002E00F9110002B7ED522B22910111774BED538F01B7ED52232293013024DA\n:200120000E09112B01CD0500C3000052756E74696D652045727\267", 132) = 132
read(0, 0x5bd9939fec60, 128) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
So it never actually gets _anything_ back from the serial port. Wonder
if we're chasing something about how the file units are getting mapped, rather than a transfer issue.
Does your Minicom setup for xmodem look like this (other than having
added the strace stuff to the command)?
C xmodem sx -vv Y U N Y N
I tried also turning on software flow control in Minicom and jumping to
a shell from Minicom to execute sx -a test.txt, but still no joy with
file transfers.
On CP/M 3.0 I'm using version 2.7 patched by J4F, the Z80-MBC2 developer:
What version of MFE's XMODEM are you using?
a:xmodem te.hex /r /z8
On CP/M 3.0 I'm using version 2.7 patched by J4F, the Z80-MBC2 developer:
1. Anything clueful in dmesg?
2. Have you tried running the MBC2 at 4 MHz? Maybe with /Z4?
3. Have you tried the /Q option to XMODEM?
4. Do you have a different usb serial device to try?
So a lower bit rate would be the first thing to try.
Looking at the link to the blog which talks about XMODEM support this
would seem to fit into that category of can't receive. It also mentions
that besides getting the new version of software you need to follow a special procedure to increase the receive buffer to 128 bytes.
So far I have no fix for the issue, but I've figured and tested an effective workaround: pasting a text file from Minicom to an ED session on CP/M, i.e. sending the contents of the file as if it would be typed in, then saving the file from ED. Thisrequires setting at least a 5 ms character transmit delay in Minicom's terminal settings (^A T F). It's slower than XMODEM, but still acceptable and sufficiently practical.
The workaround lets me send HEX files for transferring CP/M programs, uuencoded (or similar) files for other binary, non-excutable files.
Since you can successfully send a very short file with XMODEM but not a longer one makes me suspect an inability to keep up with incoming data.
So a lower bit rate would be the first thing to try.
> Since you can successfully send a very short file with XMODEM but not aNo. With the XMODEM protocol, the transmitter waits for an ACK/NACK
> longer one makes me suspect an inability to keep up with incoming data.
> So a lower bit rate would be the first thing to try.
Except that it seems not even the first packet gets through. If it was related to keeping up, it ought to move at least one packet before
timing out.
De
So a lower bit rate would be the first thing to try.
Except that it seems not even the first packet gets through. If it was related to keeping up, it ought to move at least one packet before
timing out.
No. With the XMODEM protocol, the transmitter waits for an ACK/NACK
after each packet. So any failure to keep up with incoming data will manifest itself within a packet.
Paolo has been able to move small files, and the board is known to
be able do large file transfers successfully. There's something else
going on here. Data-dependent weirdness? Something about Paolo's
USB serial dongle or Chromebook environment?
USB to serial adapters can be bought for just a few bucks from Amazon/ePay etc. Try a couple different adapters, I would also consider finding a different communication package that will work.
> > Except that it seems not even the first packet gets through. If it wasI looked at the source code for sz to find out that the default timeout
> > related to keeping up, it ought to move at least one packet before
> > timing out.
> No. With the XMODEM protocol, the transmitter waits for an ACK/NACK
> after each packet. So any failure to keep up with incoming data will
> manifest itself within a packet.
Paolo has been able to move small files, and the board is known to
be able do large file transfers successfully. There's something else
going on here. Data-dependent weirdness? Something about Paolo's
USB serial dongle or Chromebook environment?
De
USB to serial adapters can be bought for just a few bucks from Amazon/ePay etc. Try a couple different adapters, I would also consider finding a different communication package that will work.
Hopefully the channel is 8 bit clean or close enough to it. sz escapes
some characters including problematic things like XON and XOFF. Options
are provided to do more of course. "-e" escapes all control characters.
The command "sz -TT" is supposed to send all 256 8 bit codes as an aid
in figuring out which ones aren't making it through.
On Thursday, June 30, 2022 at 5:06:19 PM UTC+2, Randy McLaughlin wrote:It is unlikely to be the XMODEM implementation on the sending side. What
USB to serial adapters can be bought for just a few bucks from Amazon/ePay etc. Try a couple different adapters, I would also consider finding a different communication package that will work.
I tried another terminal emulator, Picocom, but sending files still times out. However, both Minicom and Picocom run the external sx program for file transfers, so I should get a different XMODEM implementation.
It is unlikely to be the XMODEM implementation on the sending side. What
have you done to check the receiver?
On CP/M I'm using version 2.7 of Martin Eberhard's XMODEM implementation patched[1] for the Z80-MBC2. I'll try the unpatched version 2.9, which also comes with a program for testing the serial link.
xmterm greet.hex /r
xmterm greet.hex /r
On Friday, July 1, 2022 at 9:06:16 AM UTC+2, Paolo Amoroso wrote:as:
On CP/M I'm using version 2.7 of Martin Eberhard's XMODEM implementation patched[1] for the Z80-MBC2. I'll try the unpatched version 2.9, which also comes with a program for testing the serial link.
I tried both programs and XMODEM timed out. The first time I run the serial link testing program XMTERM, some interesting log messages whizzed by but I was unable to capture them. Subsequent runs displayed less useful and partly garbled messages such
xmterm greet.hex /r
========================
XMTERM 1.1 By M.Eberhard
========================
/In 8080 codet^G6##w######rI
xmterm test.hex /x1 /e /r
xmodem test.hex /r
I run XMTERM with various options but didn't get much output, for example:
And you never will unless you use different serial ports for the console
and xmodem. The xmterm output is going back to sz. Which eats it looking
I see that there is an add on serial card which you probably need to
get. The alternative is to write a special purpose xmodem receive
I run XMTERM with various options but didn't get much output, for example:
On Saturday, July 2, 2022 at 5:26:33 PM UTC+2, David Schultz wrote:
And you never will unless you use different serial ports for the console
and xmodem. The xmterm output is going back to sz. Which eats it looking
Isn't the /X1 option I run XMTERM with supposed to take care of this?
I tried running sx with the options -e and -TT, still timeouts.
Hard to do xmodem file transfer at 115200 with 8MHz Z80 without hardware handshake. So do you have hardware handshake enabled?
Bill
Hard to do xmodem file transfer at 115200 with 8MHz Z80 without hardware handshake. So do you have hardware handshake enabled?
On Tuesday, September 6, 2022 at 2:25:14 AM UTC+2, Bill Shen wrote:control.
Hard to do xmodem file transfer at 115200 with 8MHz Z80 without hardware handshake. So do you have hardware handshake enabled?Enabling hardware handshake hangs the terminal session and software handshake changes nothing in XMODEM transfers. The Z80-MBC2 developer recommends no handshake because, as he notes, the board's Arduino-derived chipset doesn't support hardware flow
I'm having a similar problem on a different target. XModem/CRC works great from Windows using TeraTerm but fails immediately with sx on linux. An interesting thing that may point in the right direction is that at 9600bps, the transfer proceeds althoughvery slowly due to a retry between each packet (Retry 0: NAK on sector)...however the file does transfer. As you note, minicom and most other linux serial comms programs just call sx to do the transfer. Unfortunately, it looks like sx (lrzsz) is broken
Unfortunately, it
looks like sx (lrzsz) is broken for xmodem and has been for a very
long time. Oddly there doesn't seem to be a replacement...it might
be worth writing one.
As you note, minicom and most other linux serial comms programs just call sx to do the transfer.
Unfortunately, it looks like sx (lrzsz) is broken for xmodem and has been for a very long time.
Oddly there doesn't seem to be a replacement...it might be worth writing one.
I'm having a similar problem on a different target. XModem/CRC works great from Windows using TeraTerm but fails immediately with sx on linux. An interesting thing that may point in the right direction is that at 9600bps, the transfer proceedsalthough very slowly due to a retry between each packet (Retry 0: NAK on sector)
On 1/13/23 11:03 PM, David Albert wrote:although very slowly due to a retry between each packet (Retry 0: NAK on sector)
I'm having a similar problem on a different target. XModem/CRC works great from Windows using TeraTerm but fails immediately with sx on linux. An interesting thing that may point in the right direction is that at 9600bps, the transfer proceeds
Reading that old lrzsz code is frustrating. I hate it when code isDavid
poorly commented. Or almost not at all.
The XMODEM protocol mostly resides in the function wcputsec(). (Why that name?) Dead simple and nothing that can go wrong. It sends data and
waits for an ACK.
But it was written when serial ports were serial ports. So makes some assumptions. One of which is that the target is not echoing what it receives. If a special character (ACK, NAK, CAN, etc.) appears in the
data, it will upset things. This is where TeraTerm could differ. But
given all the buffering that goes on (kernel, USB to serial, etc.) I can think of no easy way to compensate for a target that echoes everything
it receives.
A CP/M target can be a problem if the data passes through the BDOS
console I/O routines.
The precise reason why the target sent a NAK would be helpful. Timeout?
bad checksum/CRC?
--
http://davesrocketworks.com
David Schultz
On Sunday, 15 January 2023 at 15:39:33 UTC, David Schultz wrote:although very slowly due to a retry between each packet (Retry 0: NAK on sector)
On 1/13/23 11:03 PM, David Albert wrote:
I'm having a similar problem on a different target. XModem/CRC works great from Windows using TeraTerm but fails immediately with sx on linux. An interesting thing that may point in the right direction is that at 9600bps, the transfer proceeds
DavidReading that old lrzsz code is frustrating. I hate it when code is
poorly commented. Or almost not at all.
The XMODEM protocol mostly resides in the function wcputsec(). (Why that name?) Dead simple and nothing that can go wrong. It sends data and
waits for an ACK.
But it was written when serial ports were serial ports. So makes some assumptions. One of which is that the target is not echoing what it receives. If a special character (ACK, NAK, CAN, etc.) appears in the data, it will upset things. This is where TeraTerm could differ. But
given all the buffering that goes on (kernel, USB to serial, etc.) I can think of no easy way to compensate for a target that echoes everything
it receives.
A CP/M target can be a problem if the data passes through the BDOS
console I/O routines.
The precise reason why the target sent a NAK would be helpful. Timeout? bad checksum/CRC?David
--
http://davesrocketworks.com
David Schultz
Have you tried the python implementation of XMODEM rather than lrzsz? https://pypi.org/project/xmodem/ has links to the documentation and download files.
Mark Ogden
David
Have you tried the python implementation of XMODEM rather than lrzsz? https://pypi.org/project/xmodem/ has links to the documentation and download files.
Mark Ogden
On 1/17/23 5:44 AM, Mark Ogden wrote:
DavidActually, I haven't used XMODEM in a very long time.
Have you tried the python implementation of XMODEM rather than lrzsz? https://pypi.org/project/xmodem/ has links to the documentation and download files.
Mark Ogden
I got to looking and I do see a problem with its use with minicom.
The way XMODEM worked is that you dialed into a BBS or some such, told
it to send you a file, and then started your XMODEM receive program.
That sent a NAK to tell the sender it was ready.
Using it with minicom to send a file to a SBC is a problem. You tell
minicom to start XMODEM, then it tells you to give the command to start receiving. Except you can't since XMODEM is now using that serial link.
So you have to start the XMODEM receive program before telling minicom
to start sending. This is a problem. (Of course with a short hardwired connection like this, XMODEM isn't needed at all.)
The receive program sends a NAK to tell the sending program it is ready.
But since lrzsz hasn't started yet, nothing is listening. After a
timeout the receive program sends another NAK.
So when sz starts, more than one NAK can be buffered up waiting for it.
It consumes the first and sends the first packet. It then looks for an
ACK but finds one of those leftover NAKs.
I think that you could make lsz a little more tolerant of this. When it
reads data it uses a read() call and buffers extra characters. The code includes a function to purge that buffer but it is never called. Adding
a call to readline_purge() at an appropriate point (after getting that initial NAK would be good) would dump that extra data.
Calling it just before starting to send each packet might be excessive.
But there shouldn't be anything to purge.
--
http://davesrocketworks.com
David Schultz
It isn't a bug so much as it is using the tool in a way it wasn't
designed for. You are supposed to start the receiver after the sender is running.
I used minicom/lrzsz a lot with the z80pack machines. The virtual SIO's won't overrun like a real one
and buffers all and everything, but I have not seen this problem.
Um... lrz.c line 762 and 645... should not be a problem. Call is to purgeline()
which first does readline_purge() and then actually purges... via ioctl() or lseek()
so, I think, good to go. Never been a problem for me, anyway -- I do not think there is
bug in THOSE particular hills.
Forgot, if you start the receiver from the terminal you will see the NAK the receiver sends,
so this one is eaten up by the terminal.
It isn't a bug so much as it is using the tool in a way it wasn't
designed for. You are supposed to start the receiver after the sender is running.
I stopped having an of these problems when Kermit showed up. :-)
Had some time to try this stuff again, on CP/M I'm using Martin Eberhardt's xmodem.
You really have to start transceiver first with minicom/lrzsz, if you first start xmodem on
the CP/M side the transfer will not start and times out after a while.
If you have to send a file from Minicom to CP/M, how do you start the transceiver first with Minicom/lrzsz?
You use the auxiliary serial for the transfer and the console port for the terminal.
You can't if you try to use one serial port for both.
Had some time to try this stuff again, on CP/M I'm using Martin Eberhardt's xmodem.Udo
You really have to start transceiver first with minicom/lrzsz, if you first start xmodem on
the CP/M side the transfer will not start and times out after a while.
On Wednesday, January 18, 2023 at 7:48:23 AM UTC-5, Udo Munk wrote:As to terminals... I use XTERM -- sending hex FF is the same a sending a space! Is this true of VT52 and VT100?
Had some time to try this stuff again, on CP/M I'm using Martin Eberhardt's xmodem.Udo
You really have to start transceiver first with minicom/lrzsz, if you first start xmodem on
the CP/M side the transfer will not start and times out after a while.
I use (in general) PCPUT and PCGET with lrzsz (with picocom, not minicom, but it shouldn't
really matter). When I get cycles, I'll try XMODEM. Now, with that, its receive first, then sx,
and send first, then rx. On the rx I may get one or two NAKs, then everything settles.
This also works with the Settings xmodem send/receive in the Altair-Duino configuration
(which runs native on the Due).
Note that a related problem is capturing paper tape punches! I set picocom to capture
(using log option), then, just before punching the tape from the Altair-Duino, I do 'cp /dev/null log'
to clear the log, punch, then 'cp log capture' -- I may then edit the "paper tape" with ghex.
This is all because picoterm does NOT send a CR or something on file capture begin
(nor does minicom)!
PS. I use picocom because it attempts no "terminal emulation". Except a single trigger
character.
I could use my la36 terminal emulator to solve this...that is a bit overkill... but that
also supports ASR mode (^Q/^A ^R/^T) per Teletype ASR-33.
The other day I updated fimware in my G90 radio. This of course has only one serial port and is not operated from a terminal. The serial port is used for CAT control and xmodem firmware updates. For this I need to bring the radio into update mode,connect to the serial with some terminal program and answer the usual question, do you really want that etc. Then xmodem receive kicks in, I see the NAK in the terminal. Then I go into the menu, send file, xmodem, filename and the transfer immediatly
Must have to do something with the xmodem implementation on the CP/M side, try some other program maybe.Udo
The other day I updated fimware in my G90 radio.
The other day I updated fimware in my G90 radio.You're a ham, Udo?
De
> The other day I updated fimware in my G90 radio.
You're a ham, Udo?
I suspect many of the people who still share an interest in ancient
computers and OSes are hams.
bill
KB3YV (ex N2APY, ex DA1WO)
Bill Gunshannon <bill.gunshannon@gmail.com> writes:
And some us got our interest in computers as a follow on from our interest
I suspect many of the people who still share an interest in ancient
computers and OSes are hams.
bill
KB3YV (ex N2APY, ex DA1WO)
in electronics generally which originally came from our interest in radio.
Hi! If the problem still exists. I wrote special version of XModem
software for PC (both for Linux and Windows, might be compiled via
Lazarus 3.0) than impements an adjustable delay after each byte, sent
to remote CP/M computer. It lets CP/M with fast UART chip like
work ok. The repo is here: https://github.com/ivang78/xmodem .
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 489 |
Nodes: | 16 (2 / 14) |
Uptime: | 14:38:27 |
Calls: | 9,665 |
Files: | 13,712 |
Messages: | 6,167,664 |