• Please review our updated Terms and Rules here

Modern update of the CE-158 for the TRS-80 PC-2

taylorjpt

Experienced Member
Joined
Oct 26, 2023
Messages
75
I Found what I hope is a source for a CE-158 serial interface so that I can get one to wring out the operational details in person. Been looking for one on Ebay etc but they are very rare, however a company in Germany has new ones available; at least it appears that they do since they let me order and pay ($500) for one!

My target BOM is still $10 with a minimum amount of coding (I don't need to know what's in the original ROM, I just need to provide it for the PC2). To get the cost down I'm using an SRAM in place of the ROM that the PC2 draws upon to run the serial interface. The SRAM will get loaded from my controller flash and then have the WE# locked high and the data/address bus floated. I'll only have to do this once so long as the battery stays up.

Won't be limited to 2400 baud as that is a HW limit of the original device. I can run at the PC2 demanded rate or manually select anything up to 1MBaud which is the limit of the RS232 driver chips, i.e. PC2 says 2400 but I feel like 115,200. The controller and SRAM will be the same as my RAM expanders and cassette emulator, even pulled in the cassette LIPO charger that has been working great. The PC2 does not do any of the actual SERDES so it does not have to know the bits are coming it at a million per second... the interrupt handshaking will abstract that all away.

For even more fun, I can pull in the flash file system from the cassette emulator to store programs on the serial interface... no need to decide now as I can just DNI the 16MB worth of flash to begin with.

1. True RS232 interface using Max232 for the +/-7V
2. Logic level UART interface
3. USB serial interface
4. Hardware flow control with bidirectional data buffering in the controller, 1kB each way
5. 32K SRAM ROM emulator
6. 16MB of on board flash
7. Centronics port (Because why not?!)
8. LiPo battery for stand alone operation
9. In sleep my controller operates at the raw LIPO voltage at about 50uA but then boosts it up to 5V to talk to the PC2.

Should be able to spin the PWB within 2 days of getting my CE-158. There is a crisp CE-158 schematic in the ether that cleared up a lot of questions

Schematic is done, just waiting for confirmation of the plan after my original unit comes in and I hook up my logic analyzer.
 
Wow! OK, this is awesome. So, wait. Was the Sharp ASIC on that CE-158 schematic doing anything useful? I couldn't make sense of it; it seemed like the service doc went over everything *but* that chip, left it as a black box.

The ROM contains the routines for the additional BASIC commands, I imagine?
 
The LH5811 is just an I/O expander for the PC2 processor that handles the Centronics port, RS232 flow control and RS232 baud rate generation. The CDP1854 SERDES operates directly off the data bus so it talks directly to the PC2 processor as well. The MC14569 is just a programmable counter that divides down the 153.6kHz oscillator into the commanded baud clock for the CDP1854. You'll notice that 153600 divided by 2400 baud is a nice even 64... not a coincidence.

The controller that I'm using does all of these functions internally and looks like three separate memory mapped peripherals to the PC2. The SRAM, which is programmed at boot and then released to the PC2 looks like the ROM that has the serial controller code that the PC2 executes. When connected, the "ROM" maps into the PC2 memory space and, like the printer interface, contains all the new basic commands and functionality; this is why typing "Cload" to into a stand alone PC2 means nothing to it.

Since my controller generates its own SERDES clock from a 64MHz internal oscillator, I am not limited to the original baud rate and the PC2 really won't know if I transmit and receive at a frequency it did not specify.

Let me know if that did not cover what you are calling the "ASIC".
 

Attachments

  • Sharp-CE-158-Schematic.pdf
    2.7 MB · Views: 2
  • LH5811.pdf
    1.8 MB · Views: 1
  • MC14569B.PDF
    222.7 KB · Views: 0
The centronics port is just an 8 bit data latch out of the LH5811 with the strobe signal bit-banged by the PC2. Not very fancy especially since I seem to remember that the port had the ability to read data as well, but maybe that was just a tricky use of the status bits as a work around.
 
I thought one piece of this was going to be particularly difficult; the 60 pin connector that plugs into the PC2. Turns out it was super easy. Even though the original mating connector has been out of production for possibly decades, Hirose still makes a direct replacement that can be putchased from Digikey or Mouser.
 
Got my CE-158 today, serial number 51005043. I was almost expecting a freshly minted device because of the ability to actually get one but it was actually an original Sharp device built in 1984 and came complete with a dead NiCd battery pack and a 240V AC adapter. Stripped off all of the hardware and the ribbon cables to make a stable platform for me to reverse engineer the device without the fear of breaking this wire or that as I handle it.

Sooooo much hardware to do what is today such a trivial thing... I'm going to enjoy spinning this project up!

Plugged it into one of my PC-2s and it works perfectly so now I have a working baseline to hook up to my logic analyzer and scope. I had to make a 25 to 9 adapter because it's been at least a decade since I looked at the box of PC cable adapters and I have no idea where I put them.

My new 60 pin connectors from Hirose mostly fit but could use a little modding to get them the rest of the way there: The pin pitch and shape is an exact match but the shroud is wider than the JAE so it sits about 75 thou out from being fully seated. A couple of passes on the mill will fixe them right up!
 

Attachments

  • CE-158 platform.jpg
    CE-158 platform.jpg
    314.1 KB · Views: 18
  • CE-158 First light.jpg
    CE-158 First light.jpg
    33.3 KB · Views: 18
What is the deal with the PC2 adding a 2 second delay after each line during CSAVEa?

Is there a way to turn that off?
 
Doesn't the PC2 do the same process as all the other cassette formats of writing out an entire block at once? Thus, the two seconds would be the duration of the block and the next CSAVE won't start until after the current CSAVE finishes. The PC-2 cassette only takes data at 300 bps so 2 seconds permits a mere 60 characters to be transmitted. Yes, this is slow!

There should be a way to combine writes so fewer CSAVEs are needed. That is also standard cassette interface routine design. Maybe http://www.pc1500.com/fast-load.html has some ideas you can use?
 
What the manual says is that one of the commands redirects the cassette data to the serial port but then it also has that explicit statement about 2S pause after each line. I can't imagine upgrading to 2400bps only to throttle back below 300. I'll have to dig into the commands some more; it was after all my first time using this.
 
That seems to be a quirk of the CSAVEa and CLOADa functions as the computer has to convert its internal basic tokens to and from ASCII where CSAVE and CLOAD have the cassette type header block followed by the program block.
 
That's amazing! Yeah, the LH5811 started clicking together for me once I spotted it in the PC-2 itself, as well as in the printer. Seems like that chip just follows the PC-2 around everywhere, but the best part is: it's fully documented in the PC-2 service manual (Radio Shack edition, here). So, not so much a black box mystery any more. But moreso: it's a bit surprising that the printer dock is entirely "dumb"! It contains nothing more than a ROM chip and a LH5811 I/O port chip. Literally every part of the printer's operation is directly controlled from the PC, using an accessory ROM hanging out on the board as well, to give it the necessary routines.

Okay, about CSAVEa... is that how you have to interact with the port? TBH with today's more modern uses of the port, I might expect you'd need to write your own new BASIC keywords and ROM routines in order to save/load a program over the port, for example... was that ever a feature it offered?

I know that with the PC-1, CSAVE was quite slow because it did have a multi-second gap between blocks, but I think that was a factor of its slow processor. Pocket-Tools, for instance, shrinks that gap down considerably for WAVs it generates. On my PC-2, csave/cload (for programs) seems gapless... just bursts constantly.

Wasn't there a routine for polling/reading the UART buffer on that thing, reading one or multiple bytes at a time, without use of CLOAD etc?
 
I just used CSAVEa so I could verify it was all working... binary would look like a lot of trash on the terminal. In practice you would use the faster CSAVE.
 
Its kind of neat the way they put the code for the add ons in the add ons without having to spin up an entire new processor.
 
CSAVE into the CE-158 is really fast (relativly speaking) and saves the program in a very compact form. CLOAD should be equally fast.

Next task is to test SRAM emulation of the ROM which they put in a convenient socket.
 
Looking at the mechanical stackup today: It looks like I'll be able to leverage most of the hardware and firmware from the cassette interface including the power system, LCD touch interface etc.

I'm going to use the same housing as the cassette interface and shrink the DB25F for the serial down to a DB9F and then use a 26 pin IDC for the printer port that can be turned into a DB25M with ribbon cable. The PC2 interface comes out the right side of the housing at just the right height for either the PC2 or the printer 60 pin.
 
And yes... the BOM will be a bit above the original $10 of a bare board that just copies the CE-158.
 
Back
Top