Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21602 Discussions

Flash memory size...

Altera_Forum
Honored Contributor II
2,284 Views

so i tested my flash memory using the HAL function (using word mode...) 

 

ret_code = alt_get_flash_info(fd, &regions, &number_of_regions); 

 

the result was printed as: 

 

printf("\nFlash Region Structure:\r\n"); 

printf("Number of Regions: %d\r\n", number_of_regions); 

printf("Offset: %d\r\n", regions->offset); 

printf("Region Size: %d\r\n", regions->region_size); 

printf("Number of Blocks: %d\r\n", regions->number_of_blocks); 

printf("Block Size: %d\r\n\r\n", regions->block_size); 

 

THE OUTPUT IS: 

 

Flash Region Structure: 

Number of Regions: 2 

Offset: 0 

Region Size: 65536 

Number of Blocks: 8 

Block Size: 8192 

 

care some one tell me how this information translates to my flash memory having a 8MB memory??? 

 

also what is region size and why my regions is only 2?
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
1,525 Views

8192 * 8 * 65536 * 2 = 8MB (+ spare bytes for ECC). 

 

Why don't you just tell us which flash device you are using? 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

hello i am using the de2-70 flash memory...s29gl064n90tf104

0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

hello but 8192 * 8 * 65536 * 2 = 8589934592 <-- byte right? 

 

or am i seriously misunderstood something here....
0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

Here is the datasheet: 

http://www.spansion.com/support/datasheets/s29gl-n_01_12_e.pdf 

 

Sorry. I wasn't paying close enough attention. Yeah I'm confused. The HAL driver should be reporting 128 regions of 65536 bytes each. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

The code output only reports the size of the first region, which seems to be 64kbytes, split in 8 blocks of 8kbytes each. 

Could you display the size of the second region? 

From the datasheet, it seems that this flash memory has a "boot sector" option, and I'm guessing that the first region reported is your boot sector.
0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

hello how could i show the size of the second region??

0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

regions is in fact a table, so this code:printf("Offset: %d\r\n", regions.offset); printf("Region Size: %d\r\n", regions.region_size); printf("Number of Blocks: %d\r\n", regions.number_of_blocks); printf("Block Size: %d\r\n\r\n", regions.block_size);with i between 0 and number_of_regions-1, will give you the information about region i.

0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

oh thanks will try it...

0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

Found this: 

 

Flash Region Structure: 

Number of Regions: 2 

Offset: 65536 

Region Size: 8323072 

Number of Blocks: 127 

Block Size: 65536 

 

ok is there any way i could combine these 2 regions??? 

 

also when writing, should i offset my first data entry point by that (65536) much ?? (skipping the first region....) 

 

or i could write from offset 0...? 

 

my data length is 65035...
0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

The second region starts right after the first one, so I would say that you can use all the flash as one big region and start at offset 0. 

I don't know the specifics about the first "boot sector" region, it could just be a special erasing procedure. There could be more info in the flash datasheet.
0 Kudos
Altera_Forum
Honored Contributor II
1,525 Views

I've seen one smaller erase region (boot region) of 32K sectors, followed by a second erase region of 128K sectors on several CFI-compliant flashes. 

 

Cheers, 

 

- slacker
0 Kudos
Reply