Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random write errors -SDIO SD card error on line 413, error code 2 #34

Open
z80micro-mc opened this issue May 4, 2023 · 11 comments
Open

Comments

@z80micro-mc
Copy link

I am getting occasional write errors when I copy a number of files.

log.txt

[10ms] Platform: BlueSCSI Pico
[10ms] FW Version: 2023.04.10-dev Apr 30 2023 15:09:12
Flash chip size: 2048 kB

=== SD Card Info ===
SD card detected, FAT32 volume size: 7615 MB
SD Name: ASTC, MID: 0xFE, OID: 0x34 0x56

=== Global Config ===
Reading configuration from bluescsi.ini
Active configuration (using system preset "Generic"):
-- SelectionDelay: 150
-- EnableSCSI2 is off
-- Parity is disabled

=== Finding images in / ===
== Opening /HD10_512.hda for ID: 1 LUN: 0
---- Image ready
== Opening /HD20_512.hda for ID: 2 LUN: 0
---- Image ready

=== ROM Drive ===
Platform supports ROM drive up to 1692 kB
---- ROM drive SCSI id 1 is already in use, not enabling

=== Configured SCSI Devices ===

  • ID: 1, BlockSize: 512, Type: Fixed, Quirks: None, Size: 31980kB
  • ID: 2, BlockSize: 512, Type: Fixed, Quirks: None, Size: 63960kB

Initialization complete!
SDIO SD card error on line 413, error code 2
SDIO SD card error on line 413, error code 2
SDIO SD card error on line 413, error code 2
SDIO SD card error on line 413, error code 2
SDIO SD card error on line 413, error code 2
SdioCard::stopTransmission() timeout
SD card write failed: 0x00
SDIO SD card error on line 413, error code 2
SDIO SD card error on line 413, error code 2
SdioCard::stopTransmission() timeout
SD card write failed: 0x00
SDIO SD card error on line 413, error code 2

Thoughts / ideas please

Peter

@Konf
Copy link

Konf commented May 4, 2023

Hi! I had such errors with old and slow SD card. Replaced it with new a one and no such errors appear anymore.

@z80micro-mc
Copy link
Author

Konf,

Thanks for your input.

I am currently using an 8 GB, C10, U1 Kingston micro SD rated at 80 MB/s. I obtain ~ 180 KB/s read or write via DOS. The SD is nearly 200 times faster than the transfer speed. On a large number of writes (copy all the files on a disk to another disk) I intermittently get write errors ~ every once every 5-10 minutes, at the current transfer rates I estimate ~ 1 failure in ~ 50,000 write sector operations.

To my reasoning is that is rather indicative of a timing race condition. A faster SD may reduce the likelyhood of errors but I think that there is a fundamental timing race condition. I would be tempted to slow the SD right down to make the condition worse to investigate further.

To date I have only ever seen, errors on write and repeating the same write subsequently succeeds. I have never, seen a failure on read. The write failure gets mapped to a general failure reported by DOS, if one selects the 'r' repeat operation it proceeds without error until the next random event.

Peter

@z80micro-mc
Copy link
Author

Eric,

If it would be helpful, I could put a logic analyser on the SCSI bus. However, as the event is so infrequent, it would be helpful if there is a spare gpio bit which you could toggle on error. I could then trigger the analyser on the bit change.

The analyser is capturing all the time and can be set to stop on trigger event, well 25% buffer before or after the event selectable.

Peter

@erichelgeson
Copy link
Contributor

No free pins but you can re-purpose SDBG, S1, or S2 since they are normally unused. Interested in any results you get.

@z80micro-mc
Copy link
Author

z80micro-mc commented May 6, 2023 via email

@erichelgeson
Copy link
Contributor

erichelgeson commented May 6, 2023

I had to use the SDBG (pin 16) - it will go high on an SD error. If you'd like a pulse (how long) or delay or something let me know.
https://github.com/BlueSCSI/BlueSCSI-v2/actions/runs/4902832099 <-- binaries at the bottom (includes troy's patch, and the typo fixed for ParityEnable)
227baab <-- change

@z80micro-mc
Copy link
Author

z80micro-mc commented May 6, 2023 via email

@erichelgeson
Copy link
Contributor

This build will clear the assertion on next success read or write - https://github.com/BlueSCSI/BlueSCSI-v2/actions/runs/4902950485

@z80micro-mc
Copy link
Author

z80micro-mc commented May 6, 2023 via email

@erichelgeson
Copy link
Contributor

Please test with the latest release and report back, there were various fixes related to SD cards.

@erichelgeson
Copy link
Contributor

Hi, any update or anything for us to follow up on? We've seen this a few times and usually a full overwrite format with SD formatter as mentioned takes care of it, or cleaning the contacts on the SD card (can get dirty!), or trying another SD card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants