STM32F7 QSPI Fast Read Quad Problems
I am here again to ask for your help :)
I am using a STM32F767ZI Nucleo Board and connected a Winbond W25Q64JV using the QSPI interface of the MCU. Everything is working fine so far - I can read data in every mode described in the data sheet (even Fast Read Dual I/O), and write data even in the Quad Input Page Program mode.
The only thing not working at the moment is reading data in Fast Read Quad Out or Fast Read Quad Input mode. The data returned by the Winbond memory chip is not correct.
The only thing I do is checking in the registers that the QE bit is set correctly - which it is.
QSPI Init method:
static void MX_QUADSPI_Init(void) {
/* QUADSPI parameter configuration*/
hqspi.Instance = QUADSPI;
// CPU freq: 216
hqspi.Init.ClockPrescaler = 4;
hqspi.Init.FifoThreshold = 4;
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
hqspi.Init.FlashSize = 23;
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_4_CYCLE;
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();
}
}Method for reading:
W25QState W25QFlash::readFromAddr(uint8_t *buffer, uint16_t len, uint32_t addr) {
while (this->isBusy() == W25QState::BUSY) {
osDelay(1);
}
QSPI_CommandTypeDef com;
com.InstructionMode = QSPI_INSTRUCTION_1_LINE; // QSPI_INSTRUCTION_...
com.Instruction = W25Q_FAST_READ_QUAD_IO; // Command
com.AddressSize = QSPI_ADDRESS_24_BITS;
com.AddressMode = QSPI_ADDRESS_4_LINES;
com.Address = addr;
com.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
com.AlternateBytes = QSPI_ALTERNATE_BYTES_NONE;
com.AlternateBytesSize = QSPI_ALTERNATE_BYTES_NONE;
com.DummyCycles = 8;
com.DataMode = QSPI_DATA_4_LINES;
com.NbData = len;
com.DdrMode = QSPI_DDR_MODE_DISABLE;
com.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
com.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
int f = HAL_QSPI_Command(this->handle, &com, HAL_QSPI_TIMEOUT_DEFAULT_VALUE);
if (f != HAL_OK) {
return W25QState::ERR;
}
f = HAL_QSPI_Receive(this->handle, buffer, HAL_QSPI_TIMEOUT_DEFAULT_VALUE);
if (f != HAL_OK) {
return W25QState::ERR;
}
return W25QState::OK;
}I tried changing a lot of settings in the source code (CS high time, dummy cycles, etc.) and in the registers of the flash chip (driver output strength) - but it is still not working.
Does anyone have an idea, what I can try to come closer to a solution?
PS: I double checked that the connection between the MCU and the W25 is correct.
