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

I'm not using CubeMX, I'm using HAL code, with a version of the library with only QSPI/QUADSPI support, I'll need to migrate that to a newer version of the library using OCTOSPI, and the newer/slower H7.

I might just be able to change the pin table, but I'm currently skeptical it will be that easy.

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

IO2 PA7:AF10 is only available on the H7Ax/Bx parts

More generally I'm likely going to need to wire a ZIF socket up to a NUCLEO-H7A3ZI to get some level of confidence in the code/implementation.

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

Yes you are right, this parts are pretty good to IHM application, if helps i have my C code for communication with the memory, the function are working, and as you told are some difference between QSPI and OSPI code.

I'm working now at the file LOADER_SRC to adapt this one to generate the right external loader, based on the post of below.

https://community.st.com/s/question/0D53W00000e1oaTSAQ/external-loader-works-on-stm32cubeprogrammer-but-read-operation-returns-incorrect-data

https://github.com/manoloaterol/MCUDEV_DevEBox_H743-W25Q64-EL/blob/master/Core/Src/Loader_Src.c

Finally got some time on this, and have a W25Q256 running on the NUCLEO-H7A3ZI

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

hi @Community member​  this is good.

i Did work my custom loader for STM32H7B3 with W25Q128. please look my project, everything is working. the project now is okay, we have to make some initialization on the main.c to the touchgfx works well.