Page 1 of 1

joymon - R/W/X-capable monitor over the controller port

Posted: December 6th, 2022, 1:52 am
by socram
So debugging some quirky behaviour in tonyhax, and the classic process of copying the executable to a USB, then loading onto a PS2, running uLaunchELF, then copying onto the PS1 memory card, then booting the console, was getting old really fast.

A sensible person would've probably used something like a PS1 fat with a SIOCONS cable, to boot executables straight into the console's RAM. But I have no fat PS1, and I'm no sensible person :D

So first idea was "hey, maybe I could do something with an Arduino". Did it, much like what ackerman did (except I was unaware of his project), and then "hey, how far can I simplify this?". And this is what I ended up with.
20221205_152045.jpg
That ominous "M" (for "monitor") is a small, 1KB monitor code written in pure assembly. It that talks over the controller ports, and it needs no Arduino or any special part. All you need is a regular, off-the-shelf 3V USB-UART adapter, a controller cable, and a singular 1N4148 diode.
bitmap.png
Since it can be launched from either a CD-R or FreePSXBoot, this project is thus fully capable of working on either a fat PS1, a slim PSone, and highly likely also every PS2 console. It works also at a very snappy 115200 bps, so you get a total of 11.5KB/s of throughput for loading binaries on the console's RAM.
terminal.png
The computer-side part of things is a very small Python library which is capable of reading, writing and executing from arbitrary memory locations, and load and execute PS-X EXE files. The protocol is really simple, so it can be implemented also in any other language you can prefer.

Available at: https://github.com/socram8888/joymon

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 6th, 2022, 4:40 am
by nocash
Nice simple beautiful design. I guess a lot of people are much too focused on transferring the Data through the DATA pin, and won't consider to use any of the other pins instead.

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 6th, 2022, 9:16 am
by socram
Available here: https://github.com/socram8888/joymon. It's still quite rough, but does work.

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 6th, 2022, 9:35 am
by Shendo
This is awesome. While it's not that hard to add a serial port to PSOne, not having to open it makes this so much more awesome. Great job :clap

If you attach ESP8266 to it you could even get PSOne to Internet through the controller port :D

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 6th, 2022, 10:20 am
by socram
Shendo wrote: December 6th, 2022, 9:35 am While it's not that hard to add a serial port to PSOne, not having to open it makes this so much more awesome.
I know, but I didn't want to drill my console to put a serial connector! :D

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 6th, 2022, 10:52 am
by Shadow
socram wrote: December 6th, 2022, 10:20 am
Shendo wrote: December 6th, 2022, 9:35 am While it's not that hard to add a serial port to PSOne, not having to open it makes this so much more awesome.
I know, but I didn't want to drill my console to put a serial connector! :D
No need to drill anything. Just use Bluetooth or WiFi RS232.

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 6th, 2022, 11:40 am
by Xavi92
Awesome job, socram! There is definitely some interesting, unexploited potential to the controller ports.

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 6th, 2022, 4:33 pm
by masterg0r0
That looks epic. I'm going to try this out for myself.

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 9th, 2022, 12:12 am
by ackerman
Congratulations socram on the project.
Regarding the serial usb converter, is a specific model of FTDI chip required, with line inversion, or similar, or does any of them work?

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 10th, 2022, 4:59 am
by masterg0r0
Do fake FT232RL chips work? It's just that I've got a few of them.

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 11th, 2022, 6:55 am
by socram
ackerman wrote: December 9th, 2022, 12:12 am Congratulations socram on the project.
Regarding the serial usb converter, is a specific model of FTDI chip required, with line inversion, or similar, or does any of them work?
No line inversion required - regular UART with 3.3V for logical 1 and 0V for logical 0. The outputs are actually inverted but that's something that's taken care of in software by the monitor software by re-inverting them before sending/after receiving via the I/O pins.
masterg0r0 wrote: December 10th, 2022, 4:59 am Do fake FT232RL chips work? It's just that I've got a few of them.
Should do, yes. I'm using the cheapest USB UART I could get based on a CH340G.

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 11th, 2022, 10:34 am
by alexfree
socram wrote: December 11th, 2022, 6:55 am
ackerman wrote: December 9th, 2022, 12:12 am Congratulations socram on the project.
Regarding the serial usb converter, is a specific model of FTDI chip required, with line inversion, or similar, or does any of them work?
No line inversion required - regular UART with 3.3V for logical 1 and 0V for logical 0. The outputs are actually inverted but that's something that's taken care of in software by the monitor software by re-inverting them before sending/after receiving via the I/O pins.
masterg0r0 wrote: December 10th, 2022, 4:59 am Do fake FT232RL chips work? It's just that I've got a few of them.
Should do, yes. I'm using the cheapest USB UART I could get based on a CH340G.
I read that the fake chips don't work well on Linux, only on Windows. Is this the case with Joymon?

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 11th, 2022, 9:28 pm
by socram
alexfree wrote: December 11th, 2022, 10:34 am I read that the fake chips don't work well on Linux, only on Windows. Is this the case with Joymon?
I've not tried that particular case. As long as it can send standard, non-inverted data on the data pins it should work with joymon.

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 12th, 2022, 2:38 am
by nocash
socram wrote: December 6th, 2022, 1:52 amIt works also at a very snappy 115200 bps
Did you try faster transfer rates, too? Ackerman mentioned reaching "71680 bps" on the SPI data lone (=144360 bps on the SPI clock line). So the upper limit might be near 144360 bps, or perhaps faster when removing the 100pF capacitors in the console.

Re: joymon - R/W/X-capable monitor over the controller port

Posted: December 12th, 2022, 10:23 am
by socram
nocash wrote: December 12th, 2022, 2:38 am Did you try faster transfer rates, too? Ackerman mentioned reaching "71680 bps" on the SPI data lone (=144360 bps on the SPI clock line). So the upper limit might be near 144360 bps, or perhaps faster when removing the 100pF capacitors in the console.
I really did not try any other speed, other than 115200.

I settled from the very beginning on 115200 because:
  • It's a very commonly used speed which every USB UART device supports
  • Leaving enough leeway for processing - 115200bps leaves 294 instructions between each byte for further processing, like checksumming transmissions (which I am implementing in another branch)
  • It's reasonably fast
I did not have a scope to poke on the data lines, when I did this so I didn't want to push the data speeds too high either.