Skip to content

Commit 6238fc9

Browse files
author
Deepika
authored
Merge pull request ARMmbed#91 from deepikabhavnani/conf_init_freq
Config option for initialization frequency
2 parents 48bdc88 + 0a04507 commit 6238fc9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

SDBlockDevice.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@
159159
#define MBED_CONF_SD_CMD0_IDLE_STATE_RETRIES 5 /*!< Number of retries for sending CMDO */
160160
#endif
161161

162+
#ifndef MBED_CONF_SD_INIT_FREQUENCY
163+
#define MBED_CONF_SD_INIT_FREQUENCY 100000 /*!< Initialization frequency Range (100KHz-400KHz) */
164+
#endif
165+
166+
162167
#define SD_COMMAND_TIMEOUT MBED_CONF_SD_CMD_TIMEOUT
163168
#define SD_CMD0_GO_IDLE_STATE_RETRIES MBED_CONF_SD_CMD0_IDLE_STATE_RETRIES
164169
#define SD_DBG 0 /*!< 1 - Enable debugging */
@@ -251,7 +256,9 @@ SDBlockDevice::SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName c
251256
_card_type = SDCARD_NONE;
252257

253258
// Set default to 100kHz for initialisation and 1MHz for data transfer
254-
_init_sck = 100000;
259+
MBED_STATIC_ASSERT(((MBED_CONF_SD_INIT_FREQUENCY >= 100000) && (MBED_CONF_SD_INIT_FREQUENCY <= 400000)),
260+
"Initialization frequency should be between 100KHz to 400KHz");
261+
_init_sck = MBED_CONF_SD_INIT_FREQUENCY;
255262
_transfer_sck = hz;
256263

257264
// Only HC block size is supported.

config/mbed_lib.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"DEVICE_SPI": 1,
99
"FSFAT_SDCARD_INSTALLED": 1,
1010
"CMD_TIMEOUT": 5000,
11-
"CMD0_IDLE_STATE_RETRIES" : 5
11+
"CMD0_IDLE_STATE_RETRIES": 5,
12+
"SD_INIT_FREQUENCY": 100000
1213
},
1314
"target_overrides": {
1415
"DISCO_F051R8": {

0 commit comments

Comments
 (0)