Yet another "I want to use the Genesis serial port"

For hardware talk only (please avoid ROM dumper stuff)
powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Yet another "I want to use the Genesis serial port"

Post by powerofrecall » Tue Sep 23, 2014 10:22 pm

I have a model 1 with the EXT connector I'd like to use for serial communication via RS232--simple text, maybe xmodem for very small transfers. I want to hook it up to a PC serial port. My machine doesn't have a parallel port (so, not an option for now), and I'm on Linux. I have looked around this forum and the net and here's what I know:

- I know it's a "third joystick port" with the connector gender reversed but like the regular joystick ports, can be programmed in a serial mode
- It's not a normal RS232 pinout on the Genesis end
- It needs level shifted (I'm assuming to TTL 0 and +5V I guess?) or else bad things may happen
- It's slow as hell. I'm aware of it and don't care, plus I don't have the resources (or honestly the inclination) to go programming PICs or cluttering up my desk with hardware hacking. I just want to spit out a little text and data, and not within a game loop context.

What I don't know:

- What the pinout actually is in serial mode. Anyone have a diagram?
- I'm not clear on exactly what level shifting needs to be done or the best way to do it. MAX232 type breakout board? Something like this?
- Can I wire it up like a male to female null modem cable, with the level converter inline with the cable? Kind of like the old Dreamcast "coder cables" if anyone remembers those.
- I'm assuming that other than the pinout being different, it would in fact be wired up like a null modem crossover (TX to RX and vice versa)
- Can I save myself a lot of trouble by hacking up a USB to RS232 cable? I know USB works at +5V so I'm curious if this would save having to do level shifting.

If anyone has any answers for me, my eternal thanks go out to you.

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Wed Sep 24, 2014 6:48 pm

powerofrecall wrote:- What the pinout actually is in serial mode. Anyone have a diagram?
There's one in the good old "sega2f" document. TL is Tx and TR is Rx.
powerofrecall wrote:- I'm not clear on exactly what level shifting needs to be done or the best way to do it. MAX232 type breakout board? Something like this?
A MAX232 is probably your best bet. I'm not familiar enough with the chip to recommend a particular breakout board. DIP versions do exist too, but you'll need to add a few capacitors to make a complete circuit (looks like that board has those already).
powerofrecall wrote:- Can I wire it up like a male to female null modem cable, with the level converter inline with the cable? Kind of like the old Dreamcast "coder cables" if anyone remembers those.
I don't see why not.
powerofrecall wrote:- I'm assuming that other than the pinout being different, it would in fact be wired up like a null modem crossover (TX to RX and vice versa)
Yes. I believe you can also wire up some of the RS-232 control lines to some of the remaining data pins and access them via the parallel data port interface on the 68K side. Pretty sure that's optional though. You'll need to level shift those as well if you connect them. I'm pretty sure the MAX232 has pins for this, but that breakout board you linked does not expose them.
powerofrecall wrote:- Can I save myself a lot of trouble by hacking up a USB to RS232 cable? I know USB works at +5V so I'm curious if this would save having to do level shifting.
I'm not sure about the USB to RS-232 cables, but USB to TTL serial cables (based on the popular line of chips from FTDI) are easy to find.

powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Wed Sep 24, 2014 11:09 pm

Thank you SO much. Just a couple more questions: Does 3.3V TTL or 5V matter? From what I can tell the MAX3232 breakout boards put out 3.3V so I'm curious as to whether I can get away with that or if I need an actual MAX232 part. I'm assuming the genesis is probably 5V, so what I'm really asking is "does it matter?" and will it work either way?

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Thu Sep 25, 2014 12:02 am

That I'm less certain about. In some cases, as long as a 3.3V part is 5V tolerant you can interface it to 5V parts without any extra parts. Some 5V parts have a pretty low threshold for a signal to be considered "high" and a 3.3V part can produce a sufficiently high voltage for things to just work. I believe this depends on the logic family involved, but I'm not too clear on the details. Usually the min Vhi voltage is specified in the datasheet, but we don't have that for the Genesis IO ports.

Looking around a bit more, it sounds like an actual MAX232 is a 5V only port; however, there are more modern versions that support a range of voltages that are compatible with the 232. Indeed, looking more closely at the ebay link you posted it is actually a MAX3232. Looking at the datasheet, it appears you need different capacitor values for supporting different logic levels. So those 3.3V boards might not be a good choice.

If you really want something simple, you might just want to get one of these. That will give you USB to 5V TTL serial without any additional work. Though at that price, I would probably just buy a Teensy 2.0 and do parallel IO. That would require some AVR programming (though I've been meaning to do that myself), but no real hardware hacking beyond wiring up a DB-9 connector.

powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Thu Sep 25, 2014 1:33 am

Mask of Destiny wrote: If you really want something simple, you might just want to get one of these.
Wiring that to the end of a male DE9 might just be the easiest thing to plug right into the unmodified port, and I like neat solutions like that. What I don't like is the cord is 18 bucks. :) Googling around suggests that the FTDI chip works on Linux and presents at /dev/ttyUSB0 so I might go this option.

Or how about just flat out replacing the EXT port with this? That way from outside the case at least it's a normal looking male RS232 port and I can use a cheapy monoprice null modem cable there.

Or use the FTDI breakout and put a USB port on my Genesis :)

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Thu Sep 25, 2014 10:48 am

Did you read this thread too ?

viewtopic.php?t=1704

We talked about what USB serial to use, how and for what...

Still on my todo list :(

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Fri Sep 26, 2014 11:02 pm

KanedaFr wrote:Did you read this thread too ?

viewtopic.php?t=1704

We talked about what USB serial to use, how and for what...

Still on my todo list :(
I have volunteered to make a Wiki Page for a long time now on this but no one came up with a place to host it.

I think that a decent document on this would help out a great deal and we can then work out the X/Y/Z-Modem details for transferring data back and forth on the fly.

I can pass you some Code if you want it and the wiring Diagrams and circuits if you need it, powerofrecall.

What you need hardware wise:

1. some kind of Serial Port (I use USB to RS232 devices, Breakouts and the Ports on my PC's Motherboard/add-on I/O Cards).

2. MAX232/equivalent Level-Shifter: you can knock this up quickly or simple order one ready made from EBay as I did (as I hate soldering).

3. RS232 Client for UNIX or Windows or whatnot.

Try it at 9600 or 1200BPS at first and tbh it helps if you have something to capture the RS232 traffic to check your lines and data. I use a Bus-Pirate and a Logic-Analyser that interprets RS232 data and that helps.

All you need are two Routines and you should be away.

I would post them up now but I am not on my main work Machine :)
I can get on to that over the next few days or so as a mate is visiting me at the moment.

Cheers,

Minty.
UMDK Fanboy

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Fri Sep 26, 2014 11:13 pm

Whilst we are on the topic:

Would any one object to Spritesmind having a 'Tutorials/Guides' section added?
UMDK Fanboy

powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Fri Sep 26, 2014 11:25 pm

There should definitely be a SpritesMind wiki, there is too much valuable information on here to just let it sit on a message board. This is the best technical/homebrew 16 bit Sega board on the net. I'd even volunteer time to upkeep a wiki.

powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Fri Sep 26, 2014 11:27 pm

Minty, we seem to be on the same page with this serial thing. I'm going to make some orders soon and pick up what I need off of ebay most likely and put my own cable together but if you have a known working design for a cable that would be a great help.

Edit: some code could be useful too, if only just to "bit bang" to test if it works.

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Sun Sep 28, 2014 5:52 pm

powerofrecall wrote:Minty, we seem to be on the same page with this serial thing. I'm going to make some orders soon and pick up what I need off of ebay most likely and put my own cable together but if you have a known working design for a cable that would be a great help.

Edit: some code could be useful too, if only just to "bit bang" to test if it works.
Hi,

I can give you details of what hardware I use that WORKS :) If you are having difficulty sourcing any of it (very unlikely) then I can even arrange to have Hardware posted to you - but it is VERY simple stuff here so honestly should not be a problem.

Cable wise: all you need is a standard 9-pin D-Sub Male for the Ext-Port or the same but Female for either or the other two Controller-Ports.
You can use standard Bell or Core wire that you can find pretty much at any Electronic Component Seller/Shop or ask a professional to have one made for you but it is not necessary. If you have a scope then you might wish to pass some signals through and see how 'clean' your signals are but again not much of a concern.

As for getting your RS232 UART: if you have a known and working solution for RS232 then use that such as a USB<->RS232 Transceiver device that are commonly found these days or perhaps even your Computer has a Serial Port or two that you could use.

As for the Level-Shifter: either make a small board that includes the Shifter or buy one from EBay - I shall do a search to find something suitable for you if you are not confident with soldering or like me you have little interest in soldering :D

I am having to look after a friend who is visiting me for the next few days but once he has gone I will get you the Code, Schematics and Connections that you need for your Cable and you should be up and running.
UMDK Fanboy

powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Mon Sep 29, 2014 11:29 pm

I've opted to go with a USB to RS232 TTL cable with an FTDI chip; I have 2 serial ports on my PC, but I don't know if I will necessarily have that on future PC's. It's a cable meant for use with an Arduino and says it's 5V TTL, so I'm assuming it will work. I also have a DE9 male connector with solder cups and housing to solder directly to the other end of the cable (I'm going to use the EXT-port on the rear of my model 1 instead of a joy port as I may eventually need the 2nd controller port free).

I'll post back when I have it constructed, but from what I've read (thanks everyone) I figure it should be suitable.

powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Sat Oct 04, 2014 9:04 pm

Alright, I'm going to give this a shot. I just want to make sure I have stuff right.

D0 - D3 aren't used for serial, so I don't connect those.

TL and TR are Tx and Rx respectively. Tx->Rx and vice versa. Pins 6 and 9 of the port.

Do I connect +5V from my FTDI cable to the +5V pin on the sega? I'm assuming yes but want to be sure.

Is RTS/CTS used (I'm assuming it's not) and if so, what pins?

The sega2f diagram is weird. I'm assuming that basically all the serial function is multiplexed onto the Tx/Rx pins and send/receive control is through the S-CTRL register. What is HL TERMINAL on that graph?

So I connect Tx, Rx, +5V and... what else? Is that it?

powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Sun Oct 05, 2014 12:03 am

The diagrams on Future Driver suggest I don't need the +5V connection either, is it really just the two pins?

http://68000.web.fc2.com/sram.html[/url]

edit: and ground?

What would I use to test it?

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Sun Oct 05, 2014 4:25 am

I would assume that the +5V pin on the FTDI supplies USB power. Unless you're trying power the connected device off of USB, you should leave that disconnected. Ground on the other hand is very important.

Post Reply