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-01-20 09:29 AM
>> but it gives me an error in "final launch sequence".
You've got to love the steaming heap that's been delivered here..
Yeah, so that's probably not related to your code, but rather the need for an external loader at the download/debug level that can handle your custom hardware. The processor doesn't have any internal way to deliver data to external memories (random devices, using random pins, etc, billions of possibilities)
Tools like STM32 Cube Programmer need a custom "External Loader", as small RAM based loader applet that configures the clocks, pins, peripherals and implements Erase, Write and Read functionality.
If you have an External Loader (.stldr) you need to tell the tools about it, where to find it, etc.
If you don't have one, you've got to write one. Or find one. I've posted ones for the W25Q128 in the past.
2021-01-20 09:43 AM
2021-01-20 10:02 AM
Pro-tip, don't attach half-a-dozen files, ZIP them up as a set, with a UNIQUE name and upload that.
Also files with not useful content should be omitted if you're attaching a sub-set of things, quadspi.h is 99.9% boilerplant
2021-01-21 09:12 AM
Well, you are right but I thought that it should be more practical having single files... In addition, I noticed that it lost the extension (.c, .h aren't present any longer).
So I'll re-upload the files, as you suggested. Thanks!
2021-01-21 10:25 AM
Now I'm trying to create my external loader: in STM video MOOC(video n°5) a quadspi.c and a quadspi.h are copied from the QSPI Drivers directory (in external loader example). In quadspi.c some functions use defined values:
uint8_t CSP_QSPI_WriteMemory(uint8_t* buffer, uint32_t address,uint32_t buffer_size) {
QSPI_CommandTypeDef sCommand;
uint32_t end_addr, current_size, current_addr;
..... //some code lines
sCommand.Instruction = QUAD_IN_FAST_PROG_CMD;
sCommand.AddressMode = QSPI_ADDRESS_4_LINES;
..... //some code lines
Because I'm using a different product (W25Q128) I have to modify quadspi.h according to my chip ... but "QUAD_IN_FAST_PROG_CMD" isn't defined in my W25q128.h file (attached in my prev message), only QUAD_INPUT_PAGE_PROG_CMD! The same happens with other instructions.
Can someone help me?
2021-01-21 11:07 AM
There isn't uniformity in the naming between ST, WAVESHARE and WINBOND vs MICRON, suggest you pull the data sheet so you understand the expectations in address and data widths..
#define QUAD_INPUT_PAGE_PROG_CMD 0x32
2021-01-21 12:48 PM
2021-01-22 12:26 AM
Ok, Thanks Tesla DeLorean for your kindness.
My idea is to create, step-by-step, an ExtLoader also for a "didactical" approach, but I think that the porting of a driver is not so simple...
I have a question: if I use CLIVEONE-W25Q128_STM32H7XX-PB2-PB6-PF8-PF9-PE2-PF6.stldr with a simple program (just an initialization of QSPI device on proper pins) -after disabling the "verify flash download"- I have no problems (but I don't try to access QSPI Flash).
With TouchGFX all seems more problematic: the compiling phase is OK but the screen shows no images.
During the programming, a message "handle_vCont_c, continue thread" is displayed . Is it normal?
------ Switching context -----
Target connection mode: Under reset
Reading ROM table for AP 0 @0xe00fefd0
Hardware watchpoint supported by the target
COM frequency = 4000 kHz
ST-LINK Firmware version : V2J37M26
Device ID: 0x450
PC: 0x8004d20
ST-LINK detects target voltage = 0.10 V
ST-LINK device status: HALT_MODE
Run external memory initializer
ST-LINK device status: RUN_MODE
ST-LINK device status: HALT_MODE
ST-LINK device initialization OK
handle_vCont_c, continue thread
Debugger connection lost.
Shutting down...
2021-04-27 05:04 PM
Dear @Community member !
I would like to adapt my touchGFX contents of the QUAD SPI external flash.
I try to adapt an own external loader, but i am a very beginner.
I found your external loader "CLIVEONE-W25Q128_STM32H7XX-PB2-PB6-PF8-PF9-PF7-PF6.stldr" but i have an STM32F746IGT processor. I try this loader it still not working. Am I a wrong or difference between 32F and 32H? I'am a very very beginner.
I have a Waveshare board OPEN7XXI-C and a W25Q128JV flash with this pinout
PF9 -> IO1
PF8-> IO0
PB2-> CLK
PB6-> NCS
PF7-> IO2
PF6-> IO3
Can you help me?
I will waiting for your reply!
kind regards
Peter