Page 1 of 2

sioloader

Posted: July 19th, 2019, 7:04 am
by danhans42
SIO Loader for Sony PlayStation Consoles

Basically its the source of Serial v1.3 by Hitmen but with selectabe serial speed.

Uses a very simple serial cable (rxd/txd/gnd) that is easy to build.

The client is written in Python 3, and has been tested on Python 3.7 on both Windows and Linux. It requires pyserial, which isnt always included. Google can help if you get stuck.

You can use two speeds - 115,200bps or 345,600bps. Once you have selected the requried speed on the PSX, use the corresponding on the client..

Code: Select all

usage : sioload.py

commands -run : upload & execute PSX-EXE @115.2k (PSXSERIAL/UNIROM/HITSERIAL compatible) -trun: upload & execute PSX-EXE @345.6k (SIOLOADER only)

where is the name of your serial port and is the name of the file to upload/download

  eg  : sioload.py -run /dev/ttyUSB0 greentro.exe
        sioload.py -trun COM5 trancetro.exe
Few notes :-

Size limit should be similar to Serial v1.3 ~1700k.

345,600bps - I have only tested this with a GENUINE FTDI USB UART. If you have issues switch to 115,200bps.

Source/Compiled EXE

https://github.com/danhans42/sioload/

Re: sioloader

Posted: July 19th, 2019, 12:29 pm
by LameGuy64
Huh? This is interesting, I couldn't even get reliable communications to work at 230,400 baud. I suppose it could just be the fact that I was using a CH340 based UART and not an FTDI.

Re: sioloader

Posted: July 19th, 2019, 2:39 pm
by Dedok179
LameGuy64 wrote: July 19th, 2019, 12:29 pm Huh? This is interesting, I couldn't even get reliable communications to work at 230,400 baud. I suppose it could just be the fact that I was using a CH340 based UART and not an FTDI.
Probably. Brill told me that on FTDI, high speed works stably for him.

Re: sioloader

Posted: July 19th, 2019, 2:45 pm
by Dedok179
danhans42 wrote: July 19th, 2019, 7:04 am SIO Loader for Sony PlayStation Consoles

Basically its the source of Serial v1.3 by Hitmen but with selectabe serial speed.

Uses a very simple serial cable (rxd/txd/gnd) that is easy to build.

The client is written in Python 3, and has been tested on Python 3.7 on both Windows and Linux. It requires pyserial, which isnt always included. Google can help if you get stuck.

You can use two speeds - 115,200bps or 345,600bps. Once you have selected the requried speed on the PSX, use the corresponding on the client..

Code: Select all

usage : sioload.py

commands -run : upload & execute PSX-EXE @115.2k (PSXSERIAL/UNIROM/HITSERIAL compatible) -trun: upload & execute PSX-EXE @345.6k (SIOLOADER only)

where is the name of your serial port and is the name of the file to upload/download

  eg  : sioload.py -run /dev/ttyUSB0 greentro.exe
        sioload.py -trun COM5 trancetro.exe
Few notes :-

Size limit should be similar to Serial v1.3 ~1700k.

345,600bps - I have only tested this with a GENUINE FTDI USB UART. If you have issues switch to 115,200bps.

Source/Compiled EXE

https://github.com/danhans42/sioload/
Which bootloader to use on the console for it? Or does it work without a disk?

Re: sioloader

Posted: July 19th, 2019, 4:07 pm
by danhans42
It's a PSX-EXE... So you would need to make an ISO of it.

If I find time I will try and build one and upload it at some points.

Re: sioloader

Posted: July 24th, 2019, 11:51 am
by LameGuy64
I just tested 230,400 and 345,600 bauds with my FTDI and well, communications was still very unreliable. Bytes often kept getting missed and I end up with incomplete data, I'm not so sure about the integrity of what was received though.

It could either be my wiring (I used old, probably rusty wires to connect the FTDI to the DB9 of my PS1) or my FTDI is a knockoff, I'll try using better wires to see if it'll solve the problem.

Re: sioloader

Posted: July 24th, 2019, 12:41 pm
by Administrator
Try a higher core count of wire and try seeing if twisting them into a twisted pair would help. Usually twisted pairs are for parallel data lines, but it might help eliminate noise in this situation.

If that doesn't work, make the wires as short as possible. Really you'd want the FDTI soldered directly to the PSX CPU.

Re: sioloader

Posted: July 24th, 2019, 7:48 pm
by danhans42
I need to do more testing at my end with other UARTs. I have also only tested the fast speeds for uploading to the PSX, not downloading from it.

In both instances my test setup is using half a link cable.. so the connection between the FTDI and the PSX is around 80cm long. Also, Squaresoft74 has tested it and it is working with the SIO cable made by xrider.. which also uses a genuine FTDI.

Be very interesting to get to the bottom of it and hopefully push more speed out of the SIO port.

Re: sioloader

Posted: July 24th, 2019, 11:35 pm
by rama3
It's not so much about genuine parts vs clones*, but the details of operation.
I think the PSX had an inversion step, right? It kind of feels like this is important with the speed limitations you see.

* At these low speeds. It would matter at several MHz.

Re: sioloader

Posted: July 24th, 2019, 11:50 pm
by danhans42
Inversion step?
If I understand you correctly, the only part of SIO that is inverted is the handshaking lines.. which arent in use for this application.

If I am honest, I do not think the issue is with the USB UART but it is easy to exclude from the investigation. I have had issues with the counterfeit FTDI chips in the past, especially at higher speeds.

Now I am an absolute amateur when it comes to PSX programming.. but the source that is attached above works and personally am unsure as to why.

Could it be worth trying some absolute bare minimum resources SIO loader.. eg.. no graphic initialisation or anything and see if that hinders things?

Re: sioloader

Posted: July 25th, 2019, 7:01 am
by danhans42
Just tested my PSone at 345600 using an ESP8266 as a uart/TCP bridge and worked fine too

So the issue lies elsewhere it seems?

Re: sioloader

Posted: July 25th, 2019, 7:32 am
by rama3
True, that was with the handshaking.
Okay, so using an ESP8266 is actually a good recommendation.
These dev boards are quite small, come with USB bridges, offer WiFi, and are cheap.
I'd much rather use one of these, than pay FTDI and support their malware practices ;p

Regarding software, it's probably best to do all the nice drawing as a first step.
On the actual data transfer, the CPU should be as idle as possible.
Don't generate long display lists for the GPU, don't call library functions, stuff like that.
If there are VBlank handlers, they should be suspended as well.
I don't really know what else could be running, but that also should be off ;p

Re: sioloader

Posted: July 25th, 2019, 7:50 am
by rama3
I'm trying to find the "_sio_control" implementation in the psyq sdk, but so far no luck.
It's kind of important ;p

Edit:
Uh oh, is the implementation using kernel routines?
It's well documented how problematic the kernel is..

If that's indeed the case, the SIO stuff should be rewritten.
And if the kernel code is actually the same / similar to the pad / memcard stuff, expect a huge performance increase ;)

Edit2:
Nocash notes on SIO_BAUD have this to say:
The maximum baud rate may vary depending on the length and quality of the cable, whether and how many inverters and anti-inverters are used (on the mainboard and in external adaptor, and on whether signals are externally converted to +/-12V levels)... anyways, rates up to 9600 baud should be working in all cases.
However, running in no$psx, Wipeout 2097 seems to use about 2 million bauds... although, in older no$psx versions, I believe I did see it using some kind of baudrate detection, where it did try different rates in steps of 200 bauds or so...?

Re: sioloader

Posted: July 25th, 2019, 4:59 pm
by Administrator
Is that because Wipeout used the link cable or because they were using it for some internal development reasons when making the game?

Re: sioloader

Posted: July 25th, 2019, 7:35 pm
by danhans42
Wipeout used a link cable.

It might be worth looking at libcomb which is the PsyQ library for using the 'combat' or link cable as there will be some games that used it.

There are some examples of it in use in the PsyQ samples (look for libcomb).. never really looked at it though so unsure as to how it works with handshaking and such.

Re: sioloader

Posted: July 25th, 2019, 8:26 pm
by Administrator
This enables the serial port

Code: Select all

_sio_control(1, 2, MR_SB_01|MR_CHLEN_8|0x02);
_sio_control(1, 3, 115200);
_sio_control(1, 1, CR_RXEN|CR_RXIEN|CR_TXEN); // serial interrupt

Re: sioloader

Posted: July 25th, 2019, 10:13 pm
by danhans42
Shadow wrote: July 25th, 2019, 8:26 pm This enables the serial port

Code: Select all

_sio_control(1, 2, MR_SB_01|MR_CHLEN_8|0x02);
_sio_control(1, 3, 115200);
_sio_control(1, 1, CR_RXEN|CR_RXIEN|CR_TXEN); // serial interrupt
Thats used everywhere pretty much, from hitserial, to nxflash etc..

i was referring to comb.. if you look in the PsyQ samples folder there is an example.

in the RC9.c file, it shows...

Code: Select all

#define BR 2073600 	/* max:2073600 */
and further down the file...

Code: Select all

_comb_control(1,1,3);	
	_comb_control(1,4,8);
	_comb_control(1,3,2073600);

So obviously there is some more speed to be found. However, handshaking may also be used. The library makes it easier to make a link game, without having to worry about coming up with a protocol. The line seems to indicate there is some sort of speed negionation. Could it be that depending on the cpu load on the psx.. it can slow down to accomodate?

Re: sioloader

Posted: July 26th, 2019, 2:12 am
by danhans42
So,

Have just found the following in the library reference..
Capture.JPG
So trie 518400... works perfectly,

and then tried 1036800.. also works perfectly!!

Re: sioloader

Posted: July 26th, 2019, 2:26 am
by danhans42
[BBvideo=640,480]https://www.youtube.com/watch?v=MZ8b6LGZ-XA[/BBvideo]

Video here.. I used Hitmen/Skywalkers Mahjongg - 1.5Mb (1,456,128 bytes) in the video.

Very fast!

I have attached a PAL ISO.

Also made some changes.. do not see the point in the speed option. If you want to stick at 115,2k you can use always use PSXSERIAL, or the fuller featured LITELOAD. So have removed the speed select options and simplified the code slightly.

Source, compiled EXE are on github.

PAL BIN/CUE is attached.

Enjoy!!

Re: sioloader

Posted: July 26th, 2019, 3:36 am
by rama3
Nice, I knew it :D

The wait time is so-so overall, but then again, very little software would be 1.5 megs, right? :)

Oh by the way, the latest blog post link is slightly wrong, linking to https://github.com/danhans42/sioloader << "er" is bad :p