In hal_sdc.c, sdc_init, there is an incorrect OCR word sent in ACMD41:
ocr = 0xC0100000U;
while the correct value according to SD card specification is:
ocr = 0x50FF8000U;
That is, busy=0, hc=1, full performance, full voltage range. There are two major results of this change:
- sending empty voltage range is invalid for initialization, as it only queries for a supported voltage range without initializing the card (according to spec, but seems to work on most cards anyway)
- there is 2-4x performance speedup because full performance bit is set (currently it is 0 which means power save)
Incorrect OCR sent during SD card init Topic is solved
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Incorrect OCR sent during SD card init
Hi,
Interesting, have you tested this on multiple cards? I am not the author of that part so I am not very informed.
Giovanni
Interesting, have you tested this on multiple cards? I am not the author of that part so I am not very informed.
Giovanni
Re: Incorrect OCR sent during SD card init
I tested on 2 SanDisk cards and 1 noname. All got significant performance boost during write (I did not test read speed).
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: Incorrect OCR sent during SD card init
I confirm the performance speedup (F4 and F7, samsung SHDC card)
Alexandre
Alexandre
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Incorrect OCR sent during SD card init
Question, the complete code is:
Is the constant for non-v20 cards correct? my idea is to make both constants configurable, does it make sense?
Giovanni
Code: Select all
if ((sdcp->cardmode & SDC_MODE_CARDTYPE_MASK) == SDC_MODE_CARDTYPE_SDV20) {
ocr = 0xC0100000U;
}
else {
ocr = 0x80100000U;
}
Is the constant for non-v20 cards correct? my idea is to make both constants configurable, does it make sense?
Giovanni
Re: Incorrect OCR sent during SD card init
OCR for non-v20 cards needs to be changed as well. Probably only HC bit needs to be off, when compared to v20 OCR, but I did not test it.
The only configurable options that would make sense are power save vs full performance and voltage range.
The only configurable options that would make sense are power save vs full performance and voltage range.
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Incorrect OCR sent during SD card init
Fixed as bug #826.
I added two configuration options that allow to override the default initialization values. The default for v20 cards is the suggested one.
Giovanni
I added two configuration options that allow to override the default initialization values. The default for v20 cards is the suggested one.
Giovanni
Who is online
Users browsing this forum: No registered users and 17 guests