From 705462d3219ac325fe4ca4188e03d390b19a26d0 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sun, 13 Aug 2017 17:45:18 +0200 Subject: [PATCH] Correct calculation of the erase sector size The specification states that the real value is obtained by increasing by one the value extracted from the csd register. --- SDBlockDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDBlockDevice.cpp b/SDBlockDevice.cpp index 3dc70cc128..58af23186d 100644 --- a/SDBlockDevice.cpp +++ b/SDBlockDevice.cpp @@ -941,7 +941,7 @@ uint32_t SDBlockDevice::_sd_sectors() { _erase_size = BLOCK_SIZE_HC; } else { // ERASE_BLK_EN = 1: Erase in multiple of SECTOR_SIZE supported - _erase_size = ext_bits(csd, 45, 39); + _erase_size = BLOCK_SIZE_HC * (ext_bits(csd, 45, 39) + 1); } break;