2016-12-22 05:38 AM
I use a STM32L4 with a Micron N25Q032A (32 Mbit, 4Mx8). I have some Questions about this or similar Micron-Chips and hope to get here some Hints.
2016-12-22 07:27 AM
Hi
Sch.Nor
,I recommend you to refer to
a generic application note aboutthe Quad-SPI interface on the STM32 microcontrollers.This documentexplains how to use the module to configure, program, and read external Quad-SPI memories.
Hope that help you to answer all your questions.
Also you can find a set of examples under the STM32L4 cube firmware package:
STM32Cube_FW_L4_V1.6.0\Projects\STM32L476G-Discovery\Examples\QSPI
-Nesrine-
Ifmy suggestanswers your question, please mark it as correct.
2017-01-26 01:57 AM
If you read my Questions it should be clear, that I already worked with the AN4760 and the Discovery-Example. So my Questions are still not answered.
(But maybe I will not have this Chip in the actual Project and so this Topic is for me not soooo important for now ... But maybe somebody else will need it or me again later.)
2017-03-01 08:31 AM
I'm back to this Topic and still have some Trouble to get it run.
What I have:
- HW as above
- Project with System Workbench (was a hard Way to get the needed Configurations it from the Examples ...)
- everything is located in RAM and at least the Debugging (into the Init) works
My Dev_Inf.c :
__attribute__((used)) struct StorageInfo const StorageInfo = {
'N25Q032A_STM32L476', // Device Name + EVAL Borad name
NOR_FLASH, // Device Type
0x90000000, // Device Start Address
0x00400000, // Device Size in Bytes (4MBytes)
0x100, // Programming Page Size 256Bytes
0xFF, // Initial Content of Erased Memory
// Specify Size and Address of Sectors (view example below)
0x00000040, 0x00010000, // Sector Num : 64 ,Sector Size: 64KBytes
0x00000000, 0x00000000,
};�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
And my Loader_Src.h has these Function Prototypes:
int Init (void);
KeepInCompilation int MassErase (void);
KeepInCompilation int Read (uint32_t Address, uint32_t Size, uint8_t* buffer);
KeepInCompilation int SectorErase (uint32_t EraseStartAddress ,uint32_t EraseEndAddress);
KeepInCompilation uint64_t Verify (uint32_t MemoryAddr, uint32_t RAMBufferAddr, uint32_t Size, uint32_t missalignement);
KeepInCompilation int Write (uint32_t Address, uint32_t Size, uint8_t* buffer);
void QSPI_WriteEnable (QSPI_HandleTypeDef *hqspi);
HAL_StatusTypeDef QSPI_WaitFlagStateUntilTimeout (QSPI_HandleTypeDef *hqspi, uint32_t Flag, FlagStatus State, uint32_t Timeout);
void QSPI_WritePage (uint32_t Address, uint32_t Size , uint8_t* buffer);
//int QUADSPI_EraseSector (uint32_t address); // taken from own QUADSPI-Lib
void ResetMemory (QSPI_HandleTypeDef *hqspi);
void QUADSPI_SendData8 (uint8_t Data);
FlagStatus QUADSPI_GetFlagStatus (uint32_t QUADSPI_FLAG);
void QSPI_DummyCyclesCfg (QSPI_HandleTypeDef *hqspi);
�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
So yes, I found and implemented Functions Read() and MassErase() which are missed in most Examples. With normal Debugging I directly jump into the Init() which makes the Stuff which is normally located in the here never called main() and I initialize there the QSPI as done in the Examples too. The Init() has no Main-Loop and is ended by a return 1 as all of the Functions having int as return-Type.
After renaming and copying the Elf to the STLink Utility I can add it as External Loader. Name, Size and Address are shown right. But if I try to connect to the External Flash I get this Error:
Some mandatory functions are missing in the elf loader.
There is no (useful) Documentation about the API and my exported Functions are looking right (for me) ... So after what I should look? Maybe something still is missing or must be configered in another Way? Every Hint is welcome ... But pls don't tell me anything about AN4760 or UM0892, they are Garbage for writing such an External Loader.
2017-03-10 04:51 AM
After getting it to work properly here some Hints for Others with same QSPI-STDLR-Task:
There is following Define in the Loader_Src.h:
#define KeepInCompilation __attribute__((used))�?
This is used for some of the Functions which are not called by the Init() or LS_Init() but needed from the STLink Utility. For me this was not working! Don't know why this should work with Atollic and GCC (Example-Project) but not with System Workbench and GCC ...
Anyway, you should use the Tool 'readelf' from the GNU Bin Utils (MinGW) to compare an working STDLR-File with your Elf. Another important Point is, that you should keep care about not enabling (or really fast disabling) the SysTick, look here:
https://community.st.com/0D50X00009XkhOASAZ
.The Rest is mostly a
diligence Task.
By the Way you can remove a lot of the STM-QSPI-Code, because there is pretty much duplicate or useless Stuff ...