Skip to content

Commit

Permalink
Merge branch 'main' (README.md update and fixes) into development
Browse files Browse the repository at this point in the history
  • Loading branch information
dangiu committed Aug 1, 2022
2 parents 8ba2451 + 6704032 commit ef362f1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 20 deletions.
54 changes: 36 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
# PicoMemcard
PicoMemcard allows you to build your own supercharged PSX Memory Card that can be connected to your computer via USB in order to transfer saves directly to/from your PSX. You can use it to repurpose broken/counterfit Memory Cards creating a better one using only a Raspberry Pi Pico.
PicoMemcard allows you to build your own supercharged PSX Memory Card that can be connected to your computer via USB in order to transfer saves directly to/from your PSX. You can use it to repurpose broken/counterfeit Memory Cards creating a better one using only a Raspberry Pi Pico.

## Features
* Able to simulate faithfully PSX Memory Card
* USB conection to import/export saves
* Able to faithfully simulate PSX Memory Card
* USB connection to import/export saves
* Allows to copy saves to/from any other memory card (using original PSX file manager)
* Allows to play burned CDs (thanks to [FreePSXBoot])
* Cheaper than an original memory card

## Bills of materials
* **Raspberry Pi Pico** (around ~5$)
## Bill of materials
* **Raspberry Pi Pico** (around $5)
* One of:
* Custom PicoMemcard PCB (*currently work in progress*)
* Broken/Counterfit/Original PSX Memory Card (counterfit ones can be found on Aliexpress for less than 1$)
* Custom [PicoMemcard PCB](#picomemcard-pcb)
* Broken/Counterfeit/Original PSX Memory Card (counterfeit ones can be found on AliExpress for around $2-3)
* PSX/PS2 Controller Cable
* Nothing, if you are a mad man and feel like soldering cables directly to your PSX (would not recommend).

Basically anything that will allow you to interface with the memory card slot pins will do. If you have a broken contoller you can cut of the cable and use that since controllers and memory cards share the same bus. Of course, plugging your memory card into the controller slot will prevent you from using 2 controllers at the same time.
Basically anything that will allow you to interface with the memory card slot pins will do. If you have a broken contoller you can cut off the cable and use that since controllers and memory cards share the same bus. Of course, plugging your memory card into the controller slot will prevent you from using 2 controllers at the same time.

In total building a PicoMemcard wil cost you less than buying an used original Memory Card!
In total building a PicoMemcard wil cost you less than buying a used original Memory Card!

## Video
[![PicoMemcard](https://img.youtube.com/vi/Sie0kzmnJJw/0.jpg)](https://www.youtube.com/watch?v=Sie0kzmnJJw)

## PicoMemcard PCB
<img src="./docs/PCBs.jpg" alt="Custom PCBs" width="800">

This is the custom PCB designed and manufactured specifically for this application. It makes it much easier to build PicoMemcard since you don't need to cut up another memory card and all the soldering pads are easily accessible. Still, you will need a soldering iron to assemble the device.

The Raspberry Pi Pico must sit flush on top of the PCB, so use the soldering pads instead of the through-holes (see right side of the picture). Personally, I used a couple of instant-glue drops to fix it in place and then soldered the different pads.

I've designed the PCB with a bit of future-proofeness in mind. Although not yet implemented, it supports the installation of an SD SPI expansion board to allow the Pico to read/write data to a microSD card and store multiple memory card images (see [Future Development](#future-development) section).

Since I've already received so many requests and I'm starting to lose track of them, I created a Google Form where you can [request one]. It also allows me to understand how many PCBs I should manufacture. If you do request one, make sure to specify a way for me to contact you back in order to get shipping information and stuff.

Before filling the form, keep in mind that the cheapest way to build PicoMemcard is using a counterfeit memory card. The PCB will cost between €3-8 (depends on how many units are manufactured in a single order so it changes from batch to batch), plus shipping costs (around €1-2 for EU, €2-3 for the rest of the world expect Australia and a few places which costs around €4).

<img src="./docs/PCB-Demo.jpg" alt="Custom PCB in use" width="800">

In the picture above you can see the PCB plugged into a PSOne. I'm already working on a 3d-printed enclosure instead of using paper sheets as a spacer.

## Wiring
The wiriting diagram below shows how to wire the Pico and a counterfit memory card from Aliexpress. For the other cases (wiring directly to the PSX or using a controller cable) the pins on the Pico are the same, the pinout of the PSX/controller can be found on [psx-spx]. The image shows the bottom side of the memory card with the cover removed.
The wiring diagram below shows how to wire the Pico and a counterfeit memory card. For the other cases (wiring directly to the PSX or using a controller cable) the pins on the Pico are the same, the pinout of the PSX/controller can be found on [psx-spx]. The image shows the bottom side of the memory card with the cover removed.

<img src="./docs/wiring_bg.svg" alt="Wiring Diagram" width="800">

The dashed line on the PCB of the memory card is where you should cut a groove deep enough to disconnect the original controller from the traces. The yellow squares above the line indicate where you should scrape away the proctective film in order to expose the copper traces and solder the wires onto them.
The dashed line on the PCB of the memory card is where you should cut a groove deep enough to disconnect the original circuitry from the traces. The yellow squares above the line indicate where you should scrape away the protective film in order to expose the copper traces and solder the wires onto them.

Finally the area at the bottom of the memory card is where you can cut a hole to feed the wires through connecting them to the Pico.

Expand All @@ -45,30 +62,30 @@ As of the current release, uploading data to PicoMemcard requires some precise s
* The image must be 128KB (131072 bytes) in size which is precisely the size of an original Memory Card.
* After the image has been uploaded, the device **must be safely ejected** in order for the data to be actually imported correctly. This is a limitation of the current implementation (see [Design](#design) section).

Inside `docs/images` you can find a two memory card images. One has a couple of saves on it so you can test if everything works correctly, the other is completely empty.
Inside `docs/images` you can find two memory card images. One has a couple of saves on it so you can test if everything works correctly, the other is completely empty.

**ATTENTION:**
I would recommend to never plug PicoMemcard both into the PC (via USB) and the PSX at the same time! Otherwise the 5V provided by USB would end up on the 3.3V rail of the PSX. I'm not really sure if this could cause actual damage but I would avoid risking it.

If you really need to have the Pico plugged into both the USB and PSX (e.g. for debugging purposes), disconnect the 3.3V line from the VBUS pin. In this way you can power on the Pico using a simple USB phone charger or by plugging it into your PC.

## Future Development
As of now PicoMemcard is still in very early development stages and only tested it on a PSOne Pal model (SCPH-102, bios version 4.4). It **should** work on any PSX model. If you want to try it on your PSX any feedback would be much appreciated.
As of now PicoMemcard is still in very early development stages and only tested on a PSOne Pal model (SCPH-102, bios version 4.4). It **should** work on any PSX model. If you want to try it on your PSX any feedback would be much appreciated.

I've tried to make the project as accessible as possible by using the least amount of hardware but this comes with a few limitations, in particular regarding the flash storage of the Pico. In the future I want to add the possibility to use a microSD card by adding a microSD SPI module, this would improve on the following:
* The very limited storage preventing from having multiple memory card images at the same time and being able to switch them using a button on the Pico.
* The complex codebase using multiple filesystems (see [Design](#design) section).
* The brief downtime periods PicoMemcard may have while writing new data to flash memory, appearing as if the Memory Card was briefly disconnected.
* The need to perform save ejection as a way to signal the Pico to transfer the data from the virtual FAT disk to the flash filesystem (see [Design](#design) section).
* The need to perform safe ejection as a way to signal the Pico to transfer the data from the virtual FAT disk to the flash filesystem (see [Design](#design) section).

## Design
For people interested in underestanding how PicoMemcard works I provide a more extensive explanation in [this post].
For people interested in understanding how PicoMemcard works I provide a more extensive explanation in [this post].

## Thanks To
* [psx-spx] and Martin "NO$PSX" Korth - Playstation Specifications and documented Memory Card protocol and filesystem.
* [Andrew J. McCubbin] - Additional information about Memory Card and Controller comunication with PSX.
* [psx-spx] and Martin "NO$PSX" Korth - PlayStation Specifications and documented Memory Card protocol and filesystem.
* [Andrew J. McCubbin] - Additional information about Memory Card and Controller communication with PSX.
* [littlefs] - Filesystem designed to work on NOR flash used by many microcontrollers, including the Raspberry Pi Pico.
* [ChaN FatFS] - FAT filesystem implementation for embeeded devices.
* [ChaN FatFS] - FAT filesystem implementation for embedded devices.
* [Scoppy] - Use your Raspberry Pi Pico as an oscilloscope, very cheap and accurate. Without this I would have not been able to debug many issues.
* [PulseView] - Used to import, visualize and manipulate the data from Scoppy on a PC.

Expand All @@ -81,6 +98,7 @@ For people interested in underestanding how PicoMemcard works I provide a more e
[PulseView]: https://sigrok.org/wiki/PulseView
[release]: https://github.com/dangiu/PicoMemcard/releases/latest
[this post]: https://dangiu.github.io/2022/05/13/picomemcard.html
[request one]: https://forms.gle/f6XHtz6W5fn5qDZV7


<!--
Expand Down
Binary file added docs/PCB-Demo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/PCBs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/lfs_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ const struct lfs_config LFS_CFG = {
.block_cycles = 500,
};

__attribute__((section(".lfs"))) const uint8_t LFS_SPACE[LFS_BLOCK_COUNT * LFS_BLOCK_SIZE]; // space allocated to LFS
__attribute__((section(".lfs"))) const uint8_t LFS_SPACE[LFS_BLOCK_COUNT * LFS_BLOCK_SIZE]; // space allocated to LFS
2 changes: 1 addition & 1 deletion src/ram_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ uint32_t RAM_disk_import_lfs_memcard() {

/* Check stored memory card size */
if(LFS_ERR_OK == lfs_mount(&lfs, &LFS_CFG)) {
if(LFS_ERR_OK == lfs_file_open(&lfs, &memcard_lfs, MEMCARD_FILE_NAME, LFS_O_RDWR | LFS_O_CREAT)) {
if(LFS_ERR_OK == lfs_file_open(&lfs, &memcard_lfs, MEMCARD_FILE_NAME, LFS_O_RDWR)) {
lfs_soff_t memcard_lfs_size = lfs_file_size(&lfs, &memcard_lfs);
if(memcard_lfs_size > 0 && memcard_lfs_size <= MC_SIZE) {

Expand Down

0 comments on commit ef362f1

Please sign in to comment.