SHARP:USB-cable HW-handshake

Talk in english

Modérateur : Politburo

Fonctionne à 75 bauds
Fonctionne à 75 bauds
Messages : 34
Inscription : 06 mai 2015 12:06

SHARP:USB-cable HW-handshake

Message par spellbound » 09 oct. 2017 23:40

This post is about how to obtain a reliable, full speed connection between a SHARP pocket computer that is equipped with an RS-232 interface and a PC/MAC. It's about utilizing bidirectional (RTS/CTS) hardware handshake so you do not need the XON/XOFF-protocol, line-delays or lowering baud-rates at all.

SHARP pockets to which this applies are (at least):
  • PC-1600
  • PC-E500 series
  • PC-13xx series
  • PC-1450 / 1475
  • PC-E220
  • PC-G8xx series
  • ...
or in general every SHARP pocket with a 15pin or 11pin RS-232 interface.

There are already many solutions out there but none with a true one-fits-all approach.
Furthermore the wirings I've seen for the E500 and 1350|60 all require the activation of the XON/XOFF-protocol for LOADing.
Especially fixed wirings/cables that offer bidirectional hardware handshake for the PC-1600 in principle cannot do the same for the E500 or 13xx series and vice versa, because there are subtile but relevant differences.

In fact, I found that there are three different types of built-in RS-232 interfaces in the family of SHARP pockets:
  • PC-1600
  • 15pin Standard
  • 11pin Standard
Lets start with the USB-side of an adaptor/cable, which can be the same for all three types:
I recommend an FTDI USB-adaptor/cable with the FT232R-chip, 5V, open ended.

Setup FTDI
Download the tool FT_PROG from the website of the manufacturer:
With this tool you must logically invert the signals RXD, TXD, RTS and CTS of the FTDI-chip, because the FTDI-chip exposes UART-TTL signal levels, but the RS-232 interface of the SHARP pockets operates on inverted UART-logic. This is a one-off process and the settings are persisted within the integrated EEPROM of the FTDI-chip.

So you now have a cable that exposes the following signals with inverted UART logic, 5V HIGH:

Now lets care about the specifcs of the three interface types mentioned above and appropriate wirings and settings for bidirectional hardware handshake.

PC-1600 Interface
The port pinout of that machine is as follows:

As you can see, the TXD and RTS outputs of the PC-1600 are -8.5V LOW and +5.6V HIGH.
The PC-1600 is the only SHARP-pocket, that provides true RS-232 signal levels,
which is the reason for the CE-1601L - CE-1605L beeing just cables and not level shifters like the CE-130T - CE-133T and others.
But the FTDI-chip seems to have internal clipping of negative voltages, so we can use a straight forward null-modem wiring, DTR/DSR/CD can be ignored.
There are some FTDI-remakes out there, that seem to require additional resistors (10-100 kOhm) in series for the outgoing signals of the PC-1600, which are RTS and TXD. The original FTDI-USB cable does not require those resistors, depicted in red (replace them by a direct wiring in the following diagram).
Within the rest of this article I'm ignoring the additional resistors for those FTDI-remakes.

Setup PC-1600:

Code : Tout sélectionner

SETCOM "COM1:",9600,8,N,1,N,N
The SNDSTAT, RCVSTAT and OUTSTAT statements are mandatory! - they activate the RTS/CTS hardware handshake for both directions.

Setup Terminal Program (CoolTerm, hterm, ...)
  • baud = 9600
  • data bits = 8
  • parity = none
  • stop bits = 1
  • XON/XOFF = off
  • RTS/CTS (RS/CS) = on
  • line delay = off
  • character delay = off
  • RTS (initial) output (button/toggle) = ON/HIGH (deactivate to pause transmission from the pocket)
Thats it for the PC-1600 :-)

Unfortunately this wiring does NOT provide bidirectional hardware-handshake for the 15pin SHARP standard interface!

15pin Standard Interface
SHARP pockets with this type of interface are the following:
PC-E500 series, PC-1350, PC-1360, PC-1475 and all others with 15pin RS-232 interface except the PC-1600.
There are two relevant differences between the 15pin PC-1600 interface and the 15pin standard interface
  • Voltage levels are 0V LOW and 5V HIGH
  • The meaning and behavior of the RTS signal
In the mid to late 1980's there was a transition in the industry regarding the interpretation of the RTS signal of the RS-232 standard towards the new RTR meaning (which was not RS-232 standard conformant).

The original, historical meaning was: RTS = "Request To Send", i.e. the computer wants to send data out and requests permission form the connected device to do so via RTS. The device then answers by CTS. The problem is, that this protocol is asymmetrical (RTS and CTS are not independent) and the computer has no means to signal the connected device to pause a data transmition going from the device to the computer, in case the latter is busy.
This soon became a big problem in computer-to-computer communication. What was/is really needed is this: By RTS the computer allows the connected device to send data to the computer. In other words this new interpretation has the meaning of "Ready To Receive" (RTR). RTR and CTS have a symmetrical meaning (i.e. supporting both directions) and are independent from each other. In fact today the meaning of RTS has "quietly" been shifted to RTR, although the label RTS has been kept.
This is also true for the RTS-signal of the PC-1600!

From the pinout below we can read that in the mid 80ies SHARP decided to deal with this problem by providing the original standard conformant RTS(RS) signal as well as an additional RTR(RR) signal for it's standard 15pin interface:

So for a wiring that supports bidirectional hardware handshake, we need the RTR(RR) signal and NOT the RTS(RS) signal from this type of interface!

Additionally at least the PC-E500 series requires a DTR/DSR/CD handshake in order to activate the interface.
So we need a respective loopback for that. That means for the SHARP 15pin standard interface we basically have this wiring:

Setup PC-1350/60 for bidirectional hardware handshake:

Code : Tout sélectionner

OPEN "1200,N,8,1,A,C,&1A"
Setup PC-E500(S) for bidirectional hardware handshake:

Code : Tout sélectionner

OPEN "9600,N,8,1,A,C,&H1A,N,N"
These settings are persistent (i.e. stored until explicitly changed or the next hard reset is performed).
If you OPEN the port without any parameter string, the stored settings will be used:

Code : Tout sélectionner

The terminal program config is as above (except the max baud rate of 1200 for e.g the 13xx)

11pin Standard Interface
This type of RS-232 interface is the latest in the line of SHARP pocket computers, so it is not astounding that its RTS-signal already has RTR semantics.
Pockets with this type of interface are: PC-E220, PC-G850V(S) and all other with an 11pin RS-232 interface.
Typically the 11pin interface supports different operational modes - here is the pinout for RS-232 mode:

The PC-G850V(S) sets DTR to HIGH when the interface is activated, but does not care about DSR and CD. On the other hand, a DTR/DSR/CD loopback is not harmful, so lets include it in the wiring, just to be safe.
Additionally, for the PC-G850V I found it necessary to incorporate a 10KOhm pulldown resistor to the RTS signal. Without that, the host computer has no defined LOW level and does not pause data transmission, when the G850V requests it - leading to I/O errors.

PC-E220 and PC-G850 setup:
Menu TEXT->Sio->Format
baud rate = 9600
data bit = 8
stop bit = 1
flow = RS/CS

One-Fits-All 15pin
If you want to build an adapter/cable that supports the PC-1600 hardware handshake as well as the 15pin standard, you obviously have to merge the two wirings from above. And that leads to the necessity of a toggle switch (or similar):

11pin to 15pin Adaptor
If you want a solution that supports all three types of interfaces, you could build a modular adaptor with a removable 11pin-to-15pin adapter part that has a 1:1 signal mapping and incorporates the toggle switch. The DTR/DSR/CD loopback and the RTS-pulldown resistor then remains on the part that is attached to the cable.

Here is a picture of how this could look like:

I hope this was inspiring and informative.
Dernière édition par spellbound le 20 févr. 2019 23:35, édité 7 fois.

Avatar de l’utilisateur
Fonctionne à 9600 bauds
Fonctionne à 9600 bauds
Messages : 4476
Inscription : 31 oct. 2006 16:08
Localisation : 67310 Westhoffen
Contact :

Re: SHARP:USB-cable HW-handshake

Message par pir2 » 15 oct. 2017 10:12

THanks for this detailled explanation, i will see if this is applicable to the 2 USB-cables i've bought some years ago .... and never really tested :oops:

Fonctionne à 75 bauds
Fonctionne à 75 bauds
Messages : 34
Inscription : 06 mai 2015 12:06

Re: SHARP:USB-cable HW-handshake

Message par spellbound » 15 oct. 2017 13:58

Hopefully yes - good luck :)
Dernière édition par spellbound le 31 déc. 2018 20:45, édité 1 fois.

Fonctionne à 75 bauds
Fonctionne à 75 bauds
Messages : 12
Inscription : 11 mars 2018 22:32

Re: SHARP:USB-cable HW-handshake

Message par philoupat » 30 sept. 2018 20:58

j'ai realisé une connection usb avec mon pc1350
j utilise le programme suivant
5 "A"
10 OPEN "1200,N,8,1,A,C,&1A"
j utilise Hterm
La commande Run fonctionne bien
Les commandes OPEN et LLIST fonctionnent bien(voir ci dessus)
ma question est la suivante comment envoyer un fichier programme dans la machine
la commande LOAD BRK ne donne rien
La commande SAVE BRK ne donne rien
merci pour votre reponse
usb ftdi
usb.jpg (33.76 Kio) Consulté 10453 fois
La pièce jointe Capture.PNG n’est plus disponible

Fonctionne à 75 bauds
Fonctionne à 75 bauds
Messages : 12
Inscription : 11 mars 2018 22:32

Re: SHARP:USB-cable HW-handshake

Message par philoupat » 30 sept. 2018 20:59

capture de hterm
Capture.PNG (87.9 Kio) Consulté 10452 fois

Fonctionne à 75 bauds
Fonctionne à 75 bauds
Messages : 34
Inscription : 06 mai 2015 12:06

Re: SHARP:USB-cable HW-handshake

Message par spellbound » 25 oct. 2018 22:22

Upload a file from PC:

In hterm:
1. press the „Connect“ button
2. press the „Send file“ button (located at the Input Control section)
3. in the dialog select the file you want to upload from your hard disk (do not press „Send“ by now)

At the 1350:
5. LOAD (this command will block, do not press BRK - it waits for the file to be send)

In hterm again:
6. press „Send“ in the file dialog and wait until the transmission has completed
Dernière édition par spellbound le 27 oct. 2018 18:26, édité 1 fois.

Fonctionne à 75 bauds
Fonctionne à 75 bauds
Messages : 34
Inscription : 06 mai 2015 12:06

Re: SHARP:USB-cable HW-handshake

Message par spellbound » 27 oct. 2018 15:21

A rather tricky part when performing file uploads of programs found in the internet, is the correct EOL (End Of Line) and EOF (End Of File) handling.
Since many people struggle at this point and asked for help, I give some general advice here.
The essence is that the EOL and EOF setting of your (SHARP pocket) computer must match the actual format of the file to upload.
If the EOL format does not match you will get a transmission error.
If the EOF token does not match or does not exist at the end of your file, the transmission will not terminate (at least when using full hardware handshake, like suggested in this thread).
Note that this compatibility issue does not arise, if you just LOAD a program that you have previously SAVEd with the same settings.
It may arise, when you try to transfer program source-code that has been SAVED with a different computer or has been downloaded from the internet.
It will arise, when you try to transfer program source-code that has been SAVED with different EOL/EOF-settings.

To check or modify the actual file format, I recommend downloading the free source-code editor Notepad++.
The following diagram summarizes all necessary steps:

As you can see, with a PC-1350 for example, you can adjust the settings at your pocket, to match the adctual file format. With a PC-1600 you can't, which means you have to convert the file format, if it does not match (check and change respectively with Notepad++).


Revenir vers « Silicium in english »