STM32F746 QSPI: problem with Flash ROM(Winbond W25Q16JV)
I have a problem with QSPI. I try everything, but program doesn't work.
I am using STM32F746 series MCU and I am trying to interface with a quad spi memory from Winbond (W25Q16JV).
I am following the example found in this location:
(I modified some interface like STM32F769⇒STM32F746)
STM32Cube_FW_F7_V1.15.0\STM32Cube_FW_F7_V1.15.0\Projects\STM32F769I_EVAL\Examples\QSPI\QSPI_ReadWrite_DMA\Src
So far, I have been able to enable writing by executing 06h(Write enable) command and pool for the QE bit setting(set to be 1) by using command 31h(Register-2 Write).
This seems to work.
But, I read the QE bit using command 35h(Register-2 Read), QE bit never be 1.
Could someone know this solution? I want to get how to set QE bit setting to be 1.
My enviroments
1) MCU:STM32F746
2) Flash ROM:Winbond (W25Q16JV)
uint8_t ucRegister2;
static void QSPI_QuadEnableCfg( void )
{
QSPI_CommandTypeDef sCommand;
QSPI_AutoPollingTypeDef sConfig;
/* Read Volatile Configuration register --------------------------- */
sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE;
sCommand.Instruction = 0x35/* Status Register-2 Read */;
sCommand.AddressMode = QSPI_ADDRESS_NONE;
sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
sCommand.DataMode = QSPI_DATA_1_LINE;
sCommand.DummyCycles = 0;
sCommand.DdrMode = QSPI_DDR_MODE_DISABLE;
sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
sCommand.NbData = 1;
/* Read Volatile Configuration register --------------------------- */
if (HAL_QSPI_Command(&QSPIHandle, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
if (HAL_QSPI_Receive(&QSPIHandle, &ucRegister2, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
/* Enable write operations */
QSPI_WriteEnable(&QSPIHandle);
sCommand.Instruction = 0x31;
ucWriteData = ucRegister2 | 0x02;/* QUAD ENABLE */
if (HAL_QSPI_Command(&QSPIHandle, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
if (HAL_QSPI_Transmit(&QSPIHandle, &ucWriteData, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
/* 40ms Write Status/Configuration Register Cycle Time */
HAL_Delay( 1000 );
sCommand.Instruction = 0x35/* Status Register-1 Read */;
if (HAL_QSPI_Command(&QSPIHandle, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
if (HAL_QSPI_Receive(&QSPIHandle, &ucRegister2_check, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
}