|
Forum Index : Microcontroller and PC projects : SD card warning
| Author | Message | ||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6071 |
A warning about using SD cards continuous. After 1 weekend running the ChessClient program (playing continuous chess games) the board this morning looked like this (check the horse). The photo is rotated (for some reason on the PC it was correct, before upload). ![]() The Chessclient program uses this code, to read the chess piece tiles from SD card. ![]() In other words, for each piece on the board, each move, each game, it opens a file, reads it, and uses the data. For 1000 games with average 53 moves, and showing 64 pieces (empty fields also) those are roughly 3.4 million file opens, reads, and close. And the files on SD card are corrupted. I repowered the pico, and still the problem existed. Then I have copied new tile files from the PC to the pico (MMCC) and now the problem is gone. The SD card tile files where actually bad. So files actually can get corrupt from just reading them too often. Maybe it is a bad SD card. But this is just a warning for others, who may use similar technique for other applications. Just reading a file, does not guarantee it is never corrupted. Volhout P.S. found on V60302b0 on PicoMiteVGA (RP2040) reference design 2, board revision V1.7. Edited 2026-08-31 17:32 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 850 |
Hi Harm, That's very surprising, I was always under the impression that reading there was basically no limit, it was only the writing, that potentially degraded the silicon! (in the 100s of thousands, depending on how good the wear leveling is) it would be interesting to see if it happens again. Maybe worth looking at a more efficient way of loading the pieces image, maybe only once per move, or cache them & once per game, I realise memory space is a problem, though not so much with the client. Regards Kevin Edited 2026-08-31 18:53 by Bleep |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 9098 |
What I'm amazed at is that all the corruption appears to be so localized. It's possible that the previous format operation didn't manage to map out all the bad blocks and you are seeing file corruption because of that. There's an interesting reply on This Quora page which, IMHO. points to possible charge loss in the cells as being the problem. This is worse on high capacity cards but will happen on all cards eventually. Mick Zilog Inside! nascom.info for Nascom & Gemini |
||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 2071 |
Maybe the horse just attracted some fleas I'll see myself out |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6071 |
Hi Mick, It si not very localized. If you look at the photo, you see that the king graphics (harder to see, at edge of the photo) also shows similar artefacts. Not sure how the memory cells are geographically located inside the flash chip inside the SD card, but the file size is 256 bytes (containing 200 bytes of data). And there are 2 files corrupted (horse and king). Volhout Edited 2026-08-31 21:57 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 9098 |
You can't tell where the data is on flash. Bad blocks are mapped out in a table and clean ones mapped in to replace them, but any block can be anywhere, I believe. ValiDrive can test the card and show where bad or non-existent blocks are. It's a useful thing to run over a new card to show whether you are getting what you paid for! Mick Zilog Inside! nascom.info for Nascom & Gemini |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4376 |
Will such corruption apply (eventually) to USB memory sticks too? John |
||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 2071 |
It doesn't sound right to me; here we are, debating CRC vs Checksum for serial comms and yet we can get garbage from a SD card? |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |