Skip to content

Commit 0962358

Browse files
committed
cc3200: Align SD card driver with new SDK release(1.1.0).
1 parent 1080802 commit 0962358

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

cc3200/fatfs/src/drivers/sd_diskio.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ DRESULT sd_disk_read (BYTE* pBuffer, DWORD ulSectorNumber, UINT SectorCount) {
360360
pBuffer += 4;
361361
}
362362
CardSendCmd(CMD_STOP_TRANS, 0);
363+
// Wait for the command to complete
364+
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
363365
Res = RES_OK;
364366
}
365367
}
@@ -430,6 +432,8 @@ DRESULT sd_disk_write (const BYTE* pBuffer, DWORD ulSectorNumber, UINT SectorCou
430432
// Wait for transfer complete
431433
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
432434
CardSendCmd(CMD_STOP_TRANS, 0);
435+
// Wait for the command to complete
436+
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
433437
Res = RES_OK;
434438
}
435439
}

cc3200/mods/pybsd.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,17 @@ STATIC mp_obj_t pybsd_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_
131131
pin_verify_af (pybsd_obj.af_cmd);
132132

133133
// configure the sdhost pins
134+
// TODO: all pin configs must go through pin_config()
134135
MAP_PinTypeSDHost(pybsd_obj.pin_d0->pin_num, pybsd_obj.af_d0);
135136
MAP_PinTypeSDHost(pybsd_obj.pin_clk->pin_num, pybsd_obj.af_clk);
136137
MAP_PinDirModeSet(pybsd_obj.pin_clk->pin_num, PIN_DIR_MODE_OUT);
137138
MAP_PinTypeSDHost(pybsd_obj.pin_cmd->pin_num, pybsd_obj.af_cmd);
138139

140+
// enable pull-ups on data and cmd
141+
// TODO: all pin configs must go through pin_config()
142+
MAP_PinConfigSet(pybsd_obj.pin_d0->pin_num, PIN_STRENGTH_4MA, PIN_TYPE_STD_PU);
143+
MAP_PinConfigSet(pybsd_obj.pin_cmd->pin_num, PIN_STRENGTH_4MA, PIN_TYPE_STD_PU);
144+
139145
// card detect pin was provided
140146
if (n_args == 7) {
141147
pybsd_obj.pin_sd_detect = (pin_obj_t *)pin_find(args[6]);
@@ -152,6 +158,8 @@ STATIC mp_obj_t pybsd_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_
152158
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, mpexception_num_type_invalid_arguments));
153159
}
154160

161+
// TODO: register with the sleep module!!
162+
155163
pybsd_obj.base.type = &pyb_sd_type;
156164
return &pybsd_obj;
157165
}

0 commit comments

Comments
 (0)