cancel
Showing results for 
Search instead for 
Did you mean: 

QSPI W25q128 and TouchGFX: error in the final launch stage

Lagodolio
Senior

Hello!

I'm using TouchGFX for a project, LCD and touch module are OK, but I have some problems with the QSPI driver (W25Q128 module).

I'm able to compile all the code and I see QSPI flash memory as used, but it gives me an error in "final launch sequence".

After including stm32746g_qspi.h (well, my board is an H743, but this file is modified by the vendor Waveshare: even if the name seems wrong, as you can see, it includes H7 headers):

//This is the stm32746g_qspi.h initial part
...
#ifndef __STM32746G_QSPI_H
#define __STM32746G_QSPI_H
 
#ifdef __cplusplus
 extern "C" {
#endif 
 
/* Includes ------------------------------------------------------------------*/
#include "stm32H7xx_hal.h"
#include "w25q128fv.h"
 ...

 So I put some initialization lines in MX_QUADSPI_Init() function:

void MX_QUADSPI_Init(void)
{
 
  hqspi.Instance = QUADSPI;
  hqspi.Init.ClockPrescaler = 10;
  hqspi.Init.FifoThreshold = 4;
  hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
  hqspi.Init.FlashSize = 23;
  hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_2_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();
  }
  
  
  BSP_QSPI_Init();
  BSP_QSPI_MemoryMappedMode();
 HAL_NVIC_DisableIRQ(QUADSPI_IRQn);
}

 The function BSP_QSPI_MemoryMappedMode() function is not present in vendor's stm32746g_qspi.c , so I wrote this :

uint8_t BSP_QSPI_EnableMemoryMappedMode(void)
{
  QSPI_CommandTypeDef      s_command;
  QSPI_MemoryMappedTypeDef s_mem_mapped_cfg;
 
  /* Configure the command for the read instruction */
  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
  s_command.Instruction       = QUAD_INOUT_FAST_READ_CMD;
  s_command.AddressMode       = QSPI_ADDRESS_4_LINES;
  s_command.AddressSize       = QSPI_ADDRESS_24_BITS;
  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
  s_command.DataMode          = QSPI_DATA_4_LINES;
  s_command.DummyCycles       = W25Q128FV_DUMMY_CYCLES_READ_QUAD;
  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
 
  /* Configure the memory mapped mode */
  s_mem_mapped_cfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
  s_mem_mapped_cfg.TimeOutPeriod     = 0;
 
  if (HAL_QSPI_MemoryMapped(&QSPIHandle, &s_command, &s_mem_mapped_cfg) != HAL_OK)
  {
    return QSPI_ERROR;
  }
 
  return QSPI_OK;
}

and, in stm32746g_qspi.h

#define BSP_QSPI_MemoryMappedMode BSP_QSPI_EnableMemoryMappedMode

Finally, I modified my linker file and after compiling (without error) I can see the ToughGFX ExtFlashSection loaded in QUAD SPI.

0693W000007C3MqQAK.pngThe problem is that the firmware isn't loaded on my board and I have this error:

0693W000007C3QOQA0.pngCan someone help me?

Thanks and Best Regards!

24 REPLIES 24

The F7 and H7 are quite different designs internally

This is a tentative build for the F7 platform using the identified pins

https://github.com/cturvey/stm32extldr/tree/main/f7_w25q128

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Dear @Community member​ !

Many thanks to reply me. I copy the stldr file, and use it. It seems to be someting is not good.

0693W00000AMk2RQAT.jpgWhere i search the problem?

Kind regards

Peter

The original Waveshare code works properly, the Chip is communicate, the Microprocessor. The test succes!

@Community member​ 

Your external loader works with STM32 Cube Programmer. It is fine.

But i haven't to adapt in Cube IDE.

Which is the best setup, to debugger?

kind regards

Peter

I suspect it is in amongst the metadata of the settings/options. Probably in the debugger settings.

I'm primarily a Keil guy, I use GNU/GCC via makefiles

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

send to me you project

send to me your project

PCabr.1
Associate II

Hello @Peter Szucs​ 

I'm having the same problem in my project, i can write, erase sector, read the memory W25Q128JV, but I'm trying to generate a custom loader for my project using the touchGFX for STM32H7B3VI with mappedmode, but nothing is working for now.

Could you share your example project to generate the custom loader with me?

I saw the link from github that @Community member​  sent you, but none of those have my pinout.

 /**OCTOSPI1 GPIO Configuration

  PA7   ------> OCTOSPIM_P1_IO2

  PB2   ------> OCTOSPIM_P1_CLK

  PD11   ------> OCTOSPIM_P1_IO0

  PD12   ------> OCTOSPIM_P1_IO1

  PD13   ------> OCTOSPIM_P1_IO3

  PB6   ------> OCTOSPIM_P1_NCS

I don't know if my linker file have something wrong or the loader_SRC file as well, i was following the ST Video to generate this customer loader.

The H7Ax/Bx have OCTOSPI, and are a little different in implementation to the H74x/75x code I currently have running.

I'll probably need to port the code, adding it to my TODO list.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PCabr.1
Associate II

thanks for your message, but let me ask something.

when you say a little different, you mean about the all of routines to read, write, erase, mappedmode, polling??? because i have this functions working.

or about the Loader_SRC, Dev_inf files to generate the external loader properly? this i really don't know what exactly is right or no.