Skip to content

Commit

Permalink
boot: Increase SD response timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsc96 committed Jul 5, 2024
1 parent 967a903 commit b498f74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions sw/boot/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,22 @@ int main() {
printf("[FLASH] Write buffer at 0x%x of length %d to target %d, sector %d ... ", img_base, len,
target, sector);
switch (target) {
case 1:
case 1: {
ret = flash_spi_sdcard(core_freq, rtc_freq, img_base, sector, len);
case 2:
break;
}
case 2: {
ret = flash_spi_s25fs512s(core_freq, rtc_freq, img_base, sector, len);
case 3:
break;
}
case 3: {
ret = flash_i2c_24fc1025(core_freq, img_base, sector, len);
default:
break;
}
default: {
ret = -1;
break;
}
}
if (ret)
printf("ERROR (%d)\r\n", ret);
Expand Down
4 changes: 2 additions & 2 deletions sw/include/hal/spi_sdcard.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ typedef struct {
static const uint64_t __spi_sdcard_init_clock = 200000;

// How many cycles to wait for a non-yielding R1b response
static const uint64_t __spi_sdcard_r1b_timeout = 10000;
static const uint64_t __spi_sdcard_r1b_timeout = 100000;

// How many cycles to wait for another data block
static const uint64_t __spi_sdcard_data_timeout = 10000;
static const uint64_t __spi_sdcard_data_timeout = 100000;

// Sets up only this device; other functions may be used with own setup if requirements are met.
// This assumes the power-up period of 1ms will be elapsed *before* issuing further commands.
Expand Down

0 comments on commit b498f74

Please sign in to comment.