PS2 [SIO2SD] SD Card Adapter and SD-driver for the PS2 SIO2 interface

Discussion in 'General PS2 Discussion' started by TnA, Apr 19, 2020.

  1. 185
    109
    97
    remlei

    remlei Member

    Joined:
    Mar 6, 2019
    Messages:
    185
    Likes Received:
    109
    Trophy Points:
    97
    yeah sure, but ill take that expense just to buy a lets say a 512GB SD card for like 100 dollars cheaper compared to a microsd card version of it. Not to mention that SD card is usually a UHS-II and also a low latency SD card, I dont know if this matters but that's what I usually have most used on my DSLR.
     
    spademytal and TnA like this.
  2. 1,514
    857
    222
    TnA

    TnA Senior Member

    Joined:
    Jul 1, 2018
    Messages:
    1,514
    Likes Received:
    857
    Trophy Points:
    222
    Gender:
    Male
    Location:
    Germany --> Saxony
    He's already on it!
    He shared a preview (not yet finished) with me yesterday!
     
  3. 33
    60
    12
    Takeshi

    Takeshi Forum Noob

    Joined:
    May 1, 2020
    Messages:
    33
    Likes Received:
    60
    Trophy Points:
    12
    Gender:
    Male
    Occupation:
    electrical engineer
    Location:
    Germany
    Home Page:
    Easy version
    Yes, that's all.

    Developer version
    There will be more LEDs than 2 for debugging. And there is one more thing. An original MC can be connected or is integrated in the design. In this way we can maybe use one port for MC and SD.
    This will NOT be the final version. The final version will be a reduced version of the debugging board.
    Maybe there can be soldered a PIC or another µC to be more flexible in developement.

    Logo
    The logo looks really great, I like it. But I creted the "SD logo" because I don't want to use the original one due tue licence trouble.

    SD vs. microSD
    I think here we have the misunderstanding. If you want BIG cards, SD cards are cheaper, but if you buy low price cards for under 20 € I found cheaper micro SD cards then SD cards with the same size. And the speed is uninteresting because we use SPI and UHC-II is many times faster than the SPI connection. And for the transfer from the PC to SD card I woun't pay more.
    My point was relted to the discussion about south america and so on, where the costs are a big point. If it has to be as cheap as possible then you buy a small card, not with high speed and you want a cheap adapter. This can be best achieved with microSD so microSD is also important. I depends on what you want. And due to this SD and microSD is possible (with one PCB).
     
    sandungas, TnA and Algol like this.
  4. 1,514
    857
    222
    TnA

    TnA Senior Member

    Joined:
    Jul 1, 2018
    Messages:
    1,514
    Likes Received:
    857
    Trophy Points:
    222
    Gender:
    Male
    Location:
    Germany --> Saxony
    I already like your unfinished SD-Slot-Version! The rendering looks awesome! :D

    Well... The thing is... With an SD-slot we can use BOTH with a simple 10ct adapter, which is often included with Micro-SD-Cards!

    Yes, I really have those countries in mind, where people don't throw away 32GB-Cards... ;)
     
  5. 42
    126
    52
    wisi

    wisi Member

    Joined:
    Aug 26, 2018
    Messages:
    42
    Likes Received:
    126
    Trophy Points:
    52
    Gender:
    Male
    I was thinking of something else also - of one cool feature for developers - IOP debugging serial port - we can route a simple UART port through the SPI, using the MCU and leave connection points for the UART on the PCB, or even leave a position for some small SMD connector. Then developer who want, can connect to it an external UART-USB adapter or RS232 level shifter and use that to communicate with their code on the IOP side.

    The SIO2SD driver will just have some exports like getByte(), sendByte(), setRxtIntrHandler() and another IOP IRX (by the developer) will use them to communicate with the PC side. The only problem is that there is no way to tell the PS2 that it has data to receive from the SIO2 SPI, so the way to work-around that could be to use the controller port 2 interrupt line (which is otherwise unused). This does involve a few connections, but the idea is that devs who already have USB-UART adapters and want to communicate with the IOP side, but lack a UART-SPI adapter can use the MCU in this as one.

    Of course another way is to have the PS2 poll the SPI on regular intervals, but this seems like a bad idea... but may work well enough.

    Now, in theory a 'bigger' MCU can be used (say the PIC32MX series), one that supports USB and remove the need for an external USB-UART adapter too. And then even more features can be implemented. In theory, if one such MCU is fast-enough, it can implement MagicGate... though we enter dangerous territory there. But maybe it can work if the users install the firmware themselves.
    I haven't tested if such an MCU can deal with MG stuff.. hmm
    And these MCUs are not that much more expensive. So this has to be considered too.

    I remember that was your idea, @TnA, and sometime ago I said it couldn't work, as an MCU would be too slow, but back then I tested with a 8-bit MCU at 20MHz instruction clock and no actual MG - I only tried returning fixed data...
    I can't remember if the timing was really that strict that it required responding in a very short time frame.
    Also there is the matter, that I don't know if the way the MC is authenticated is fully known...


    And BTW, @TnA well, actually all the SD cards I have are one 2GB and one 4GB and no microSD :D but this is just me.
     
    Takeshi, TnA, Algol and 1 other person like this.
  6. 7,557
    7,034
    797
    sandungas

    sandungas Moderator Developer

    Joined:
    Dec 31, 2014
    Messages:
    7,557
    Likes Received:
    7,034
    Trophy Points:
    797
    Location:
    Babylon 20xxE series
    Btw, when i was looking at your photo i realized you can create a small visual effect, im not sure how good is going to look but i think is going to work

    The idea is to paint a white band in all the border of the PCB exactly under the "SONY" name (you know, in between the 2 leds), this is going to improve the readability of the "SONY" name from the plastic shell
    Im going to use this photo as example:
    [​IMG]

    The borders of the "SONY" name are actually a bit more blue than the rest of the shell.. but still doesnt have good readability because visually is blue + green (from the PCB)
    But if you add white under it is going to be more notable the different blue tones :)

    I know... this is just a visual detail and doesnt matters, but im mentioning it just incase because i think is going to look better
    And btw... for a check (to see if the visual effect works and if is worthy to do it)... you can achieve this same visual effect just by sticking a piece of white electrical tape in the border of the PCB :)
     
    TnA, Algol, jolek and 1 other person like this.
  7. 33
    60
    12
    Takeshi

    Takeshi Forum Noob

    Joined:
    May 1, 2020
    Messages:
    33
    Likes Received:
    60
    Trophy Points:
    12
    Gender:
    Male
    Occupation:
    electrical engineer
    Location:
    Germany
    Home Page:
    Of course it is only a visual effect, but the look is also important and I think it's a greatgood idea. I'll give it a try!

    Edit: Oh ... I see, there is the next licence problem =/
     
    TnA likes this.
  8. 244
    439
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    244
    Likes Received:
    439
    Trophy Points:
    122
    Gender:
    Male
    The SD logo is trademarked.
    SD2SNES had to change name due to usage of the SD logo.
     
    jolek, TnA and Algol like this.
  9. 33
    60
    12
    Takeshi

    Takeshi Forum Noob

    Joined:
    May 1, 2020
    Messages:
    33
    Likes Received:
    60
    Trophy Points:
    12
    Gender:
    Male
    Occupation:
    electrical engineer
    Location:
    Germany
    Home Page:
    They had to change the NAME? We can't use the name "SIO2SD" without the SD logo in the writing?
     
    TnA and Algol like this.
  10. 7,557
    7,034
    797
    sandungas

    sandungas Moderator Developer

    Joined:
    Dec 31, 2014
    Messages:
    7,557
    Likes Received:
    7,034
    Trophy Points:
    797
    Location:
    Babylon 20xxE series
    I just meant adding a white band, exactly like this, is going to improve the readability of the "SONY" logo but the band itself is just a white area
    [​IMG]


    *With the SD logo is a different matter yeah, if you are going to do it in vectors just change it a bit
    I suggest to remove that "cut" in north-east corner of the "D"... and change a bit the curves of both the "S" and the "D"... it doesnt needs to be change a lot, just a bit
     
    Last edited: May 22, 2020
    TnA and Algol like this.
  11. 244
    439
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    244
    Likes Received:
    439
    Trophy Points:
    122
    Gender:
    Male
    The project name is sd2snes. However, kirkzz is selling it as the FXPAK.
     
    TnA likes this.
  12. 7,557
    7,034
    797
    sandungas

    sandungas Moderator Developer

    Joined:
    Dec 31, 2014
    Messages:
    7,557
    Likes Received:
    7,034
    Trophy Points:
    797
    Location:
    Babylon 20xxE series
    Just another small detail... because i have the image opened in photoshop... in this image there are 2 suggestions, both are intended to help you a bit to align the SD card when you are inserting it
    When the memory card is connected to the PS3 the microSD slot if "flipped" so you dont know exactly where is located, this couple of suggestions could help a bit
    [​IMG]

    The small white square i added is intended to have a symmetrical PCB at that border (in other words, make the PCB a bit bigger to achieve that symmetry)... so distance A and B at a side are the same on the other side

    And i created 2 small lines located exactly at the borders of the microSD card... by removing a bit of the white ink (from the white band i painted in my previous post)
     
    TnA and Algol like this.
  13. 1,514
    857
    222
    TnA

    TnA Senior Member

    Joined:
    Jul 1, 2018
    Messages:
    1,514
    Likes Received:
    857
    Trophy Points:
    222
    Gender:
    Male
    Location:
    Germany --> Saxony
    What about the "white band" only being as "wide" as the one above it where "Trisaster.de" is written?

    I like these little "spare outs", where we can see where the Slot/Micro-SD-Card is.


    Edit: I forgot that @Takeshi moved the LEDs to the "wide PCB side" on the SD-Layout, so the "complete Band" you made, might even work out better there!
     
    Last edited: May 23, 2020
    sandungas likes this.
  14. 33
    60
    12
    Takeshi

    Takeshi Forum Noob

    Joined:
    May 1, 2020
    Messages:
    33
    Likes Received:
    60
    Trophy Points:
    12
    Gender:
    Male
    Occupation:
    electrical engineer
    Location:
    Germany
    Home Page:
    I tried the white band under the SONY writing but it dowsn't improve the readability.

    The SD card is centered, but the slot isn't symmetrical so the boards gets assymetrical too. I fixed this.
    And I added a marking for the SD card, even if it's not difficult to insert the card as the card is centered.

    [​IMG]
     
    sandungas, TnA, Algol and 1 other person like this.
  15. 1,227
    784
    222
    Fin9ersMcGee

    Fin9ersMcGee Moderator

    Joined:
    Mar 19, 2018
    Messages:
    1,227
    Likes Received:
    784
    Trophy Points:
    222
    Occupation:
    Musician
    Location:
    UK
    Looking good, everyone.
    This project has come very far in a very short space of time. My congratulate to all involved.
    I've yet to buy some resistors but really eager to start testing this for research and adding it to a tutorial I'm currently working on.

    If there are any spare prototypes that I could possibly purchase, that'd be grand :)
     
    TnA likes this.
  16. 1,514
    857
    222
    TnA

    TnA Senior Member

    Joined:
    Jul 1, 2018
    Messages:
    1,514
    Likes Received:
    857
    Trophy Points:
    222
    Gender:
    Male
    Location:
    Germany --> Saxony
    THX!

    Regarding the debug-version: If an RS232 would be used, it could be on either side but I think little "pins" for UART would be preferable.


    @Fin9ersMcGee
    There are some BLANK PCBs of the 1st batch available, but I suppose you live quite far away!
    You might be better of creating some PCBs yourself (files are available to make them exactly as on the pictures)!
     
  17. 1,227
    784
    222
    Fin9ersMcGee

    Fin9ersMcGee Moderator

    Joined:
    Mar 19, 2018
    Messages:
    1,227
    Likes Received:
    784
    Trophy Points:
    222
    Occupation:
    Musician
    Location:
    UK
    I guess that depends on where the test pcbs are located. I'm in UK
     
    TnA likes this.
  18. 33
    60
    12
    Takeshi

    Takeshi Forum Noob

    Joined:
    May 1, 2020
    Messages:
    33
    Likes Received:
    60
    Trophy Points:
    12
    Gender:
    Male
    Occupation:
    electrical engineer
    Location:
    Germany
    Home Page:
    I am located in Germany, the shipping costs should be 1,70 €.
     
    TnA likes this.
  19. 1,514
    857
    222
    TnA

    TnA Senior Member

    Joined:
    Jul 1, 2018
    Messages:
    1,514
    Likes Received:
    857
    Trophy Points:
    222
    Gender:
    Male
    Location:
    Germany --> Saxony
    Well, that's not so far...

    Give it a few days and we have the first people which can provide some tests HOPEFULLY!

    I assume most get it next week.

    Beside @Takeshi, 1 who connected him to the project (he saw it on psxtools.de and shared it on trisaster.de) already got his Adapter (or PCB?).

    Some more adapters and BLANK PCBs are already on their way to various people (in Europe)!
    Let's hope they work as intended and that this first test-batch will help to push the project.

    Let's hope it doesn't take too long!
     
    Fin9ersMcGee likes this.
  20. 90
    313
    82
    Maximus32

    Maximus32 Developer

    Joined:
    Sep 10, 2019
    Messages:
    90
    Likes Received:
    313
    Trophy Points:
    82
    Gender:
    Male
    @Takeshi thank you for the prototype. I just received it in the mail and did some tests. I added speed testing to the test app so we can see what speed the driver currently has. Here's my output:
    Code:
    ps2client -h 192.168.1.10 execee host:test_bdm.elf
    loadelf: fname host:test_bdm.elf secname all
    Input ELF format filename = host:test_bdm.elf
    0 00100000 0003b0a8 ....
    1 0019394c 00000004 .
    Loaded, host:test_bdm.elf
    start address 0x1000d8
    gp address 00000000
    BDM (Block Device Manager) test application
    Loading iomanX and fileXio IOP modules
    fileXio: fileXio RPC Server v1.00
    Copyright (c) 2003 adresd
    Loading BDM IOP modules
    Block Device Manager (BDM) v1.1
    BDM: connecting fs MBR
    BDM: BDM event thread running
    FreeUsbd v.0.1.2
    USBMASS: USB MASS Driver v1.1
    sdCard v1.1
     ERR: CMD 0  RSP 3F  -> CMD 0 doesn't receive response soon on some cards, so this error is normal, if there are no errors after this point. 
     done 2 passes 
     Detected SD ver.2+ card 
     SD ver.2+ Block address 
     Card successfully initialized. 
     CSD reg: 
     CSD ver 2 BDM: connecting device sdc0p0
    Init done
    BDM: connecting device sdc0p1
    BDM: sdc0p0 mounted to MBR
    BDM VFAT driver (FAT12/16/32) v1.1
    BDM: connecting fs vfat
    VFAT: Fat type 32 Id FAT32   
    BDM: sdc0p1 mounted to vfat
    USBMASS: connect: devId=1
    USBMASS: Vendor: SanDisk
    USBMASS: Product: Ultra
    USBMASS: Revision: 1.00
    USBMASS: 60063743 512-byte logical blocks: (30754MB / 29327MiB)
    BDM: connecting device usb0p0
    BDM: connecting device usb0p1
    BDM: usb0p0 mounted to MBR
    VFAT: Fat type 32 Id FAT32   
    BDM: usb0p1 mounted to vfat
    Wait 5s for drives
    
    Listing files in mass0:
    d------rwx Thu Aug 10 19:43:20 2017      0 ART
    d------rwx Sun Jun 24 12:02:58 2018      0 .Trash-1000
    -------rwx Sun Sep 10 11:10:46 2017 33554432 zero.bin
    d------rwx Sat Sep  3 11:00:30 2016      0 CD
    d------rwx Sun Jul 23 12:37:00 2017      0 CFG
    d------rwx Sat Jul 22 13:06:36 2017      0 CFG-DEV
    d------rwx Thu Jul 27 16:41:16 2017      0 CHT
    d------rwx Sun Jun 24 12:55:20 2018      0 DVD
    d------rwx Wed Aug  9 20:06:52 2017      0 THM
    d------rwx Wed Jun 20 19:08:20 2018      0 VMC
    -------rwx Thu Jun 28 17:38:36 2018 886805 OPNPS2LD.ELF
    -------rwx Mon Jun 25 17:26:54 2018 1082357 OPNPS2LD-0.9.3+.1083-Beta-9ce6dea.ELF
    d------rwx Sat Apr 25 04:24:44 2020      0 APPS
    d------rwx Sat Apr 25 04:24:44 2020      0 LNG
    
    Starting speed test on mass0:zero.bin...
    Read 1024KiB in 5847ms, blocksize=64, speed=179KB/s
    Read 1024KiB in 4068ms, blocksize=128, speed=257KB/s
    Read 1024KiB in 2440ms, blocksize=256, speed=429KB/s
    Read 1024KiB in 1620ms, blocksize=512, speed=647KB/s
    Read 1024KiB in 1233ms, blocksize=1024, speed=850KB/s
    Read 1024KiB in 1039ms, blocksize=2048, speed=1009KB/s
    Read 1024KiB in 941ms, blocksize=4096, speed=1114KB/s
    Read 1024KiB in 888ms, blocksize=8192, speed=1180KB/s
    Read 1024KiB in 860ms, blocksize=16384, speed=1219KB/s
    Read 1024KiB in 851ms, blocksize=32768, speed=1232KB/s
    
    Listing files in mass1:
    d------rwx Sat Aug 31 09:46:16 2019      0 PS2LINK
    d------rwx Thu Oct 10 20:58:32 2019      0 OTHER
    d------rwx Sat Aug 31 17:52:30 2019      0 THM
    d------rwx Sat Aug 31 17:52:30 2019      0 CFG-DEV
    d------rwx Sat Aug 31 05:58:20 2019      0 .Trash-1000
    d------rwx Sat Aug 31 17:52:30 2019      0 LNG
    d------rwx Sun Oct 27 21:56:58 2019      0 ART
    d------rwx Sat Aug 31 17:52:30 2019      0 VMC
    d------rwx Sat Aug 31 17:52:30 2019      0 CHT
    d------rwx Sat Aug 31 17:52:30 2019      0 APPS
    d------rwx Sat Aug 31 17:52:30 2019      0 CD
    d------rwx Tue Sep 10 20:20:58 2019      0 DVD
    -------rwx Tue Dec 24 22:32:00 1996 262160 Mega Man 2 (USA).nes
    -------rwx Tue Dec 24 22:32:00 1996 262160 Super Mario Bros. 2 (USA).nes
    -------rwx Sun Oct 27 21:35:08 2019     82 hello.txt
    -------rwx Thu Feb  6 05:50:10 2020    622 conf_opl.cfg
    -------rwx Thu Feb  6 05:50:10 2020    252 conf_network.cfg
    d------rwx Thu Jan  9 16:05:52 2020      0 [190413]FMCB-1966-bin
    d------rwx Sun Jan 12 06:01:54 2020      0 RETROARCH
    -------rwx Wed Feb 26 05:34:08 2020  10977 prboom.cfg
    -------rwx Thu Feb 20 19:57:32 2020 143312 prboom.wad
    -------rwx Thu Feb 20 20:18:08 2020 4196020 Doom1.wad
    -------rwx Sat May 23 12:51:30 2020 10485760 zero.bin
    
    Starting speed test on mass1:zero.bin...
    Read 1024KiB in 6947ms, blocksize=64, speed=150KB/s
    Read 1024KiB in 4957ms, blocksize=128, speed=211KB/s
    Read 1024KiB in 3389ms, blocksize=256, speed=309KB/s
    Read 1024KiB in 2403ms, blocksize=512, speed=436KB/s
    Read 1024KiB in 2119ms, blocksize=1024, speed=494KB/s
    Read 1024KiB in 1870ms, blocksize=2048, speed=560KB/s
    Read 1024KiB in 1858ms, blocksize=4096, speed=564KB/s
    Read 1024KiB in 1739ms, blocksize=8192, speed=602KB/s
    Read 1024KiB in 1679ms, blocksize=16384, speed=624KB/s
    Read 1024KiB in 1679ms, blocksize=32768, speed=624KB/s
    Done. Exit in 5s
    
    Video of it here:


    Download here:
    https://gitlab.com/ps2max/testing/test_bdm/-/jobs/564839794/artifacts/browse

    So around 1200KB/s for sio2sd, and around 620KB/s for my usb drive. There must be something wrong with the usb drive/driver, becouse it's supposed to be around 900KB/s to 1000KB/s.

    I'm trying to work on the drivers, and have made a little overview so you all understand what parts are needed for this to work:
    bdm_sio2sd.png
    The current SIO2SD_BD driver actually has a builtin version of SIO2MAN. But I think it should go back into SIO2MAN if we want it to play nice with other SIO2 transfers. SIO2D is a sony driver that is supposed to detect insertion/removal of devices, but we don't have an open-source ps2sdk version of it. Perhaps we'll need this in the future.

    One thing slowing the transfer down seems to be bit-inversion for all transmissions. @wisi do you know why this is needed? Is it a hardware limitation? Perhaps we can double-buffer the transfers, and invert 1 block while the other is being transferred. That should speed up the total transfer.
    I'm also looking at the SD part of the implementation. @wisi did you make this yourself or is it a copy from somewhere? I was thinking to replace it with an open-source well-proven SD-to-SPI driver from for instance the arduino community. For instance this one: https://github.com/Krasutski/sdcard_spi_driver
    That way we can focus on only the SPI part of the driver for speed and stability, without worrying about the SD part.
     
    e.v.o, sandungas, spademytal and 3 others like this.

Share This Page