cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Flash

linas2
Associate II
Posted on May 31, 2012 at 10:04

Hello

I am working on LCD project (Fractals) and i need large buffer for storing iteration values, so i can calculate fractal and when paint it.

I need to store 8b number, total of 130560. so what would be around 1Mb.

I have W25Q16 flash below my lcd, i remade code from ST SPI sampl, but don't know how to write individual numbers and then read them.

i guess i have to use this function:

    /* Write Tx_Buffer data to SPI FLASH memory */

    sFLASH_WriteBuffer(Tx_Buffer, FLASH_WRITE_ADDRESS, BufferSize);

    /* Read data from SPI FLASH memory */

    sFLASH_ReadBuffer(Rx_Buffer, FLASH_READ_ADDRESS, BufferSize);

But what kind of C syntax that would be?

code is like this

int h=0;

u32 i =0;

while(i<(480*272))

{  

h=fractal iteration number ;//0-255

sFLASH_WriteBuffer(h, i, 1);

i++;

}

i=0;

int x=,y=0;

while(x<480)

{

while(y<272)

sFLASH_ReadBuffer(&h, i, 1);

LCD_Pixel(x,y,asemble_rgb(h)):

y++;

i++;

}

y=0;

x++;

}

Help is highly appreciated

#stm32f4-fsmc-lcd-tft-ssd1963
3 REPLIES 3
frankmeyer9
Associate II
Posted on May 31, 2012 at 13:27

I believe Flash is NOT what you want for this purpose.

First, it has a limited number of erase/write cycles, usually about 10.000 cycles.

It would not take long until you run into problems, because the cells can't be written anymore.

Second, a Flash write takes long (several milliseconds), the erase you need before takes even longer - about.200ms

Flash is for values which are rarely changed, and mostly read.

For intermediate values things like iteration variables, you would need RAM.

frankmeyer9
Associate II
Posted on May 31, 2012 at 20:18

The more I tinker with it, the less appealing I find this idea.

while(i<(480*272))
{ 
h=fractal iteration number ;//0-255
sFLASH_WriteBuffer(h, i, 1);
i++;
}

What would be the runtime of this loop, when each (serial) write access consumes several milliseconds, and adding the erase delay for each block of ..250ms ? If you intend to use an stm32f4, why not taking advantage of the FSMC, i.e. the external memory interface ? Or, use a Cortex A8 device or similiar, if you need more RAM and performance.
linas2
Associate II
Posted on June 02, 2012 at 17:57

i would love to use cortex A8, but i don't know where to find something that you can solder at home to pcb.

i guess i will buy some ram and use same fsmc line as lcd

max speed for this type of processor is 250MHz (texas Hercules m4 core )

http://www.youtube.com/watch?v=j2dKBz2jUt0