Piu' sotto, al termine della lingua inglese trovi il testo in italiano. _
Below the English text you'll find the Italian version
Here you'll find documentation about handling a flash memory chip connected to a uC QuadSPI port
- (1) in CubeMX:
creating your STM32 project, enable QuadSPI.
QuadSPI must be set this way:
Mode Enable QuadSPI mode and banks needed Library handles single/dual/quad communication mode and single/dual bank
Parameter setting value Device type Flash Clock Mode Low All the other parameter as per project requirement (see video https://youtu.be/_ds4ABvxQY8 for details)
-
(2) in CubeIDE:
after saving CubeMX and after C code generation:
-
copy into the "include" folder (core\inc) z_qflash_W25QXXX.h file
copy into the "source" folder (core\src) z_qflash_W25QXXX.c file
-
(3) in main.h:
open file main.h and edit /* USER CODE BEGIN Includes */ segment, this way:
(main.h) ... /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "z_qflash_W25QXXX.h" /* USER CODE END Includes */ ...
-
(4) in z_flash_W25QXXX.h:
edit file z_flash_W25QXXX.h this way:
-
into segment STEP1:
register QuadSPI used
-
into segment STEP2:
Specify if using QuadSPI in either Memory Mapped Mode or no
-
into segment STEP3:
no changes: currently available only "Polling Mode"
-
into segment STEP4:
update all parameters with information about memory chip to handle.
Currently file shows, inside comments, configuration parameters for:
-
W25Q80DV/DL
W25Q64JV
W25Q128JV
if you are using a different memory chip, just use this data as example of what is needed for a correct library setup.
-
into segment STEP1:
(main.c)
...
/* USER CODE BEGIN 2 */
if (QFlash_Init()!=HAL_OK) {}; // if Flash_Init() returns 0 (any flash error) do not proceed
/* USER CODE END 2 */
...
Having done what above shown, you can use all functions of the library handling flash.
Each function has its own description and help, inside z_flash_W25QXXX.c file
Qui trovi le informazioni su come gestire una memoria flash connessa alla porta QuadSPI del uC
- (1) in CubeMX:
durante la creazione del progetto, attivare pa porta QuadSPI.
la porta QuadSPI deve essere configurata così:
Mode attiva il modo di comunicazione e i banchi richiesti La libreria gestisce la comunicazione in single/dual/quad mode e in single/dual bank
Parameter setting value Device type Flash Clock Mode Low Gli altri parametri secondo le esigenze del progetto (vedi https://youtu.be/_ds4ABvxQY8 per dettagli)
-
(2) in CubeIDE:
dopo aver salvato la configurazione CubeMX e generato il codice C:
-
copiare nella cartella "include" (core\inc) il file z_qflash_W25QXXX.h
copiare nella cartella "source" (core\src) il file z_qflash_W25QXXX.c
-
(3) in main.h:
aprire il file main.h e modifica il segmento /* USER CODE BEGIN Includes */ in questo modo:
(main.h) ... /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "z_qflash_W25QXXX.h" /* USER CODE END Includes */ ...
-
(4) in z_flash_W25QXXX.h:
aprire il file z_flash_W25QXXX.h e modificare in questo modo:-
nel segmento STEP1:
indicare la porta SPI utilizzata
-
nel segmento STEP2:
specificare se si intende usare QuadSPI in Memory Mappd Mode o meno.
-
nel segmento STEP3:
non modificare: attualmente disponibile solo la modalità "Polling Mode"
-
nel segmento STEP4:
aggiornare tutti i parametri con le informazioni del chip di memoria utilizzato.
Attualmente il file contiene nei commenti le configurazioni relative a:
-
W25Q80DV/DL
W25Q64JV
W25Q128JV
se si usano altri chip, usare questi dati come esempio per la configurazione corretta.
-
nel segmento STEP1:
(main.c)
...
/* USER CODE BEGIN 2 */
if (QFlash_Init()!=HAL_OK) {}; // if Flash_Init() returns 0 (any flash error) do not proceed
/* USER CODE END 2 */
...
Fatto quanto sopra, e' possibile utilizzare le varie funzioni della libreria per gestire la memoria Flash
Le funzioni sono autodescritte e commentate nel file z_flash_W25QXXX.c