cancel
Showing results for 
Search instead for 
Did you mean: 

I Ask one doubt for QSPI external flash memory in stm32f746-disco

Yugenthar
Senior

Hello Everyone !!

I'm yugenthar

Now i have working in Image processing project . Forst i tried to uplad the code for normal flash memory but array size is big so memry is overflow .After i move QSPI external flash memory .

I have write the code is working fine but one specific doubt

my External memory region is 0xC000000 but my write data store 0x80002cbc and read data is 0x2000000 region

I send code and snap so anyone give the solution


_legacyfs_online_stmicro_images_0693W00000bjkNOQAY.png
_legacyfs_online_stmicro_images_0693W00000bjkNJQAY.png

#include "main.h"
#include "quadspi.h"
#include "gpio.h"
uint8_t *writebuf="hello world form QSPI";
 
uint8_t readbuf[100];
SCB_EnableICache();
 
  /* Enable D-Cache---------------------------------------------------------*/
  SCB_EnableDCache();
  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_QUADSPI_Init();
  /* USER CODE BEGIN 2 */
 if(CSP_QUADSPI_Init()!=HAL_OK)
 {
	 Error_Handler();
 
 }
 if(CSP_QSPI_Erase_Chip()!=HAL_OK)
 {
	 Error_Handler();
 
 }
 if(CSP_QSPI_Write(writebuf,0, strlen (writebuf))!=HAL_OK)
 {
	 Error_Handler();
 
 }
 if(CSP_QSPI_Read(readbuf, 0,100)!=HAL_OK)
 {
	 Error_Handler();
 
 }

8 REPLIES 8
Yugenthar
Senior

Sorry External Memory region:0x90000000 not 0xC0000000

SKacp.1
Senior II

Hi,

You assign pointer do the string in Your Flash memory so the string is located in the Flash at address 0x80002cbc. Next You read to the buffer which is located in the RAM. That's all.

Best Regards,

Slawek

Yugenthar
Senior

Thank you sir.

This information is very important for me

So I


_legacyfs_online_stmicro_images_0693W00000bjlYXQAY.png

/*
******************************************************************************
**
** @file        : LinkerScript.ld
**
** @author      : Auto-generated by STM32CubeIDE
**
**  Abstract    : Linker script for STM32F746G-DISCO Board embedding STM32F746NGHx Device from stm32f7 series
**                      1024Kbytes FLASH
**                      320Kbytes RAM
**
**                Set heap size, stack size and stack location according
**                to application requirements.
**
**                Set memory bank area and size if external memory is used
**
**  Target      : STMicroelectronics STM32
**
**  Distribution: The file is distributed as is, without any warranty
**                of any kind.
**
******************************************************************************
** @attention
**
** Copyright (c) 2023 STMicroelectronics.
** All rights reserved.
**
** This software is licensed under terms that can be found in the LICENSE file
** in the root directory of this software component.
** If no LICENSE file comes with this software, it is provided AS-IS.
**
******************************************************************************
*/
 
/* Entry Point */
ENTRY(Reset_Handler)
 
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
 
_Min_Heap_Size = 0x200; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */
 
/* Memories definition */
MEMORY
{
  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 320K
  FLASH    (rx)    : ORIGIN = 0x8000000,   LENGTH = 1024K
  QUADSPI (r)      :ORIGIN = 0X90000000,   LENGTH = 16M
}
 
/* Sections */
SECTIONS
{
  /* The startup code into "FLASH" Rom type memory */
  .isr_vector :
  {
    . = ALIGN(4);
    KEEP(*(.isr_vector)) /* Startup code */
    . = ALIGN(4);
  } >FLASH
 
  /* The program code and other data into "FLASH" Rom type memory */
  .text :
  {
    . = ALIGN(4);
    *(.text)           /* .text sections (code) */
    *(.text*)          /* .text* sections (code) */
    *(.glue_7)         /* glue arm to thumb code */
    *(.glue_7t)        /* glue thumb to arm code */
    *(.eh_frame)
 
    KEEP (*(.init))
    KEEP (*(.fini))
 
    . = ALIGN(4);
    _etext = .;        /* define a global symbols at end of code */
  } >FLASH
 
  /* Constant data into "FLASH" Rom type memory */
  .rodata :
  {
    . = ALIGN(4);
    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
    . = ALIGN(4);
  } >FLASH
 
  .ARM.extab   : {
    . = ALIGN(4);
    *(.ARM.extab* .gnu.linkonce.armextab.*)
    . = ALIGN(4);
  } >FLASH
 
  .ARM : {
    . = ALIGN(4);
    __exidx_start = .;
    *(.ARM.exidx*)
    __exidx_end = .;
    . = ALIGN(4);
  } >FLASH
 
  .preinit_array     :
  {
    . = ALIGN(4);
    PROVIDE_HIDDEN (__preinit_array_start = .);
    KEEP (*(.preinit_array*))
    PROVIDE_HIDDEN (__preinit_array_end = .);
    . = ALIGN(4);
  } >FLASH
 
  .init_array :
  {
    . = ALIGN(4);
    PROVIDE_HIDDEN (__init_array_start = .);
    KEEP (*(SORT(.init_array.*)))
    KEEP (*(.init_array*))
    PROVIDE_HIDDEN (__init_array_end = .);
    . = ALIGN(4);
  } >FLASH
 
  .fini_array :
  {
    . = ALIGN(4);
    PROVIDE_HIDDEN (__fini_array_start = .);
    KEEP (*(SORT(.fini_array.*)))
    KEEP (*(.fini_array*))
    PROVIDE_HIDDEN (__fini_array_end = .);
    . = ALIGN(4);
  } >FLASH
 
  /* Used by the startup to initialize data */
  _sidata = LOADADDR(.data);
 
  /* Initialized data sections into "RAM" Ram type memory */
  .data :
  {
    . = ALIGN(4);
    _sdata = .;        /* create a global symbol at data start */
    *(.data)           /* .data sections */
    *(.data*)          /* .data* sections */
    *(.RamFunc)        /* .RamFunc sections */
    *(.RamFunc*)       /* .RamFunc* sections */
 
    . = ALIGN(4);
    _edata = .;        /* define a global symbol at data end */
 
  } >RAM AT> FLASH
 
  /* Uninitialized data section into "RAM" Ram type memory */
  . = ALIGN(4);
  .bss :
  {
    /* This is used by the startup in order to initialize the .bss section */
    _sbss = .;         /* define a global symbol at bss start */
    __bss_start__ = _sbss;
    *(.bss)
    *(.bss*)
    *(COMMON)
 
    . = ALIGN(4);
    _ebss = .;         /* define a global symbol at bss end */
    __bss_end__ = _ebss;
  } >RAM
 
  /* User_heap_stack section, used to check that there is enough "RAM" Ram  type memory left */
  ._user_heap_stack :
  {
    . = ALIGN(8);
    PROVIDE ( end = . );
    PROVIDE ( _end = . );
    . = . + _Min_Heap_Size;
    . = . + _Min_Stack_Size;
    . = ALIGN(8);
  } >RAM
 
  /* Remove information from the compiler libraries */
  /DISCARD/ :
  {
    libc.a ( * )
    libm.a ( * )
    libgcc.a ( * )
  }
 
  .ARM.attributes 0 : { *(.ARM.attributes) }
 
  ExtFlashSection :            // i am adding this five line but is error
    {
    *(ExtFlashSection ExtFlashSection.*)
    *(.gnu.linkonce.r.*)
    .=ALIGN(0x4);          
   } >QUADSPI
  
 
  
}

have one doubt sir ..how to write the QSPI external flash Actually I am configure the stm32f746dico board in build MT25QL128ABA1EW9-0SIT IC chip but is not working fine ..

First of all I have write the QSPI program and debug the program but not show QSPI memory window then I have write the flash id but is show error .I have send the program and snap pls give your support and help

Hai sir,

Actually I clear the error for you reference link .

but i try to write my data throught QSPI flash memory but data is store to flash memory

So i have send my and and snap and give the solution any example code or tutorial


_legacyfs_online_stmicro_images_0693W00000bjmI1QAI.png

/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "quadspi.h"
#include "gpio.h"
 
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
 
/* USER CODE END Includes */
 
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
uint8_t *writebuf = "Hello world from QSPI !";
 
uint8_t readbuf[100];
 
uint16_t number = 1234;
uint8_t buf[5];
/* USER CODE END PTD */
 
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
 
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
typedef  void (*pFunction)(void);
pFunction JumpToApplication;
 
#define APPLICATION_ADDRESS 0x90000000
/* USER CODE END PM */
 
/* Private variables ---------------------------------------------------------*/
 
/* USER CODE BEGIN PV */
 
/* USER CODE END PV */
 
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
/* USER CODE BEGIN PFP */
 
/* USER CODE END PFP */
 
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
 
/* USER CODE END 0 */
 
/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */
 
  /* 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_QUADSPI_Init();
  /* USER CODE BEGIN 2 */
 
   if (CSP_QUADSPI_Init() != HAL_OK)
   {
 	  Error_Handler();
   }
 
 
 /****************** FOR SIMPLE WRITE READ ********************/
 	// Comment out these if you are using the EXT MEM BOOT
 
   if (CSP_QSPI_Erase_Chip() != HAL_OK)
   {
 	  Error_Handler();
   }
 
 
   sprintf (buf, "%u", number);
   if (CSP_QSPI_Write(buf, 0, strlen (buf)) != HAL_OK)
   {
 	  Error_Handler();
   }
 
 
   if (CSP_QSPI_Read(readbuf, 0, 100) != HAL_OK)
   {
 	  Error_Handler();
   }
 
 /*************************************************/
 
 
 /***********************  FOR EXT MEM BOOT *************************/
 	// Comment out these if you are using the simple Read Write
 
   if (CSP_QSPI_EnableMemoryMappedMode() != HAL_OK)
    {
 	  Error_Handler();
    }
 
 
   // Disable the cache
   SCB_DisableDCache();
   SCB_DisableICache();
 
 
   // Disable the systick interrupt
   SysTick->CTRL = 0;
 
 
   /* Initialize user application's Stack Pointer & Jump to user application */
   JumpToApplication = (pFunction) (*(__IO uint32_t*) (APPLICATION_ADDRESS + 4));  // Reset Handler
   __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);   // stack pointer
   JumpToApplication();	  // make the jump

Screen shots not real helpful.

If you get errors,show the errors, starting with the first ones.

ST provides an External Loader for the DISCO board, but you might have to select in the related user-interface / settings, probably that for the debugger. #NotMyTools

Don't erase the QSPI in the application if you've put data there in the build / download process.

Why / where are you transferring control too? Where is the application code?

Expect to have to bring up the memory, and memory map it, before you can see it in the debugger or memory windows.

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

I provide my application code Actually my application is display one image to lcd display

but my pixel size is so big .because i am move to qspi flash concept

It's like an iceberg, most of the important detail is below the water, in the actual implementation.

Perhaps look withing the CubeF7 example trees for the F746G-DISCO for use of QSPI, and more generally in TouchGFX for allocating resources into the QSPI via the linker script (LD). Then the download of the built product into the the memories. The internal FLASH is managed by STM32 Cube Programmer directly, and the external QSPI memory via the External Loader you've associated with the board

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