BSP_QSPI_Read on STM32H757I-EVAL from MT25TL01G misses first 6 bytes
I'm trying to do a simple read/write on the MT25TL01G flash that's present on the STM32H757I-EVAL evaluation board. However, when I'm using BSP_QSPI_Read, I'm missing the first 6 bytes of data. Reading via memory mapped mode works as expected.
Here's my initialization code. The QSPI clock should be running at 200MHz, according to CubeMX.
/* QUADSPI parameter configuration*/
hqspi.Instance = QUADSPI;
hqspi.Init.ClockPrescaler = 3;
hqspi.Init.FifoThreshold = 1;
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
hqspi.Init.FlashSize = 26;
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_4_CYCLE;
hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
hqspi.Init.DualFlash = QSPI_DUALFLASH_ENABLE;
if (HAL_QSPI_Init(&hqspi) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN QUADSPI_Init 2 */
BSP_QSPI_DeInit(0);
BSP_QSPI_Init_t init ;
init.InterfaceMode = MT25TL01G_QPI_MODE;
init.TransferRate = MT25TL01G_DTR_TRANSFER;
init.DualFlashMode = MT25TL01G_DUALFLASH_ENABLE;
if(BSP_QSPI_Init(0,&init) != BSP_ERROR_NONE)
{
Error_Handler();
}
if(BSP_QSPI_EnableMemoryMappedMode(0) != BSP_ERROR_NONE)
{
Error_Handler();
}
HAL_NVIC_DisableIRQ(QUADSPI_IRQn);
/* USER CODE END QUADSPI_Init 2 */Here's my code for read/write:
uint32_t address = 0;
char * writeData = "123456Hello world!";
char data[50] = {};
size_t size = strlen(writeData);
char qspi_data[50] = {};
memcpy(qspi_data, (void*)(QSPI_BASE_ADDRESS + address), size);
printf("Read via MemMap: %s\r\n", qspi_data); // works as expected (if it has been written already)
// Disable MemoryMappedMode
BSP_QSPI_DisableMemoryMappedMode(0);
// Erase sector
BSP_QSPI_EraseBlock(0, address, BSP_QSPI_ERASE_8K);
// Write data
BSP_QSPI_Write(0, (uint8_t*)writeData, address, size);
// Read data
BSP_QSPI_Read(0, (uint8_t*)data, address, size)
printf("Read %s from QSPI\r\n", data); // prints: "Hello world!" instead of "123456Hello world!"All the BSP_QSPI_* function calls return without error.
What am I doing wrong?
