Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Unable to render {include} The included page could not be found.
Unable to render {include} The included page could not be found.

Driver and Device Characteristics

NOR devices, no matter what attachment interface (serial or parallel), share certain characteristics. The medium is always organized into units (called blocks) which are erased at the same time; when erased, all bits are 1. Only an erase operation can change a bit from a 0 to a 1, but any bit can be individually programmed from a 1 to a 0. The μC/FS driver requires that any 2-byte word can be individually accessed (read or programmed).

The driver RAM requirement depends on flash parameters such as block size and run-time configurations such as sector size. For a particular instance, a general formula can give an approximate:

 

if (secs_per_blk < 255) {

temp1 = ceil(blk_cnt_used / 8) + (blk_cnt_used * 1);

} else {

temp1 = ceil(blk_cnt_used / 8) + (blk_cnt_used * 2);

}

if (sec_cnt < 65535) {

temp2 = sec_cnt * 2;

} else {

temp2 = sec_cnt * 4;

}

temp3 = sec_size;

TOTAL = temp1 + temp2 + temp3;

where

secs_per_blk

The number of sectors per block.

blk_cnt_used

The number of blocks on the flash which will be used for the file system.

sec_cnt

The total number of sectors on the device.

sec_size

The sector size configured for the device, in octets.

secs_per_blk and sec_cnt can be calculated from more basic parameters:

 

secs_per_blk = floor(blk_size / sec_size);

sec_cnt = secs_per_blk * blk_cnt_used;

where

blk_size

The size of a block on the device, in octets

Take as an example a 16-Mb NOR that is entirely dedicated to file system usage, with a 64-KB block size, configured with a 512-B sector. The following parameters describe the format:

 

blk_cnt_used = 32;

blk_size = 65536;

sec_size = 512;

secs_per_blk = 65536 / 512 = 128;

sec_cnt = 128 * 32 = 4096;

and the RAM usage is approximately

 

temp1 = (32 / 8) + (32 * 2) = 68;

temp2 = 4096 * 2 = 8192;

temp3 = 512;

TOTAL = 68 + 8192 + 512 = 8772;

In this example, as in most situations, increasing the sector size will decrease the RAM usage. If the sector size were 1024-B, only 5188-B would have been needed, but a moderate performance penalty would be paid.

  • No labels