2025-09-18 5:30 AM - last edited on 2025-09-19 6:16 AM by Andrew Neil
Post edited by ST moderator to be inline with the community rules especially with the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code.
i am trying to read the jedec id from the MT25TL512HBA8E12-0AAT TR using stm32h750xbh6 with qspi
i configured qspi using mx like follows:
hqspi.Instance = QUADSPI;
hqspi.Init.ClockPrescaler = 1;
hqspi.Init.FifoThreshold = 4;
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
hqspi.Init.FlashSize = 25;
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_6_CYCLE;
hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
hqspi.Init.DualFlash = QSPI_DUALFLASH_ENABLE;
i configured the clock using rcc enabled hse and lse and finally giving the clock for qspi around 50mhz
the function im using to read is the below one
static HAL_StatusTypeDef QSPI_ReadID_3B(QSPI_HandleTypeDef *hq, uint8_t id[3]) {
QSPI_CommandTypeDef c = {0};
c.InstructionMode = QSPI_INSTRUCTION_1_LINE;
c.Instruction = 0x9F; // READ JEDEC ID (1-0-1)
c.AddressMode = QSPI_ADDRESS_NONE;
c.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
c.DataMode = QSPI_DATA_1_LINE;
c.DummyCycles = 0;
c.NbData = 3;
c.DdrMode = QSPI_DDR_MODE_DISABLE;
c.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
c.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
HAL_StatusTypeDef st = HAL_QSPI_Command(hq, &c, HAL_QSPI_TIMEOUT_DEFAULT_VALUE);
if (st != HAL_OK) return st;
return HAL_QSPI_Receive(hq, id, HAL_QSPI_TIMEOUT_DEFAULT_VALUE);
}
its always returning only 0s
what are the issues.
what we have to keep in mind when we are doing this reading.
is there any proper procedure to follow
2025-09-19 3:33 AM - edited 2025-09-19 3:35 AM
Hello @srikanthkomati ;
Could you please share the memory datasheet?
Could you verify the QSPI signals (CLK, CS, IO0,....) are correctly connected. Also, ensure the flash memory is powered.
Also, I recommend you referring to AN5050 precisely "Table 7. STM32CubeMX - Configuration of OCTOSPI signals and mode" and "Table 8. STM32CubeMX - Configuration of OCTOSPI parameters" to check the memory configuration.
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-09-19 4:57 AM
hi @KDJEM.1
I am attaching the data sheet and I double checked the connections and they are as per the schematics of my board
and flash memory is also powered up
if I am giving the command-address-data as 4-0-4 in the command structure its returning 255s for 3 bytes
but not able to read the correct data.
thank you .
2025-09-19 6:09 AM
Show a wiring diagram and pin initialization.
In Dual mode you'd typically read 6 bytes as the data will be interleaved between the two die, 3 from each. Each pair of bytes should be the same.
Reading zero suggests the interface is wrong.
Suggest getting a scope or analyzer on the pins.