cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 QSPI Flash External Flash Loader

yldzmuhammed
Associate III

Hello to everyone.

I am currently developing a project using STM32F750N8 and W25Q128. As you can guess, the project has an LCD. So the project is too big to fit into the internal memory. That's why I need an external memory integrated programming.

I develop the software with Keil and use the Jlink programmer.

I know that i need to the External Flash Loader for this operation. That's why I developed one.

But it doesn't work as it should. I also added UART for debug purposes. It works quite unstable.

Sometimes Init function doesn't work, sometimes the sector erase fails, sometimes the full chip erase fails, sometimes everything works, but the verification fails. Verification is never successful, though.

I have developed an application that runs on the internal memory, and I can sector/full chip erase and write any data in the external memory.

I also monitored the voltage from the flash chip ic from VCC pin using an oscilloscope. 3.3V. Just as it should be. When wiping, writing, reading, the voltage is exactly as it should be. But I didn't get a stable result.

I have prepared the attached project.

Can someone take a hand?

36 REPLIES 36

Suppose grafik.image01 [] already exists, and grafik.image02 [] needs to be added

We are creating a new project for debugging in memory: with the initialization of the clock, functions for writing to flash memory, a data file for writing, and nothing more.

void main(void)
{
volatile uint32_t temp; temp = 0;
 
//qspi_data_wire ( uint8_t* data, uint32_t data_size, uint32_t flash_adres)
qspi_data_wire (image02_in[0] , (0x25800 * 2), &grafik.image02[0]);
while(1)
temp++;
;
}; 

We are waiting for the debugger to get to line number 8.

All new data is recorded.

Now you can delete this code.

The recording function itself checks the addresses of sectors of flash memory, with full overlap. If part of the data is located in the upper or lower part of the physical sector of the flash memory, then the entire physical flash sector is first read into the temporary buffer, then part of the data is replaced by new ones, after which the entire data sector is physically erased and written in a new cycle from the temporary buffer.

If the data completely covers several physical sectors of the external flash memory: then a little useless work is observed - the data is first read and then completely overwritten. I’m just too lazy to write processing conditions, everything works like that.

The size of the temporary buffer should be equal to the size of the physical sector of the external flash memory. There are chips with sector sizes 4k, 16k, 64k, 256k, 512k, and even 4M !!! This imposes restrictions on the breadboard; in some cases, the use of an external sdram is required.

In the case when the data for recording is large, then the only way out is to use an SD card. This is the easiest and fastest way to transfer data. Use the Jlink debugger for this purpose - a waste of time (more than two hours !!!).

I apologize, perhaps the reason for poor communication is the use of an online translator.

I forgot, for the correct work with external flash memory in the indirect addressing mode - you must use the MPU settings. Allow this memory area to use, allow reading, allow code execution, enable data cache.

"I apologize, perhaps the reason for poor communication is the use of an online translator."

Where are you from? Are you from Turkey?

I'm from Russia.

Problems when the device does not work properly - you can always determine a more accurate fault position.

First you need to turn off the offline mode, and try to record in a manually controlled mode. At this point, all HAL debugging features will be available.

Hello @AVI-crak​ 

I attached the project (last stage). Speeking of deterministic. There no such thing in here (my project). Some times i can write, erase, delete, everthing. Some times no luck. When it is not working i am adding __nop() functions to verify or any where in the and working. Then i delete still working. Trying again not working.

Some how it is not deterministic.

What do you mean by turning of th eoffline mode? Is it about StLink Utility or CubeMX Programmer?

Well, let's start with simple mistakes.

For example, the indirect calculation of the address of the sector, and the block in the sector. You have the parameter W25Q128FV_SECTOR_SIZE, its value is correct, but the application is not very.

The fact is that its binary value is one unit, and everything else is zeros. If you need to align the address with the size of the sector, then the binary value must contain zeros in the lower part and ones in the upper part. It is necessary to subtract "1" from W25Q128FV_SECTOR_SIZE, and then invert.

address & (~(W25Q128FV_SECTOR_SIZE - 1))

Additionally, to eliminate errors, the address should be brought to a physical norm. The physics address distribution is in the four most significant bits. It is enough to perform:

address & (~ (W25Q128FV_SECTOR_SIZE - 1)) & 0x0FFFFFFF

So you need to do with the address of the block.

Strange, the forum engine does not allow the inversion operator to be printed ...

lexabps
Associate II

Does your external flash downloader work?

Some times yes, mostly not working. Why did you asked?

lexabps
Associate II

I need an external QSPI flashloader for STM32F746IGTx + w25q128fv

lexabps
Associate II