SDC driver uses reserved CMD for erase Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
heliochronix
Posts: 34
Joined: Thu Aug 31, 2017 6:32 pm
Has thanked: 8 times
Been thanked: 6 times

SDC driver uses reserved CMD for erase  Topic is solved

Postby heliochronix » Wed Aug 19, 2020 7:41 pm

ChibiOS version: stable_20.3.x@13804
Compiler: gcc (GCC) 10.1.0
Platform/board: Custom board implementing STM32F446RE and 4-bit eMMC

Problem:
sdcErase() uses the reserved commands CMD32 and CMD33 according to the STM32F446xx Reference Manual Table 200. This causes the SDIOv1 driver to respond with HAL_FAILURE when calling sdcErase(). When tested using the commands CMD35 and CMD36, sdcErase succeeds.

heliochronix
Posts: 34
Joined: Thu Aug 31, 2017 6:32 pm
Has thanked: 8 times
Been thanked: 6 times

Re: SDC driver uses reserved CMD for erase

Postby heliochronix » Fri Aug 21, 2020 12:06 am

Looking into this more, while CMD35 and CMD36 indicate the command succeeded, they are not drop-in replacements for what CMD32 and CMD33 were. Apparently CMD32/CMD33 erase a range of sectors (blocks), while CMD35/CMD36 erase a range of groups of blocks that could be 16-32 blocks long (so START 1 END 2 would be 64 blocks if it's 32 blocks per group I think?).

This presents a challenge when everything else is in terms of individual blocks. I'm not really sure how this should be fixed besides maybe defining things in terms of block groups. Does anyone have thoughts on this?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: SDC driver uses reserved CMD for erase

Postby Giovanni » Fri Aug 21, 2020 7:43 am

Cards used to support CMD32 and CMD33, this is why it is done this way.

I decided to not fix it for simplicity, the erase function is not really required for FatFS which is our use case.

Giovanni

heliochronix
Posts: 34
Joined: Thu Aug 31, 2017 6:32 pm
Has thanked: 8 times
Been thanked: 6 times

Re: SDC driver uses reserved CMD for erase

Postby heliochronix » Mon Aug 24, 2020 4:59 pm

Ah okay, fair enough.

I guess generally speaking it's not needed. I was trying to test some alternatives to FatFS for more fault tolerant space applications, and some of them expect an erase function. I think I worked around it though by just having the erase functions do a write of 0xFFFFFFFF.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: SDC driver uses reserved CMD for erase

Postby Giovanni » Mon Aug 24, 2020 5:08 pm

heliochronix wrote:Ah okay, fair enough.

I guess generally speaking it's not needed. I was trying to test some alternatives to FatFS for more fault tolerant space applications, and some of them expect an erase function. I think I worked around it though by just having the erase functions do a write of 0xFFFFFFFF.


It is not a problem, cards do their own optimizations internally.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 17 guests