Skip to content

Xmodem Xcitement – Bad Bad Teraterm

November 14, 2015

I would like to use xmodem for the olduino/z’s bootloading. It’s simple, fast, receiver driven, and has error checking.

Sadly, I spent the day horsing around trying to get a reliable transfer. I’ve been using teraterm because it supports xmodem but there seems to be a critical flaw.

When you start the xmodem on the ZMC it sends ‘C’ to the host and the host is supposed to send a packet. If a packet isn’t received in 3 seconds, xmodem waits for 2 seconds of quiet on the line before trying again. It seems like teraterm was not looking for the ‘C’ but just throwing the first packet out and if it was not in the 3 second window, tough! It then ignored further C’s because hey, it wanted an ACK.

So I was seeing the C’s, the data from the PC, and more C’s. I finally twigged after looking at the code hard and noticing that the stall happened when the data was sent 5 seconds after the ‘C’ was received. Putty/extraputty clearly waits for the prompt because it sends the packet 10-15ms after receiving the ‘C’.

A waste of time but i understand the protocol better and i know that teraterm is not my friend! Trace summaries below for my future reference. The image is a logic analyzer capture of a failure.

Time [s]	Value	
1.68661725	x (0x78)	PC sends xu8000, ZMC echoes with spaces
7.710582875	\r (0x0D)	PC sends cr
9.97178775	C (0x43)	after 2.2 seconds ZMC sends 'C'
15.62481625	C (0x43)	6 seconds later, another 'C'
17.2634465	'1' (0x01)	1.6 seconds later PC sends 01 01 FE  * 0d 0a  1A 1A…1A(125 of them) BB 01
17.41601138	'6' (0x06)	ZMC sends 06(ACK)
17.42551613	'4' (0x04)	PC sends 04(EOT)
17.4267625	'6' (0x06)	ZMC sends 06(ACK)
19.68805525	\r (0x0D)	2 sec later ZMC sends cr,lf,TRANSFER COMPLETE cr,lf
21.97671625	\r (0x0D)	2 sec later ZMC sends cr,lf,Main Menu >
22.86857075	x (0x78)	xu8000
25.96461338	\r (0x0D)	cr
28.22729275	C (0x43)	2+ sec later ZMC sends C
33.54433363	'1' (0x01)	5 seconds later PC sends 01 01 FE *crlf 1A…1A BB 01 (same as successful transmission)
35.94446825	C (0x43)	2+ sec later ZMC sends C
41.60137525	C (0x43)	6 sec C
47.25792488	C (0x43)	6 sec C
52.9147335	C (0x43)	6 sec C
58.57160238	C (0x43)	7 sec C
64.228639	C (0x43)	8 sec C
69.8852695	'21' (0x15)	ZMC finally sends NAK
69.88935625	'1' (0x01)	right away PC sends same string
77.32083913	'1' (0x01)	
79.60126375	'21' (0x15)	2 sec later ZMC sends NAK
79.61537625	'1' (0x01)	PC tries again
79.75286725	'1' (0x01)	
82.03323338	'21' (0x15)	ZMC NAK's
82.04740225	'1' (0x01)	PC tries again

15-11-15 xmodem

Advertisements

From → Olduino/Z

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: