NAND

From S1MP3 Wiki

Jump to: navigation, search

Contents

NAND flash memory

Each s1mp3 player has a NAND flash memory block, mostly manufactured by Samsung or Hynix. If you want to read the technical specifications of these components, download the PDF datasheets for Samsung & Hynix NAND Flash memories

NAND memories have a technical lifetime of some thousands of write cycles, consult the relative datasheet for precise information about it.

NAND flash content

Some example locations from a 1Gbit Hynix HY27UF081G2M NAND flash (128 MB):

  • page 0x0000: contains flash boot record (BRECFxxx.BIN, the 2nd-stage bootloader)
  • page 0x0040: contains a mirror/backup of the first flash boot record
  • page 0x0060: ???
  • page 0x0AC0: firmware image (FWIMAGE.FW)
  • page 0x1480: filesystem?

Around 117.78MB are left for the filesystem. FAT16/FAT32 is used to store the files.

NAND flash boot

On power-on, the 1st-stage bootloader from BROM loads the first NAND flash page into ZRAM1. If no error occures, it jumps to address 0x0000 and executes the first instruction of the 2nd-stage bootloader. Otherwise, the 1st-stage bootloader enters ADFU recovery mode and waits for healing.

Read more about the 2nd-stage bootloader.

Accessing the NAND

The NAND is wired together with the LCD and possibly other NAND chips, so prior to accessing the NAND, make sure that you have activated the CE line of the NAND you want to access, on the Extended Memory High port. The primary NAND chip is always connected to CE1.

There are 2 ways to access the nand:

  • Control the NAND directly by toggling the CLE and ALE lines (bits 0 and 1 of port 1) and writing commands/addresses to extended memory
  • Use the NAND controller's state machine.

For the addresses of the mentioned ports, see Port map.

ECC

ECC is short for "error correction code" See Wikipedia. It is used in NAND flash chips to correct any single bit errors when reading the NAND chips.

The ATJ2085 can automatically calculate ECC values, it's kind of easy to use:

  1. Setup the NAND chip ready for a read/write
  2. Set port 0xCC to 0x10
  3. Transfer 512 bytes of data to/from the NAND
  4. Wait for port 0xCC to change from 0x10
  5. Read the ECC values from ports 0xCC, 0xCD, 0xCE, 0xCF

Now you can write the values to the flash in the ECC area, or XOR the values with ones from ECC area. If the data is correct the XORing the values should result in all 0's

Adding a second NAND memory

It's possible - instructions at How to add/change a memory chip

NAND Controller

See NAND_controller

Related pages

Retrieved from "http://wiki.s1mp3.org/NAND"
Personal tools
about this site
Advertisement