[TouchGFX] Can not write to External flash using QuasSPI while running with TouchGFX
Hello, I'm using STM32F746NG Discovery Kit.
I'm trying to Write/Read data to/from External Flash using QuadSPI with BSP driver.
Below is my simple function, I don't know why It's can not write to the memory.
I really don't know exactly how to determine the block address and the Read/Write Address, can anyone help me to correct it?
Many thanks,
Hieu
uint8_t * pData = "Hello World";
int i;
if (BSP_QSPI_Erase_Block(0x90000000) == QSPI_OK)
{
if(BSP_QSPI_Write(pData, 0x90000000, 12) == QSPI_OK)
{
i = 1;
}
}static void MX_QUADSPI_Init(void)
{
/* USER CODE BEGIN QUADSPI_Init 0 */
/* USER CODE END QUADSPI_Init 0 */
/* USER CODE BEGIN QUADSPI_Init 1 */
/* USER CODE END QUADSPI_Init 1 */
/* QUADSPI parameter configuration*/
hqspi.Instance = QUADSPI;
// HAL_QSPI_DeInit(&QSPIHandle); //User Code
hqspi.Init.ClockPrescaler = 1;
// hqspi.Init.ClockPrescaler = 2;//User Code
hqspi.Init.FifoThreshold = 4;
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
hqspi.Init.FlashSize = 24;
// QSPIHandle.Init.FlashSize = POSITION_VAL(0x1000000) - 1; //User Code
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_6_CYCLE;
// QSPIHandle.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_2_CYCLE; //User Code
hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
hqspi.Init.FlashID = QSPI_FLASH_ID_1;
hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;
if (HAL_QSPI_Init(&hqspi) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN QUADSPI_Init 2 */
BSP_QSPI_Init();
BSP_QSPI_MemoryMappedMode();
// This line below is disabled to test Write to external flash function
// HAL_NVIC_DisableIRQ(QUADSPI_IRQn);
/* USER CODE END QUADSPI_Init 2 */
}