cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 HAL QSPI delayed clocks

ndsmith34
Associate II

I'm reading data from an FPGA over QSPI. I'm attempting to read 256 bytes at a time. However, when I read the data the QSPI clock decides to take a long pause before continuing. I get an initial burst of 74 clock pulses, then 56 bursts of 8 clock pulses, each with a long pause preceding them.

0693W00000NrMdrQAF.pngI don't understand why the long delay exists in the pulse train.

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;
  hqspi.Init.ClockPrescaler = 4;
  hqspi.Init.FifoThreshold = 31;
  hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
  hqspi.Init.FlashSize = 7;	//31
  hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_1_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();
  }
  /* USER CODE BEGIN QUADSPI_Init 2 */
 
  /* USER CODE END QUADSPI_Init 2 */
 
}

void ReadSampleData(uint8_t address, uint8_t *data, uint32_t length)
{
	uint8_t tmpQspiAddr;
	uint32_t tmpQspiNbData;
	QSPI_CommandTypeDef QSPICmdRead;
 
	tmpQspiAddr = 0b0;
	tmpQspiNbData 	= (length);
 
	//Instruction phase
	QSPICmdRead.Instruction			= 0x02;
	QSPICmdRead.InstructionMode 	= QSPI_INSTRUCTION_4_LINES;
	//Address phase
	QSPICmdRead.Address				= tmpQspiAddr;
	QSPICmdRead.AddressMode			= QSPI_ADDRESS_4_LINES;
	QSPICmdRead.AddressSize			= QSPI_ADDRESS_8_BITS;
	//Alternate phase
	QSPICmdRead.AlternateBytes		= 0xFF;
	QSPICmdRead.AlternateBytesSize	= QSPI_ALTERNATE_BYTES_16_BITS;
	QSPICmdRead.AlternateByteMode	= QSPI_ALTERNATE_BYTES_4_LINES;
	//Dummy phase
	QSPICmdRead.DummyCycles			= 4;
	//Data phase
	QSPICmdRead.DataMode			= QSPI_DATA_4_LINES;
	QSPICmdRead.NbData				= (0xFF+1);// tmpQspiNbData;
	//Other configuration
	QSPICmdRead.DdrMode				= QSPI_DDR_MODE_DISABLE;
	QSPICmdRead.SIOOMode			= QSPI_SIOO_INST_EVERY_CMD;
	QSPICmdRead.DdrHoldHalfCycle	= QSPI_DDR_HHC_HALF_CLK_DELAY;
 
	HAL_QSPI_Command(&hqspi, &QSPICmdRead, 100);
 
	HAL_QSPI_Receive(&hqspi, data , 100);
 
 
}

0 REPLIES 0