dangiu / PicoMemcard

Emulating PSX Memory Card (or controller) using a Raspberry Pi Pico
GNU General Public License v3.0
562 stars 42 forks source link

Misc Improvements (SD card saving/loading, PS2 compatibility, concurrent syncing, protocol simulation improvements etc) #10

Closed darrena092 closed 2 years ago

darrena092 commented 2 years ago

Hi!

This builds on top of my earlier SD card work and brings with it the following improvements:

Other things are included from my now-closed PS2 compatibility MR, including:

I know this is a big deviation from the original project - and I had initially tried to get this to work with littlefs and internal flash storage but the chip just kept hard faulting and I couldn't figure it out, while it works perfectly with the FatFS SD driver. Which is why I've requested to merge to the PMC+ dev branch.

dangiu commented 2 years ago

Really great work! As already mentioned, I wanted to keep the USB functionality but it's a bit pointless to keep delaying this pull request since it introduces many fixes. I'll merge it and add it back later since this is a development branch is not that big of an issue. The hard faults you were experiencing are likely because you were running two cores while trying to write to flash memory: the code responsible for writing flash memory is automatically copied and executed in RAM but the code executed by Core1 is not. This results in a flash access operation (to fetch instructions for Core1) while is being reprogrammed (by Core0) which causes the hard fault.