2021-09-16 12:30 AM
I have few confusions:
while(1){
//command scommand to read manufacturer id
sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE;
sCommand.Instruction = read_identification_id;
//sCommand.AddressSize = QSPI_ADDRESS_24_BITS;
//sCommand.AddressMode = QSPI_ADDRESS_4_LINES;
sCommand.AddressMode = QSPI_ADDRESS_NONE;
//sCommand.Address = address;
sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
//sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_4_LINES;
//sCommand.AlternateBytes = alternate_byte;
//sCommand.AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS;
//sCommand.DataMode = QSPI_DATA_1_LINE;
//sCommand.NbData = 0;
//sCommand.DataMode = QSPI_DATA_NONE;
//sCommand.DummyCycles = 4;
sCommand.DummyCycles = 0;
sCommand.DdrMode = QSPI_DDR_MODE_DISABLE;
sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
// Send Read Manufacture ID/Device ID Command to QPSI Line
if(HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) == HAL_OK)
{
// Receive Manufacture ID/Device ID from QSPI Line
if( HAL_QSPI_Receive(&hqspi, rx_byte, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) == HAL_OK)
{
printf("Device ID received\n");
}
HAL_Delay(5000);
}
I have sent the command to read the id of the flash(GD25Q32C) I am using and after that I want to check the response from the flash chip.
Now the main problem is If I don't have sCommand.DataMode, then I can see that the Chip Select goes low, clock is generated and the data is passing through IO lines. But as soon as I enable sCommand.DataMode, chips select is always high,clock is not generated anymore and there is not any data on the IO lines. Could anybody let me know why is it behaving like that ?
Now the last question, What is sCommand.DataMode used for? I believe it is used to indicate how many bytes of data do you intend to read after sending some read instructions. Or is there any other reason that it is used for.
This is the first time I am interfacing QUADSPI with stm32.
I am using stm32h747bi chip and I am using GD25Q32C flash chip. Is there any example project (or pseudocode) related to interface this flash chip with stm32h7