Reciva NAND Flash: Difference between revisions

From Sharpfin
Jump to navigation Jump to search
Line 36: Line 36:


== Writing to the Flash ==
== Writing to the Flash ==
== Useful Resources ==
* [http://www.linux-mtd.infradead.org/faq/nand.html NAND Flash Info]
* [http://www.linux-mtd.infradead.org/faq/jffs2.html JFFS2 Info]

Revision as of 22:50, 16 October 2007

Introduction

The Reciva Module has a 16Mb * 8 NAND Flash Device, which is configured into 1024 blocks of 16KBytes. Blocks are sub-divided into 32 pages of 512 bytes, each page has an additional 16 bytes which are used for error correction / detection information.

Nand-map.png

Bad Block Management

Each partition starts at the pre-defined offset of 0000000, 0004000 0100000 0E00000 or 0F00000. The NAND Flash comes from the factory with bad blocks marked (the sixth byte in the extra information of the first of the 32 pages in the 16K block is non-FF). When writing to the partition, the bad blocks are simply skipped.

Error Detection and Correction

There are 15 bytes available in the extra information to store error detection / correction data. The reciva kernel uses the jffs2 filesystem, and uses the first three bytes to store error correction information.

nandwrite

The nandwrite program identifies that for jffs2, there are up to 6 bytes of check data.

struct nand_oobinfo jffs2_oobinfo = {
       .useecc = MTD_NANDECC_PLACE,
       .eccbytes = 6,
       .eccpos = { 0, 1, 2, 3, 6, 7 }
};

It is not clear why the contents of the NAND only use the first 3 bytes for ECC data, and not the 6 bytes that we see in nandwrite, for example, my radio has the following in the extra data for address 04000 (the start of the kernel partition):

004000 3c 0f 30 ff ff ff ff ff ff ff ff ff ff ff ff ff

Booting

The first block in memory is guaranteed to be error free. The boot process simply copies this block to memory, and then begins execution. The bootloader loads the kernel from the second partition, which then loads the root filesystem.

Reading the Flash

Writing to the Flash

Useful Resources