dc's serial <-> pc's parallel

Discuss modifications you have done or plan to do to your Dreamcast or any other hardware, or discuss devices you want to build. If your console does not work or is acting up, ask about fixing it in here.
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

no 460800 is too far of 390 or 521 Kbps, it won't work.
To make your 230400 bps work you must hack dc-tool to send the good speed to the dreamcast. If I remember well there's a formula to calculate the rate that is to be sent to the dreamcast, but it's wrong for high rates.
If I remember well the speed sent to the dreamcast is 12 or 13 for the 115200 or 115200 alternate mode.
So dc-tool should send 6 or 7 for 230400 but the formula probably doesn't gives the good one.
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

I just looked at the source, in change_speed make dc-tool send 223214 in place of 230400, dcload will switch to 223 Kbps, else it must be using 260Kbps, which is too far from 230Kbps.
bender
Mental DCEmu
Mental DCEmu
Posts: 399
Joined: Sun May 12, 2002 4:18 pm
Has thanked: 0
Been thanked: 0

Post by bender »

Thanks. I can't try it till monday because I don't have my dreamcast here, sigh. I'm at GMT+1

I will try to fix the speed for the cable then. The serial modem should work fine too ;-)
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

Just for those willing to know why, the dreamcast uses this formula to set its serial speed :
*SCBRR2 = (50 * 1000000) / (32 * bps) - 1;
if you simplify, it becomes : 1562500/bps - 1

If you ask for 230400 : 1562500/230400 - 1 = 5,78
in C you round to 5.
it means a real bitrate of : 1562500/(5+1) = 260417
Too bad it doesn't match 230Kbps.

If you ask for 223214, 1562500/223214 - 1= 6,00
so you'll get what you asked for.
bender
Mental DCEmu
Mental DCEmu
Posts: 399
Joined: Sun May 12, 2002 4:18 pm
Has thanked: 0
Been thanked: 0

Post by bender »

Thanks a lot. I will try the changing the formula on monday :-).
I have also just fixed the problem I had and now the USB->Serial it's working perfectly. The reason was just that I had compiled :

USB Serial Converter Support -->
[*] USB Generic Serial Driver

The USB Generic Serial Driver is just not needed, we only need our driver compiled and the USB Serial Console Support. Probably the cable was working through the generic driver instead of the good one. I know, I should have seen it before, lol :P

So 115200 now probably works because everything seems fine and 223214 probably too. I could also hack the kernel driver for adding just the 223214 or the 390kbps for this driver (just adding the baud rates in the 'switch' I posted some posts before, I guess). 390kbps will not work for my device but I could try, I think ;-)
Now I'm really happy )()(
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

Problem is your device probably uses a multiple of 115200
230400 is ok for dreamcast transfers, 460800 and 921600 can't be used.

If it can match exactly the bitrates of the dreamcast, then you're lucky, push it to the max ! some chips have better control on bitrate than just dividing by an integer number (the ftdi usb chips have a quarter resolution).
If you can do 307200 bps, it can match the 312500 bps rate of the dreamcast.

Maybe you misunderstood me, I'll explain again.
You have to configure your pc at 230400 bps, but the dreamcast at 223214 bps.
No need to change dcload, just dc-tool :
in change_speed add something like :
if (speed == 230400)
send_uint (223214);
else {
send_uint (speed); (or 111000 if -e)
}
bender
Mental DCEmu
Mental DCEmu
Posts: 399
Joined: Sun May 12, 2002 4:18 pm
Has thanked: 0
Been thanked: 0

Post by bender »

Thanks. I have just tried for 115200 and 230400 but doesn't work for me. I don't know the reason. My kernel driver supports those rates and dctool should support them with the speed hack for the exact dreamcast values, I think . Perhaps the problems is just dctool working with this device and the /dev/ttyUSB0. The serial port modem was fine using this device too :?

Edit: Tried a bit more and definately does not seem to work for higher transfer rates than 57600 :?: I have changed the dc-tool.c for different baud combinations with and without the speed hack, modified the kernel driver for different transfer rates or things like just having only an 115200 or 230400 in the kernel side but nothing.

For Bluecrab: These are the devices supported by the pl2303 linux driver:
Archive pl2303.h

Code: Select all

/*
 * Prolific PL2303 USB to serial adaptor driver header file
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 * 
 */
#define PL2303_VENDOR_ID	0x067b
#define PL2303_PRODUCT_ID	0x2303
#define PL2303_PRODUCT_ID_RSAQ2		0x04bb
#define PL2303_PRODUCT_ID_PHAROS	0xaaa0
#define PL2303_PRODUCT_ID_RSAQ3		0xaaa2

#define ATEN_VENDOR_ID		0x0557
#define ATEN_VENDOR_ID2		0x0547
#define ATEN_PRODUCT_ID		0x2008

#define IODATA_VENDOR_ID	0x04bb
#define IODATA_PRODUCT_ID	0x0a03

#define ELCOM_VENDOR_ID		0x056e
#define ELCOM_PRODUCT_ID	0x5003
#define ELCOM_PRODUCT_ID_UCSGT	0x5004

#define ITEGNO_VENDOR_ID	0x0eba
#define ITEGNO_PRODUCT_ID	0x1080

#define MA620_VENDOR_ID		0x0df7
#define MA620_PRODUCT_ID	0x0620

#define RATOC_VENDOR_ID		0x0584
#define RATOC_PRODUCT_ID	0xb000

#define TRIPP_VENDOR_ID		0x2478
#define TRIPP_PRODUCT_ID	0x2008

#define RADIOSHACK_VENDOR_ID	0x1453
#define RADIOSHACK_PRODUCT_ID	0x4026

#define DCU10_VENDOR_ID		0x0731
#define DCU10_PRODUCT_ID	0x0528

#define SITECOM_VENDOR_ID	0x6189
#define SITECOM_PRODUCT_ID	0x2068

/* Alcatel OT535/735 USB cable */
#define ALCATEL_VENDOR_ID	0x11f7
#define ALCATEL_PRODUCT_ID	0x02df

/* Samsung I330 phone cradle */
#define SAMSUNG_VENDOR_ID	0x04e8
#define SAMSUNG_PRODUCT_ID	0x8001

#define SIEMENS_VENDOR_ID	0x11f5
#define SIEMENS_PRODUCT_ID_X65	0x0003

#define SYNTECH_VENDOR_ID	0x0745
#define SYNTECH_PRODUCT_ID	0x0001
It would be interesting if you can also try your device with this driver on a linux box and see what happens. Winblows and Mac test are interesting too if possible. I could try on a friend's windows machine perhaps :-)
bender
Mental DCEmu
Mental DCEmu
Posts: 399
Joined: Sun May 12, 2002 4:18 pm
Has thanked: 0
Been thanked: 0

Post by bender »

I'm thinking that this only works for 57600 just because is an standar rate on both sides. Perhaps is a problem of the cable for being too standar or there's another way to make the correction so we can send the 115200 or 230400 and receive the good ones, don't know. ...having a look at the official driver that comes in the cdrom seems also the same as the kernel one...
sigh, the coffee doesn't let me to sleep, 3.00am here :roll:
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

well in fact even if the two rates don't match, transmissions are ok if the difference is < 4.1%
maybe your cable doesn't really do 115200, did you try the alternate 115200 ?
is your coder's cable homemade ? is it long ?
If you've got access to a digital sampling oscilloscope, calculate the real rate of the transmissions.
bender
Mental DCEmu
Mental DCEmu
Posts: 399
Joined: Sun May 12, 2002 4:18 pm
Has thanked: 0
Been thanked: 0

Post by bender »

I have tried the alternate 115200 but nothing and the coder's cable is the one from lik-sang, about 50cm. I don't have a digital sampling oscilloscope

Is really a mistery. I'm thinking the problem is just dc-tool with this device but don't know why, lol .

From the kernel driver I'm using, pl2303.c. By default:

Code: Select all

case B115200:   baud = 115200;  break;
case B230400:   baud = 230400;  break; 
The software says that those bauds are supported but perhaps the real reason is that you are pointing and really we don't have those baud rates. I'll attempt tomorrow a bit more, I guess ;-)
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

try to hook it to a pc with a null modem cable to see if it talks at 115200, I've no clue, without an oscilloscope it's hard to tell what's going on.
bender
Mental DCEmu
Mental DCEmu
Posts: 399
Joined: Sun May 12, 2002 4:18 pm
Has thanked: 0
Been thanked: 0

Post by bender »

hmm. I'm thinking that perhaps I don't need the oscilloscope and I have never used one. I have studied computing science but my hardware knowledge is limited to theorical lessons :P
I'm thinking that if there's a 4.1% tolerance and 57600 works, I could perhaps try to apply the tolerances to 56700bauds and look for the equivalents on 115200 and 230400

I didn't answer your post yesterday because I've moved to a new job and I'm really busy for a while. :oops: . Thanks for all your help. In fact, you are the only guy that is interested in this :-)
Last edited by bender on Wed Feb 15, 2006 4:38 pm, edited 1 time in total.
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

Well I worked a bit on my isa fullspeed serial card, and followed Axlen's usb cable all the way.

I don't understand what you mean about applying tolerances to 56700 bps.
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

The manual of your cable says it can go over 500Kbps, there should be some trouble with the linux driver, did you test dc-tool with cygwin/windows ?

what gives you the command setserial /dev/ttyUSB0 -a ?
bender
Mental DCEmu
Mental DCEmu
Posts: 399
Joined: Sun May 12, 2002 4:18 pm
Has thanked: 0
Been thanked: 0

Post by bender »

Forget what I said about the tolerances. I was thinking that we know the working limits for 57600 but is an stupid idea

About setserial, I get:

Code: Select all

darkstar bender # setserial /dev/ttyUSB0 -a
Cannot get serial info: Invalid argument
darkstar bender # ls -ltr /dev/ttyUSB*
crw-rw----  1 root tty 188, 0 Feb 16 00:22 /dev/ttyUSB0
The device does not have an IRQ, perhaps that's a problem for setserial

Thanks :wink:
chaos
DCEmu Junior
DCEmu Junior
Posts: 42
Joined: Sat Oct 22, 2005 8:41 am
Has thanked: 0
Been thanked: 0
Contact:

Post by chaos »

Baud rate setting by external clock. (DC Serial Port 2pin)

1) SCSCR2(0xffe80008) Serial Control regsister : bit1 (SCK2:external clock) <= ON
2) DC Serial Port 2pin <= baud late clock (baudlate * 16)

baud rate 115200bps ex.) DC Serial Port 2pin <= 1.8432MHz (115200 * 16)
baud rate 1.5Mbps ex.) DC Serial Port 2pin <= 24MHz (1500000 * 16)

by chaos (jj1odm)
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

that's strange, synchronous serial transfers usually transmit/receive at the same speed as the clock, well maybe it's not a synchronous mode but just a rerouting of the clock.
This info could be used for a better usb cable.

Did you test this ? Do you know if higher rates can be achieved ?
chaos
DCEmu Junior
DCEmu Junior
Posts: 42
Joined: Sat Oct 22, 2005 8:41 am
Has thanked: 0
Been thanked: 0
Contact:

Post by chaos »

This gives a mere external baud rate.
And, this port is only for the asynchronous mode.

test:
115200bps DC <=> PC
1.5Mbps DC <=> DC
chaos
DCEmu Junior
DCEmu Junior
Posts: 42
Joined: Sat Oct 22, 2005 8:41 am
Has thanked: 0
Been thanked: 0
Contact:

Post by chaos »

I think a clock that is higher than 24MHz to be OK.
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

means we could push the serial port to 2Mbps or maybe more.
Post Reply