Welcome, Guest. Please login or register.


Author Topic: USB to Enterprise serial (Read 13673 times)

Offline dangerman

  • EP fan
  • *
  • Posts: 100
USB to Enterprise serial
« on: 2018.December.06. 17:58:53 »
Hello. I'm thinking about connecting my Enterprise to a Linux PC to transfer files and other stuff across - only at 9600 baud!

But sadly modern PCs don't have the old serial ports any more - they just have USB. There are plenty of USB-serial adapters on the internet but most of them (certainly the cheap ones) seem to work with 5V logic (or even 3.3V). The Enterprise serial port is 12V of course... or -5V to +7V if you use the reference ground :|  

Has anyone successfully connected the Enterprise to a PC USB port?
« Last Edit: 2018.December.06. 18:41:59 by dangerman »

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: USB to Enterprise serial
« Reply #1 on: 2018.December.06. 23:29:38 »
One friend of mine has such circuit. It needs some minor fixings on the 3,3v conversion, but he has little time now as he is teacher on the University.

On the tests we made it worked perfectly on input or output access on Basic programs, but not on half-duplex due to an error on Basic.

I can't say you a date of release, but probably before next Summer....

Offline dangerman

  • EP fan
  • *
  • Posts: 100
Re: USB to Enterprise serial
« Reply #2 on: 2018.December.07. 00:19:54 »
Oh dear - so it needs a special circuit. It can't be done with a standard USB-to-serial adapter?? :(

It appears it was possible to connect an Enterprise to an old PC serial port with just a couple of resistors - Application Note 29 - but I presume this wouldn't work for a USB-serial adapter...

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: USB to Enterprise serial
« Reply #3 on: 2018.December.07. 11:13:31 »
This is the first prototype.

[ Guests cannot view attachments ]

[ Guests cannot view attachments ]

But it has a number of errors:

-The EDGE connector is mirrored. A cable was used instead.
-The footprint for the CH340G has to be narrower, it hardly coincides with the chip's legs.
-The CH340G should be feed with +3,3v and the levels of RX and CTS be with pull-up to +3,3v instead of +5v.

What the circuit does is to standardise the Enterprise serial signals to TTL compatible or to USB serial.

The CH340G chip is used on some USB serial adapters, and fits the Enterprise because it manages the two data signals and also the two handshake signals.

The 74LS06 and some diodes and resistors are used to invert and adapt the Enterprise levels.

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: USB to Enterprise serial
« Reply #4 on: 2018.December.07. 11:37:04 »
Ah, now I remember, the circuit also allows the direct connexion of an ESP8266 ESP-12F, that also has a handshake serial mode.


Offline dangerman

  • EP fan
  • *
  • Posts: 100
Re: USB to Enterprise serial
« Reply #5 on: 2018.December.09. 14:16:20 »
Good stuff. Wifi on the Enterprise? That would be cool!! I see that the 74LS06 is used inside the Enterprise to drive the serial line, so seems like a good choice.


I haven't yet done anything about investigating USB, but I have managed to hook up the Enterprise serial port to an Amiga, which has a good old RS232 port. Data transfer works but I can't seem to get handshaking working (maybe because I'm not using the offset ground?)

If I enable handshaking on the Amiga, then it doesn't send anything to the EP.
If I disable handshaking, I can send up to 24 bytes at a time to the EP but then have to wait (that's the limit of EP buffering).

Writing data from EP to Amiga seems to work though.

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: USB to Enterprise serial
« Reply #6 on: 2018.December.09. 15:47:34 »
The handshaking doesn't work  properly on Basic, but it can work on machine code. Yes, we have used the 74LS06 due to being used inside the Enterprise.

The Wifi chip doesn't need handshaking, only when the user sends Enter the chip returns his text. The Enterprise buffer is  not big, but I don't remember only 24 bytes. To avoid the end of buffer better read immediately from the channel every incomming character.

We have opted to not use the offset, due to the isolation needed,. For a real Serial port you also don't need to use it, as the levels are 0 and +12v.

Offline dangerman

  • EP fan
  • *
  • Posts: 100
Re: USB to Enterprise serial
« Reply #7 on: 2018.December.09. 21:25:05 »
When you say machine code - do you mean writing directly to the port 0B7h?

I'm using the standard EXOS SERIAL: device, which I think works the same whether used from BASIC or machine code.

As far as I can tell, the STATUS OUT line is +12v when the Enterprise is ready to read data, but for some reason nothing gets sent (or at least nothing gets received!). Sadly I can't really see what's going on because I only have a voltmeter, not an oscilloscope.

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: USB to Enterprise serial
« Reply #8 on: 2018.December.09. 23:42:45 »
No, I mean using the serial device on machine code, avoiding Basic. I don't know why but think it interferes with the reading of the serial bits 4 and 5 on port B6.

In Basic, Zozo advised me to use READ £X + an error handler, instead of GET £X, but I haven't been able to make it work.


Offline dangerman

  • EP fan
  • *
  • Posts: 100
Re: USB to Enterprise serial
« Reply #9 on: 2018.December.10. 18:03:44 »
I was using this...
Code: [Select]
OPEN £1:"SERIAL:"
COPY FROM £1 TO £0

That seemed to work ok, but because there was no handshaking I could only transfer 24 bytes at a time.

Maybe I'll give it a go from machine code.

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: USB to Enterprise serial
« Reply #10 on: 2018.December.10. 18:30:50 »
Actually you copy the data to the Editor: channel directly. Better use an intermediate variable in a loop, for example:

GET £1:a$

This will take only a character every time. Then you can add the character in a$ to other variable, for example b$, and print the sentence to the default channel £0 if you find a ^M, Enter, chr$(13) or other convenient character.

You can also use READ instead of GET, but you will need an error handler routine. You can read examples on the Basic manual.

To add variable strings you must use b$=b$&a$, & instead of +,  used to add numbers.

Offline dangerman

  • EP fan
  • *
  • Posts: 100
Re: USB to Enterprise serial
« Reply #11 on: 2018.December.10. 23:21:48 »
Unfortunately my problem is not the Enterprise reading, but it's the other computer sending.

Without handshaking, the other computer can only send 24 bytes at a time - otherwise the Enterprise's buffer will become full and bytes will be lost - whether I'm using BASIC or machine code.

So I either insert a delay after sending every few bytes (at the Amiga/PC end) to give the EP enough time to process it's buffer; or else I really need to find out how to get handshaking working.

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: USB to Enterprise serial
« Reply #12 on: 2018.December.11. 09:06:33 »
Can you put here an example of the routine?

Offline tofro

  • Beginner
  • *
  • Posts: 31
  • Country: de
Re: USB to Enterprise serial
« Reply #13 on: 2018.December.11. 12:08:00 »
Some USB/Serial dongles don't support hardware handshake lines at all, some do RTS/CTS, some very sophisticated ones even support DSR/DTR. For those that support the hardware lines, you need to have a proper driver that supports hardware handshake as well (The USB stick needs to convert the pin change to a USB handshake packet and send that to the host and vice versa)

So, the first questions is: Does the chipset on the dongle support hardware handshake? The most common chips known to do that are FTDI USB/Serial chips. In case your dongle has one (and not a cheap Chinese rip-off), chances are high it works.

Another common chip range is the Prolific 2303 - Of these, only the SA, HXD and RA variant seems to support hardware handshake. The others don't (Those are mostly intended for printer interfaces only).

That is the first step to success - The next one is if the Dongle maker managed to expose the hardware handshake lines from the chip - Some do, some don't.

And the next step is whether you got a proper USB driver on the host computer that supports Hardware Handshake. Again, some do, some don't.

Best check very carefully the above points in the product description before you buy such a dongle to get HWHS to work

Tobias
« Last Edit: 2018.December.11. 13:55:04 by tofro »

Offline dangerman

  • EP fan
  • *
  • Posts: 100
Re: USB to Enterprise serial
« Reply #14 on: 2018.December.11. 19:12:49 »
@Tobias - Thanks for the tips. I already have an FTDI based interface on order so we'll see if that works.

And thanks for the tips about the driver - I wonder if my Amiga serial port needs DSR/DTR instead of (or as well as) RTS/CTS handshaking. I'll look into that.