Page 1 of 1

EXP port as UART? For MD/GENNY soundcard project...

Posted: Sat Dec 01, 2012 1:13 pm
by tinctu
My HW friend developed FM board for arduino. FM emulation runs on modern 32bit MCU. He sends data and rest do PCB board (stereo song replay).
It is based on OPL emulation (soundblaster16,adlib).
So my question is can EXP port works as UART? When yes we will have 8euro soundcard which doesnt consume 68000 or Z80 time for music.
So YM2612 can be used for effects only (guns, kicking, explosions etc etc)... So we can have massive soundsystem like on arcade maschines was...

Here is board:
Image

Posted: Sat Dec 01, 2012 5:37 pm
by TmEE co.(TM)
All 3 ports got up to 2400 baud serial mode. No hardware handshake though

Posted: Sat Dec 01, 2012 8:54 pm
by neologix
You could do what byuu did on the SNES and maybe try to use the controller port instead?

Posted: Sat Dec 01, 2012 8:55 pm
by TmEE co.(TM)
Parallel arrangement will result in a lot greates speeds on MD. 4bits for data I/O and 2 for handshake got me ~60KB/sec comms to PC over LPT port.

Posted: Sun Dec 02, 2012 9:02 am
by bastien
Hi,
That's a very good project !
I'm also want to do a simple project ( Led Bliking with the I/O port)
Did you have some docs about Megadrive I/O i have read the Gen.hw.txt from Charles Mc Donald , good docs but i don't have enough information.

Thanks !

Posted: Sat Dec 08, 2012 3:55 pm
by doragasu
I'm also interested on how to set up the MD ports to use them as UARTs. 2400 bps is a very low baud rate (that's around 4 bytes per frame), but can be enough for some simple input/output devices.

Posted: Sat Dec 08, 2012 5:57 pm
by Chilly Willy
Actually, it's 4800 baud. All three controller ports (the two normal control ports + the exp port on the MD1) can be used for serial. There are three registers for each port, starting at 0xA1000F:

TxData - write a byte to send
RxData - read a byte received
S-Ctrl - controls serial:
b7-6: baud rate = 00 = 4800, 01 = 2400, 10 = 1200, 11 = 300
b5: serial in enable = 0 = no serial in, 1 = serial in from TL
b4: serial out enable = 0 = no serial out, 1 = serial out on TL
b3: read int enable = 0 = no int, 1 = int on input byte ready
b2: read error status = 0 = no err, 1 = error on RxD
b1: read ready status = 0 = no byte, 1 = input byte ready
b0: transmit buffer full status = 0 = not full, 1 = TxD full

So if you were using EXP for serial, the registers would be 0xA1001B, 0xA1001D, and 0xA1001F. Note that the serial is not full duplex - you should enable reading or writing, not both. Use the other parallel bits for control lines, like CTS and RTS. If you enable the read byte ready int, that will be INT2 just like for lightguns.

Posted: Mon Dec 24, 2012 12:44 pm
by doragasu
Thanks a lot for the info. It's a pity the port isn't full duplex and has no Tx interrupt :(

If I want to use controller port 1, then registers are 0xA1000F (TxData), 0xA10011 (RxData) and 0xA10013 (S-Ctrl), right? What's the pinout for TX and RX pins? Does it use standard DB-9 pinout (e.g. pins 2 and 3 for Rx and Tx)?

Posted: Mon Dec 24, 2012 7:53 pm
by Chilly Willy
doragasu wrote:Thanks a lot for the info. It's a pity the port isn't full duplex and has no Tx interrupt :(
Yeah, but consider when it was made... you're lucky it has interrupts at all, and goes a HIGH as 4800 baud! :D
If I want to use controller port 1, then registers are 0xA1000F (TxData), 0xA10011 (RxData) and 0xA10013 (S-Ctrl), right?
Right.
What's the pinout for TX and RX pins? Does it use standard DB-9 pinout (e.g. pins 2 and 3 for Rx and Tx)?
Slight goof on my info above... serial in is on the TR line, and serial out is on the TL line. The info above incorrectly states serial in was also on TL.

TR and TL are the button lines on the DB9 - TR = C, and TL = B.

I put them both on TL in the previous post because there's an error in the figure on pg 105 of the Genesis Software Manual showing TL being both out and in. So that means that a correction to the S-Ctrl is needed - b5 controls the serial in on TR, not TL.

Posted: Tue Dec 25, 2012 7:54 pm
by TmEE co.(TM)
You can cause an interrupt on a transfer by pulsing the TH line from the other side.

Posted: Wed Dec 26, 2012 12:32 am
by Chilly Willy
TmEE co.(TM) wrote:You can cause an interrupt on a transfer by pulsing the TH line from the other side.
Great idea... use the TH int as the transmit done int. Needs a little more hardware in the device, but not much.

Posted: Wed Dec 26, 2012 9:45 pm
by doragasu
Genesis software manual?

Is that some kind of leaked document? Sounds interesting :-P

Posted: Thu Dec 27, 2012 12:49 am
by Chilly Willy
doragasu wrote:Genesis software manual?

Is that some kind of leaked document? Sounds interesting :-P
It's been out for many years now. You can find links to a PDF version on the boards here somewhere... just click the search button at the top of the page. :D

The original had some missing pages, and there have been corrections to some of the info. I seem to remember a couple of threads on the manual and mistakes in it.

Posted: Tue Jan 08, 2013 7:14 pm
by tinctu
THNX for infos.