cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger clock and NCS of QSPI in STM32H7xx

cchan.21
Associate II

Hi, i try to using QSPI in STM32H743( the STM32H743_Nucleo ) to received data, the programming IDE is STM32CubeIDE, and i used it to generated and assign pin and parameter. The clock and NCS pin is probed to oscilloscope, the code is as followed, when the program started, i can not see the clock and NCS shown in the oscilloscope, the NCS is always high and no clock signal, do i miss something to setup or coding ?

Best Regards

thank you

int main(void)
{
  /* USER CODE BEGIN 1 */
  int i;
  /* USER CODE END 1 */
 
  /* Enable I-Cache---------------------------------------------------------*/
  SCB_EnableICache();
 
  /* Enable D-Cache---------------------------------------------------------*/
  SCB_EnableDCache();
 
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  //MX_USART3_UART_Init();
  MX_QUADSPI_Init();
  MX_I2C1_Init();
  MX_I2C2_Init();
 
  /* USER CODE BEGIN 2 */
 
 
    hqspi_cmdX.Instruction=0x80;
    hqspi_cmdX.InstructionMode=QSPI_INSTRUCTION_1_LINE;
    hqspi_cmdX.Address=0x000000;
    hqspi_cmdX.AddressSize =QSPI_ADDRESS_24_BITS;
    hqspi_cmdX.AddressMode=QSPI_ADDRESS_1_LINE;
 
    hqspi_cmdX.AlternateByteMode=QSPI_ALTERNATE_BYTES_NONE;
 
    hqspi_cmdX.DummyCycles=0x00;
 
    hqspi_cmdX.DataMode=QSPI_DATA_4_LINES;
    hqspi_cmdX.DdrMode=QSPI_DDR_MODE_DISABLE;
    hqspi_cmdX.NbData=9600*4;//number of data to Xfer
    hqspi_cmdX.SIOOMode=QSPI_SIOO_INST_EVERY_CMD;
 
    if (HAL_QSPI_Command(&hqspi, &hqspi_cmdX, 100 )!=HAL_OK){
    	Error_Handler();
    }	
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
	 
	  HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
	  HAL_Delay(500);
	  HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);
	  HAL_Delay(500);
      do {    	 
    	  HAL_Delay(5);
    	  HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);        
    	  HAL_Delay(3);
    	  HAL_QSPI_Receive(&hqspi, buffer, 5);//?
    	  HAL_Delay(10);
    	  HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
    	  HAL_Delay(10);
      }while(1);
  }
  /* USER CODE END 3 */
}
 
static void MX_QUADSPI_Init(void)
{
 
  /* USER CODE BEGIN QUADSPI_Init 0 */
	__HAL_RCC_QSPI_FORCE_RESET();
 
		__HAL_RCC_QSPI_RELEASE_RESET();
 
  /* 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 = 12;
  hqspi.Init.FifoThreshold = 1;
  hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
  hqspi.Init.FlashSize = 12;
  hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_5_CYCLE;
  hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
  hqspi.Init.DualFlash = QSPI_DUALFLASH_ENABLE;
  if (HAL_QSPI_Init(&hqspi) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN QUADSPI_Init 2 */
  /* USER CODE END QUADSPI_Init 2 */
}

1 REPLY 1
ChahinezC
Lead

Hello @cchan.2​,

The Nucleo-H743ZI board does not embed Quad-SPI Flash memory, so it is necessary to connect an external memory following the hardware configuration needed.

  • Can you please specify the memory used?
  • I suggest you as a first step to verify the hardware configuration set, and the GPIos connexion, you can refer to the 3.2 section of the QuadSPI application note AN4760 and to the schematics of the board.

Chahinez.