Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
965 Views

HAL API for CFI FLASH write

Hello, 

 

My custom design is done with a ARRIAI-IGX FPGA connected to a 512Mbits CFI FLASH with blocks of 128ko.  

 

I have implemented a NIOS CPU in order to write/read to/from the CFI FLASH. So I use the Alt_write_flash and Alt_write_flash_block functions for that. These functions work fine in my design. 

 

- alt_write_flash : erase the entire block before writing a block to flash. 

- alt_write_flash_block : read the entire block before writing to flash (does not erase the Flash). So it needs large CPU memory (at least 128ko for me). 

 

So my question is the following : 

 

I would have a simple write function which write to FLASH without erasing the FLASH and without reading the entire FLASH block (in order to minimize the CPU RAM size). 

 

Do you have an idea how I could do that ?  

 

Thanks by advance.
0 Kudos
5 Replies
Altera_Forum
Honored Contributor I
67 Views

You can separate out the 'erase' and 'write' operations. 

The only way you can change a bit from a 0 to a 1 is via the full 128k erase. 

NOR flash will let you do any number of separate writes than convert bits from 1 to 0 - you can actually write the same location multiple times. 

NAND flash has additional error correction areas for each sector - so there is a small limit (maybe 4) on the number of writes. 

Not sure what the 'CFI' flash is. 

Don't know what the Altera supplied functions actually let you do.
Altera_Forum
Honored Contributor I
67 Views

Yes I would like to separate the write and erase functions, but the alt_write_flash_write function erase and then write a block to FLASH. I do not need that. The alt_write_flash_block does not erase the block but demand a memory size equivalent to a single FLASH block (128 ko for me). 

 

So I would know if someone knows how to do these 2 things separately in software. 

 

Thanks for your help.
Altera_Forum
Honored Contributor I
67 Views

IIRC Altera supply the source for alt_write_flash_block() so you can use it as a template for what you want to do. 

A useful NOR flash write function would take a byte/word offset and allow the write if it didn't need to set any bits.
Altera_Forum
Honored Contributor I
67 Views

 

--- Quote Start ---  

IIRC Altera supply the source for alt_write_flash_block() so you can use it as a template for what you want to do. 

A useful NOR flash write function would take a byte/word offset and allow the write if it didn't need to set any bits. 

--- Quote End ---  

 

 

Excuse me but what did you mean by IIRC ALTERA ??? 

 

Thanks
Altera_Forum
Honored Contributor I
67 Views

 

--- Quote Start ---  

Excuse me but what did you mean by IIRC ALTERA ??? 

 

--- Quote End ---  

 

IIRC : If I Remember Correctly
Reply