Closed darrena092 closed 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.
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:
pio_sm_drain_tx_fifo
to clear the FIFO forsmDatWriter
. This has the benefit of also clearing the OSR, where the last TX byte from the last transaction will otherwise be hiding, ready to be sent out on the DAT line the second a new transaction starts!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.