External Flash erase half size
- 3 replies
- 1572 views
Hi
I have develop a custom board wit stm32F799 cpu, there is External Quad flash model MT25QL128ABB1ESE 128Mbit 16Mbyte.
My problem thar the falsh erase only half size, the address in memory map shall be 0x90000000 to 0x90FFFFFF but the erase work until 0x907FFFFF.
I first time wen the flash was clean fro the factory I wrote data in full address range with succes, but in successive tentative of format end write only first hal size is initialize, the address after 0x90800000 remain writed with old data.
This is the simple program for test Flash memory:
#include "main.h"
#include "quadspi.h"
#include "gpio.h"
#include <string.h>
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_QUADSPI_Init();
/* USER CODE BEGIN 2 */
uint8_t buffer_test[MEMORY_SECTOR_SIZE];
uint32_t var = 0;
if (QSPI_ResetChip() != HAL_OK) {
while (1);
}
HAL_Delay(10);
for (var = 0; var < MEMORY_SECTOR_SIZE; var++) {buffer_test[var] = (var & 0xff);}
for (var = 0; var < (SECTORS_COUNT); var++)
{
if (CSP_QSPI_EraseSector(var * MEMORY_SECTOR_SIZE,
(var + 1) * MEMORY_SECTOR_SIZE - 1) != HAL_OK)
{ while (1);} //breakpoint - error detected
//if (CSP_QSPI_WriteMemory(buffer_test, var * MEMORY_SECTOR_SIZE, sizeof(buffer_test)) != HAL_OK)
//{while (1); } //breakpoint - error detected}
}
if (CSP_QSPI_EnableMemoryMappedMode() != HAL_OK) {
while (1);} //breakpoint - error detected
Attach Qspi files:
There is someone that have some ideas?
