adafruit / adafruit/Adafruit_CircuitPython_SD
Doesn't properly detect capacity >32GB
- Dominant language
- Python
- Stars
- 38
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
I have a card marked "SAMSUNG EVO 64" with the Micro SD XC logo. adafruit_sdcard detects its capacity as 57933824 512-byte blocks (0x3740000 blocks); other systems detect it as 125042688 512-byte blocks (0x7740000). Notice how the top bit is shaved off of the capacity number.
I didn't track it down fully, but it seems that the "v2 card" detection isn't complete; it leaves the card returning a "v1 csd", which is limited to 32GB.
```
card version check r= 1
card version v2
(58 #1) ocr= bytearray(b'@\xff\x80\x00')
(58 #1) ocr= bytearray(b'\xc0\xff\x80\x00')
(58 #2) ocr= bytearray(b'\xc0\xff\x80\x00')
csd version 1
csd 400e00325b590001dcff7f800a4040f1
```
I believe, but didn't verify, that e.g., my work in progess code to use SDIO on STM32F4 Feather is getting a csd version 2, but I didn't determine why/how yet.
This problem also exists in the WIP code for SD-over-SPI in the core, since it copied the "flow" of adafruit_sdcard.
Contributor guide
No contributing guide indexed for this repository
Research direction
Compare the v2 card and CSD handling in adafruit_sdcard with the WIP SD-over-SPI code in the core, starting from the card-version and CSD-version output shown here. Done means a 64GB SDXC card reports its full capacity instead of the truncated block count, with behavior covered by an appropriate regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100