2021-01-20 09:06 AM
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.
The problem is that the firmware isn't loaded on my board and I have this error:
Can someone help me?
Thanks and Best Regards!
2021-07-14 11:18 AM
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.
2021-07-14 01:25 PM
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.
2021-07-15 05:00 AM
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://github.com/manoloaterol/MCUDEV_DevEBox_H743-W25Q64-EL/blob/master/Core/Src/Loader_Src.c
2021-07-28 09:02 PM
Finally got some time on this, and have a W25Q256 running on the NUCLEO-H7A3ZI
2021-07-29 05:48 AM