MEGA65 / mega65-core

MEGA65 FPGA core
Other
240 stars 85 forks source link

fix: multi-sector sd card write omits last sector #646 #647

Closed ki-bo closed 1 year ago

ki-bo commented 1 year ago

This PR provides a fix for the bugs that appeared at the end of a multi-sector write operation. According to some specifications I consulted, the STOP_TRANS token $FD should not be sent at the beginning of the last sector block, but instead at the end of the whole transmission (without any data following). The problem was that we sent the sector data of the last sector after that token. These bytes were not written anymore, and instead could be interpreted as further SD card command tokens, which depending on the sector data bytes could lead to random behaviour (usually the SD card controller just gets stuck in busy state).