Describe the bug
The 45IO27 I/O controller supports multi-sector writes to SD card by using different commands with register $d680. Command $04 is used for the first sector of a sequence, $05 for all following but the last one, and $06 for the last sector. The current implementation is broken in that it does not write the last sector provided with the $06 command byte.
In fact, depending on the data in the SD card sector buffer, the SD controller can even lock up, leading to a stuck busy flag.
The only tool I know which is using this feature is the freezer, writing the machine state to an SD card slot. I guess the last sector simply does not contain relevant information and probably always contains values that do not lead to the stuck SD card busy flag. For that reason, this issue probably wasn't found before. The mega65_ftp tool is not using multi-sector writes, yet (although you can see it was implemented in the past but then deactivated again).
This needs to be fixed in order to get good write speeds which can easily be 10x faster than the regular single sector write operations (command 0x03).
To Reproduce
Use the 4/5/6 commands to write a sequence of sectors to the sd card
Use mega65_ftp over UART to investigate the sector contents (use sector command for this - but don't use the hex $xxx variant which seems to be broken)
All sectors were correctly written except the last one with command byte $06
Expected behavior
The last sector also needs to be written, and the controller shall not lock up in busy state after the $06 command
I am currently testing a fix for this in sdcard.vhdl.
Test Environment
Describe the bug The 45IO27 I/O controller supports multi-sector writes to SD card by using different commands with register $d680. Command $04 is used for the first sector of a sequence, $05 for all following but the last one, and $06 for the last sector. The current implementation is broken in that it does not write the last sector provided with the $06 command byte. In fact, depending on the data in the SD card sector buffer, the SD controller can even lock up, leading to a stuck busy flag.
The only tool I know which is using this feature is the freezer, writing the machine state to an SD card slot. I guess the last sector simply does not contain relevant information and probably always contains values that do not lead to the stuck SD card busy flag. For that reason, this issue probably wasn't found before. The mega65_ftp tool is not using multi-sector writes, yet (although you can see it was implemented in the past but then deactivated again).
This needs to be fixed in order to get good write speeds which can easily be 10x faster than the regular single sector write operations (command 0x03).
To Reproduce
Expected behavior The last sector also needs to be written, and the controller shall not lock up in busy state after the $06 command
I am currently testing a fix for this in sdcard.vhdl.