Home | Forums | What's new | Resources | |
Saturn serial loader |
Murzik - Oct 1, 2022 |
Murzik | Oct 1, 2022 | |||||||
Update: v0.124 -LSHIFT/RSHIFT to switch baudrate. Default is 209954 (for NTSC Sega Saturn) v0.123 -Experimental. Placed sci buffer and sci isr into sh2 cache. v0.122 - Few cleanups v0.121 - Changed baud rate to 211000 bps (NTSC Sega Saturn). Works much faster now Connect Master TX, Master RX, GND from Saturn Communication Connector to RX, TX, GND of any USB UART TTL adapter (if it have jumper to select 3.3v/5v mode - use 5v mode) connected to your PC, or use max232 to connect Saturn MTX, MRX, GND directly to your PC hardware RS232 port. Then run sloader at your Saturn and use provided sloader.py python script on your PC. Exact measured baudrate is euqal to 209954 bps on NTSC Sega Saturn. Examples of usage:
Code:
If you prefer to use other way to communicate with serial loader, proto is:
Code:
Example of speed (so, 3 sec to backup internal saves and same for loading and running sloader binary, and 12 sec to backup 256kb cartridge): I measured real baudrate frequency with freq meter, so, calculations fixed and now equal to real speeds. And here is real baudrates for NTSC Sega Saturn (it is test branch of serial loader, where possible to switch baudrates speed): Below is outdated info for history purposes It using sh2 master SCI in uart mode at 31250 bps. To upload your program, use included python script serial.py serial.py Or use any other way, the protocol format is simple uint8 command // "r" for upload when in "r" mode, Serial loader awaits: uint32 address // upload and start address for your program uint32 size // size of your program then upload program byte by byte, when its done uploading it will be run by serial loader Hi I decided to try out saturn serial port. I printed great connector created by our forum user zone66x... And it is fit communication port ideally. I wrote simple test program for saturn to test communication and it works fine. I think, i will add few useful functions (uploading/running binary and backup interal backup ram) and then upload it here. ps. sh2 is very picky about clocks, when it came to uart and to be true, using internal clocks to drive, make it almost useless as it is not something you may call fast. But.. it works. |
tzmwx | Oct 2, 2022 | |||
My cheap idea |
braza | Oct 3, 2022 | |||
Is possible dump sega saturn cdrom to sdcard? |
Knight0fDragon | Oct 3, 2022 | |||||
possible yes, but these numbers and a 2X drive, it will take some time. |
slinga | Oct 4, 2022 | |||
Does something have to be running on the Saturn first? I see the zip contains an iso and a bin file. |
Knight0fDragon | Oct 13, 2022 | |||
Would you be so kind to calculate the clock when Baud is set to 1, 2 , and 3? I have these cheap PL2303's I want to use, but I can't get the baud rate to match an acceptable rate on them. 209,954 seems to be a little too much for these devices to handle. Using the formula from Hitachi, I get 112,109.375 when setting baud to 1, which almost works but produces a lot of errors along the way. |
Murzik | Oct 13, 2022 | |||
Just quick calculations, sorry didnt tested with freq meter (but results are close to datasheet examples): For NTSC sh2 clock equal to 26874122 N = 0; n = 1; baudrate = 52489 N = 0; n = 2; baudrate = 13122 N = 0; n = 3; baudrate = 3281 for example, if sh2 clock is 28636363 and N=126, n=2, calcualted baudrate = 110, same as in datasheet table Btw, for cp210x based usb uart ttl adapters there is ic manufacturer software tool to "tune" baudrates - link..., didnt checked pl2303 (btw have few somewhere, if ill find one ill try to test), but maybe there is something similiar to check/tune what baudrate it really sets. |
Knight0fDragon | Oct 13, 2022 | |||
Awesome. If you are using windows with PL2303, keep in mind that the newest drivers do not work with clones. If your PL2303 is a clone, use these drivers. |
Knight0fDragon | Oct 13, 2022 | |||
ok, so I was wondering why your numbers seem off. You were providing the numbers based on clock division (0 is clock / 4, 1 is clock / 16, 2 is clock / 64, 3 is clock / 256) I was more interested in the BRR, so the larger N. for 1, I calculate it at around 104,977. Your mention of clock cycle now brings up a good point. The CPU also changes speed when your video is 320 or 352. Do you happen to have the clock speeds for the wide screen modes as well? |
Murzik | Oct 14, 2022 | ||||||||
Those already in Serial loader, N switched by lshift/rshift, thought, you checked it. Serial loader merged in SDLoader use 28Mhz instead of 26Mhz as reference clock for it internal baudrate generator, so, yes, calculations use 28 mhz correctly (checked with freqmeter). Anyway, attaching sorted baudrates list for 26Mhz and 28Mhz for all "n" and "N" combinations For example, top10 list:
Code:
I may suggest you, just for testing, to try common 19200 with "baudrate=19086 freq=26874122 n=0 N=10" |
Knight0fDragon | Oct 14, 2022 | ||||
Sorry, I am working outside of your serial project, was more going off of your notes and trying to document number accuracy since you have the tools to do so. Turns out though that PL2303 does support the higher speeds, you just need the latest driver that it can accept. I attached that driver to this post. BTW, are you planning on open sourcing the SDLoader from the controller? Would love to include that work into my project and create controller to serial adapters. |
Murzik | Oct 14, 2022 | |||||||||
For sure. Right now it need huge code refactoring and cleanup as it is mix of assembly and c, with addition of some post compiling/prelinking objects patching to #s to further optimize critical code for saving few cycles. And as it is constantly worked on, code get new features and so on. So, i think i will first prepare it for opening, and last but not least, will add much more comments.
That would be cool. Interesting to know more about your project. It is same project that utilize saturn serial to rj45 3d printed connector? May you show some preview of how it looks? |
Knight0fDragon | Oct 14, 2022 | |||||
I am replacing the netlink code on the netlink games. We will be able to play them without the need of the dial up modem. I will upload some pictures later on tonight of my prototypes. |