Skip to content

Commit e9be571

Browse files
committed
Debug
1 parent 64c260a commit e9be571

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stm32/littlefs_shim.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ uint32_t first_sector_offset = 0;
66

77
int sd_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer,
88
lfs_size_t size) {
9-
uint32_t timeout_ms = 2000U;
10-
uint32_t block_addr = block;
9+
uint32_t timeout_ms = 50U;
10+
uint32_t block_addr = block + first_sector_offset;
1111
uint32_t num_blocks = (size + c->block_size - 1) / c->block_size;
1212
HAL_StatusTypeDef hal =
1313
HAL_SD_ReadBlocks(lfs_shim_hsd, (uint8_t *)buffer, block_addr, num_blocks, timeout_ms);
@@ -28,8 +28,8 @@ int sd_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *
2828

2929
int sd_write(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer,
3030
lfs_size_t size) {
31-
uint32_t timeout_ms = 2000U;
32-
uint32_t block_addr = block;
31+
uint32_t timeout_ms = 50U;
32+
uint32_t block_addr = block + first_sector_offset;
3333
uint32_t num_blocks = (size + c->block_size - 1) / c->block_size;
3434
HAL_StatusTypeDef hal =
3535
HAL_SD_WriteBlocks(lfs_shim_hsd, (uint8_t *)buffer, block_addr, num_blocks, timeout_ms);

0 commit comments

Comments
 (0)