]> granicus.if.org Git - esp-idf/commitdiff
SPI flash: Block erase size 64KB not 32KB
authorAngus Gratton <angus@espressif.com>
Fri, 9 Dec 2016 03:18:58 +0000 (14:18 +1100)
committerAngus Gratton <angus@espressif.com>
Fri, 9 Dec 2016 03:18:58 +0000 (14:18 +1100)
Reverts changes made in 9f9d92b2dfed7e8a2e1ecbcf0bd8e4139abd5372

components/esp32/include/rom/spi_flash.h
components/esp32/include/soc/spi_reg.h
components/spi_flash/flash_ops.c

index 32f018477a605195506f26b98ceb33c54ed8a4bc..1e4dddeeb92a6d2cb0c955ba0280c775eefb1562 100644 (file)
@@ -384,8 +384,8 @@ SpiFlashOpResult SPIParamCfg(uint32_t deviceId, uint32_t chip_size, uint32_t blo
 SpiFlashOpResult SPIEraseChip(void);
 
 /**
-  * @brief Erase a 32KB block of flash
-  *        Uses SPI flash command 52h.
+  * @brief Erase a 64KB block of flash
+  *        Uses SPI flash command D8H.
   *        Please do not call this function in SDK.
   *
   * @param  uint32_t block_num : Which block to erase.
@@ -398,6 +398,7 @@ SpiFlashOpResult SPIEraseBlock(uint32_t block_num);
 
 /**
   * @brief Erase a sector of flash.
+  *        Uses SPI flash command 20H.
   *        Please do not call this function in SDK.
   *
   * @param  uint32_t sector_num : Which sector to erase.
@@ -412,12 +413,6 @@ SpiFlashOpResult SPIEraseSector(uint32_t sector_num);
   * @brief Erase some sectors.
   *        Please do not call this function in SDK.
   *
-  * @note If calling this function, first set
-  *       g_rom_flashchip.block_size = 32768; or call SPIParamCfg()
-  *       with appropriate parameters. This is due to a ROM bug, the
-  *       block erase command in use is a 32KB erase but after reset
-  *       the block_size field is incorrectly set to 65536.
-  *
   * @param  uint32_t start_addr : Start addr to erase, should be sector aligned.
   *
   * @param  uint32_t area_len : Length to erase, should be sector aligned.
index 34f2f24e1c9c8e03eb9878e8a70116058d7acf72..d1eeedb9f0532dd8ef86dc089bfbe0e3d3f3fbcc 100644 (file)
 #define SPI_FLASH_PP_V  0x1\r
 #define SPI_FLASH_PP_S  25\r
 /* SPI_FLASH_SE : R/W ;bitpos:[24] ;default: 1'b0 ; */\r
-/*description: Sector erase enable(4KB). Sector erase operation will be triggered\r
+/*description: Sector erase enable. A 4KB sector is erased via SPI command 20H. Sector erase operation will be triggered\r
  when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/\r
 #define SPI_FLASH_SE  (BIT(24))\r
 #define SPI_FLASH_SE_M  (BIT(24))\r
 #define SPI_FLASH_SE_V  0x1\r
 #define SPI_FLASH_SE_S  24\r
 /* SPI_FLASH_BE : R/W ;bitpos:[23] ;default: 1'b0 ; */\r
-/*description: Block erase enable(32KB) .  Block erase operation will be triggered\r
+/*description: Block erase enable. A 64KB block is erased via SPI command D8H.  Block erase operation will be triggered\r
  when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/\r
 #define SPI_FLASH_BE  (BIT(23))\r
 #define SPI_FLASH_BE_M  (BIT(23))\r
index db3ac042f0bf5c35b5d018d2bbd6d23ac19dc309..7f6fd70db02d668c9420f6769e91bc0be20cd874 100644 (file)
@@ -32,7 +32,7 @@
 #include "cache_utils.h"
 
 /* bytes erased by SPIEraseBlock() ROM function */
-#define BLOCK_ERASE_SIZE 32768
+#define BLOCK_ERASE_SIZE 65536
 
 #if CONFIG_SPI_FLASH_ENABLE_COUNTERS
 static const char* TAG = "spi_flash";