8251A introduction

Greg Holdren's CPM Serial Output mod. Connect serial terminal to your NABU in CPM without requiring a Serial I/O Controller.
greghol
Posts: 13
Joined: Tue Mar 28, 2023 9:40 pm
Location: Sacramento, CA, USA

8251A introduction

Post by greghol »

Edited: 3/29/2003

While the virtual 80 scrolling is a life saver on the eye using the left right keys to visualize 80 columns on the VDP output; some times you just need 80 columns at a glance. Here is the 8251A keybaord UART TX side redirecting the CON out to TTY via Cloud CP/M. This a free and easy way to get 80 column serial output from Cloud CP/M as well as doing logging and screen scraping. Add debug output to VDP programs for debugging etc. You can still experience the NABU keyboard input too. With SW CP/M 2.2 redirection along with the 8251A HW mod this can be accomplished.

Follow the attached U4 8251 diagram for connections. Connect TxC (pin9) jumper to system's 1.79HMz CLK (pin 20) to provide a baud clock for TX. Serial TX out (pin 19) and the 8251A ground (pin 4) or from another ground source. This mod should be solderable from the top side of the PCB board with very little effort with basic soldering skills. Connection to a +5V compatible USB serial dongle for use with devices that are capable with USB based serial COM port support from the host OS, i.e. Linux/Windows etc. or a RS232C converter for a PC computer or dumb terminal with a DB9 or DB25 connector which usually means RS232C. Using a real ADM3 might be a challenge since the max baud rate is 19.2k baud since this HW mod will only provide 115.k baud. Many VTxxx terminals support faster speeds. (see below for option explanation*) An emulated ADM3 PC based terminal program will handle a wide range of what the USB serial and PC can do.

This mod only runs at 115.2k baud rate (or 111.875k baud to be exact with 1.79 MHz clock) But is close enough for terminal to receive ok at 115.2k baud rate.

*If another baud is needed then the TxC needs to be changed to 16 times the desired baud. For instance a real ADM3 terminal max baud is 19.2K. So a TxC clock needed is 19200 x 16 = 307.200k KHz. This clock is needed instead of 1.79 MHz. The are devices that can be used to generate baud clock with dip switches and some that are programmed via Z80 CTC or other programmable counter/timer chips. The reproduction NABU TX/RX serial card uses a CTC for example.

The example test C code is based on DJ's homebrew bouncy NABU example code on his site along with NABU_LIB on DJ's github NABU repo and z88dk C compiler environment. This could be used to verify the mod or you can just try the CPM redirect. Snippet of the test code is shown below.

To redirect screen output in Cloud CP/M:
stat CON:=TTY:
at the CP/M command line prompt.

1) Write 91h with 05h once (tx enable with rx enable for keyboard continued input)
2) Read keyboard port status 91h for bit 3 to be to 1 (check tx empty).
3) Write char at 90h.
4) back to step 2 to repeat.

Code: Select all

    //Once
    IO_KEYBOARD_STATUS = 0x05;
    
    //loop
    if(*msg_ptr != '\0')
    {
        if(0x04 & IO_KEYBOARD_STATUS)
        {
        IO_KEYBOARD = *msg_ptr;
        msg_ptr++;
        }
    }
    else
    {
        if(0x04 & IO_KEYBOARD_STATUS)
        {
            IO_KEYBOARD = 0x0D; //carriage return
        }
        if(0x04 & IO_KEYBOARD_STATUS)
        {
            IO_KEYBOARD = 0x0A; //line feed
            msg_ptr = name;
        }
    }
See git hub repo at:
NABU_U4_8251_TX Github

[youtube][/youtube]

Greg
Attachments
8251.PNG
8251.PNG (119.04 KiB) Viewed 7297 times
Last edited by greghol on Thu Mar 30, 2023 3:46 am, edited 1 time in total.
User avatar
DJ Sures
Posts: 347
Joined: Tue Mar 28, 2023 8:36 pm
Location: nabu.ca
Contact:

Re: 8251A introduction

Post by DJ Sures »

Nice! I can't wait to try this out when I get back home. I was thinking of 3d printing a bracket on the back with a USB connection so I can plug in a USB cable.
User avatar
superbenk
Posts: 54
Joined: Wed Mar 29, 2023 10:44 am

Re: 8251A introduction

Post by superbenk »

Such a great little mod. Super easy to do & totally reverseable. I got this to work just fine with a USB adapter & minicom on my Macbook but I couldn't make it work with my DEC VT-510 terminal. We had some discussion about it on Discord but thought I'd post here in case anyone else had ideas.

All I got was a series of reversed bold question marks on every key-press. I suspect the VT-510 is just more sensitive to the baud rate being slightly off from 115.2k but I don't have any crystal oscillators to fix that currently. I connected ground to pin 7 (SIG GND) & TX to pin 3 (RX) on the female comm1 port as per the manual (http://bitsavers.org/pdf/dec/terminal/v ... _Nov96.pdf) & configured the VT-510 for 115.2k/8N1/flow-control off.
- Ben
User avatar
DJ Sures
Posts: 347
Joined: Tue Mar 28, 2023 8:36 pm
Location: nabu.ca
Contact:

Re: 8251A introduction

Post by DJ Sures »

Such a great little mod. Super easy to do & totally reverseable. I got this to work just fine with a USB adapter & minicom on my Macbook but I couldn't make it work with my DEC VT-510 terminal. We had some discussion about it on Discord but thought I'd post here in case anyone else had ideas.

All I got was a series of reversed bold question marks on every key-press. I suspect the VT-510 is just more sensitive to the baud rate being slightly off from 115.2k but I don't have any crystal oscillators to fix that currently. I connected ground to pin 7 (SIG GND) & TX to pin 3 (RX) on the female comm1 port as per the manual (http://bitsavers.org/pdf/dec/terminal/v ... _Nov96.pdf) & configured the VT-510 for 115.2k/8N1/flow-control off.
Does the VT510 need TTL UART or RS232? Because the voltage is considerably different. Also, isn't rs232 inverted from ttl?

If not, you could always make a BAUD converter without modifying the nabu using an Arduino. If you use a low-cost Arduino ProMicro, which as 2 UART ports it would be easy.

like this...

Code: Select all


void setup() {

  Serial.begin( what ever the baud is on nabu ); // nabu side

  Serial1.begin(115200); // terminal side
}

void loop() {

  if (Serial.available())                // If anything comes in from nabu
    Serial1.write(Serial.read());   // read it and send it out Serial1 (pins 0 & 1)
    
}
User avatar
superbenk
Posts: 54
Joined: Wed Mar 29, 2023 10:44 am

Re: 8251A introduction

Post by superbenk »

All good points. I'm not very well versed in serial comms but I'll look into those things. I have some MAX3232 modules that I thought I'd play with (https://www.amazon.com/dp/B00LUDCAXQ?). Since this is essentially what the USB adapter uses I'm wondering if I can make one of these work in-line in the cable to the VT510?

Again, I'm still very inexperienced with this lower-level stuff.

In case the Amazon link doesn't work these are the modules I got:

HiLetgo 10pcs Mini RS232 to TTL MAX3232 to TTL Level Converter Board Serial Converter Board RS232 to TTL Serial
- Ben
greghol
Posts: 13
Joined: Tue Mar 28, 2023 9:40 pm
Location: Sacramento, CA, USA

Re: 8251A introduction

Post by greghol »

superbenk wrote: Wed Mar 29, 2023 5:38 pm All good points. I'm not very well versed in serial comms but I'll look into those things. I have some MAX3232 modules that I thought I'd play with ( Since this is essentially what the USB adapter uses I'm wondering if I can make one of these work in-line in the cable to the VT510?

Again, I'm still very inexperienced with this lower-level stuff.

In case the Amazon link doesn't work these are the modules I got:

HiLetgo 10pcs Mini RS232 to TTL MAX3232 to TTL Level Converter Board Serial Converter Board RS232 to TTL Serial
Like DJ says you need a TTL to RS232 converter for this to work. You might want to spend a little more and get the DB9 connector with the RS232 circuitry to make it easier. For example: It is also clearer on how to wire it up too. Connect GND and TX to the appropriate pins on the converter.

I'll edit the original post and make it clearer about the two different dongle styles and use cases.

I do have a commercial thin "Pizza Box" style serial to VGA terminal box that will emulate the VTxxx series with RS232. I'll give it a try tonight if I find time otherwise tomorrow night. I was having mixed results with the PC HyperAcess and VT52 mode with VTEST52.com. Mostly worked with screen position etc. but the clear screen didn't appear to work. ADM3A looked ok with the terminal program.

Greg
greghol
Posts: 13
Joined: Tue Mar 28, 2023 9:40 pm
Location: Sacramento, CA, USA

Re: 8251A introduction

Post by greghol »

The following pictures are from the RS232 adapter to the Esprit serial to VGA terminal. Three connections: +5, GND and TX data. Basic connection is good at 115.2k baud.

Greg
Attachments
3.GIF
3.GIF (463.26 KiB) Viewed 7263 times
2.GIF
2.GIF (626.42 KiB) Viewed 7263 times
1.GIF
1.GIF (430.54 KiB) Viewed 7263 times
User avatar
LeoBinkowski
Posts: 168
Joined: Tue Mar 28, 2023 4:23 pm
Location: nabu.ca
Contact:

Re: 8251A introduction

Post by LeoBinkowski »

I really like this hack on a number of levels. It solves a requirement for debugging without being too invasive.

Leo
User avatar
superbenk
Posts: 54
Joined: Wed Mar 29, 2023 10:44 am

Re: 8251A introduction

Post by superbenk »

I think my missing piece here must be the rs232 conversion. I have an older version of the module you are using there but it's in use elsewhere so I'll have to rig something else up. I'd really like to try building something with those MAX3232 chips I have. Perhaps build something into a 3d-printed expansion cover that has a DB-9 sticking out the back.

I tried messing around with a Feather RP2040 (aka Pico) and was able to receive from the Nabu but couldn't send to the VT510 (same reversed question marks if anything at all). It's definitely a learning experience all along the way but that's what makes it fun :)
- Ben
User avatar
superbenk
Posts: 54
Joined: Wed Mar 29, 2023 10:44 am

Re: 8251A introduction

Post by superbenk »

Getting closer with the rs232-TTL adapter! Seems like I still have a setting wrong somewhere though.
Attachments
139B348B-64A3-41CD-8322-846C08A06BB8.jpeg
- Ben
Post Reply