Skip to contentSkip to conversation

curious questions

DISCUSSION Markus Schiltknecht 2 participants 4 messages May 21, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi,

I'm new to the list - and having lots of questions. Feel free to simply point me to earlier discussions or other resources. Even simple Yes or No answers might also do it ;-)

Having read through most of the infradead.org website (and others), I today realized, that erase blocks span *multiple* pages, which explains the huge difference in 'block size' sometimes cited (around 2K vs around 128K).

Now, if I understand correctly, a flash chip supports reading and (limited) writing to pages, and erasing erase-blocks. But the MTD FAQ states:

Quoted 2 lines

(The mtd device) maintains 3 main operations: read from eraseblock, write to eraseblock, and erase eraseblock

Am I understanding correctly, that I can't write to the a single page with MTD (after having erased the according erase-block)? Even if I'm writing the single pages in the block sequentially?

Can I repeatedly write to a NAND flash page, to set its bits to 1 (without resetting any bit to 0) (or vice-versa for XOR)?

I've followed the 'hardware devices' cited on the website, but it seems a little out-dated. What's an inexpensive way to get a device with accessible NAND chips on it to play with? It looks to me like you only get to purchase stuff with embedded FTL, which isn't suitable as an mtd.

Looking forward to your answers, hints and pointers.

Markus

#1 lore raw
Quoted 4 lines · Markus Schiltknecht

Am I understanding correctly, that I can't write to the a single page with MTD (after having erased the according erase-block)? Even if I'm writing the single pages in the block sequentially?

You can erase no less than one erase-block. For NAND, you cannot easily write less than one page. Sometimes subpage writes work, sometimes they don't, they have strange limitations and are best ignored in the beginning.

Quoted 2 lines

Can I repeatedly write to a NAND flash page, to set its bits to 1 (without resetting any bit to 0) (or vice-versa for XOR)?

Erase sets bits to 1, writes sets them to 0.

With old NOR flashes, you can repeatedly write the same area to flip single bits. Writes with all 1's are essentially noops, so to set a single bit write a word will all but one bit set to 1. With ECC you'd have to flip bits on the ECC backwards, which doesn't work. NAND has ECC, so ordinarily this trick won't work.

Theoretically you could still use it, since ECC can be done in software
- using any algorithm you like including none. But practically many chips seem to misbehave if you violate the spec and repeatedly write to the same area. So don't.

Jörn

Signature · 3 lines
People will accept your ideas much more readily if you tell them
that Benjamin Franklin said it first.
-- unknown
#2 lore raw

Hi,

thanks for your quick answer!

Quoted 4 lines · Jörn Engel

You can erase no less than one erase-block. For NAND, you cannot easily write less than one page. Sometimes subpage writes work, sometimes they don't, they have strange limitations and are best ignored in the beginning.

So, with mtd, I can erase the erase-block spanning pages 0 to 63, and then, write to page 0, wait for more data and only then write page 1, right?

Quoted 3 lines
Quoted 1 line

Can I repeatedly write to a NAND flash page, to set its bits to 1 (without resetting any bit to 0) (or vice-versa for XOR)?

Erase sets bits to 1, writes sets them to 0.

Ah, that applies to NAND as well as NOR, good.

Quoted 5 lines

With old NOR flashes, you can repeatedly write the same area to flip single bits. Writes with all 1's are essentially noops, so to set a single bit write a word will all but one bit set to 1. With ECC you'd have to flip bits on the ECC backwards, which doesn't work. NAND has ECC, so ordinarily this trick won't work.

Yeah, ECC certainly wouldn't work for that. Good explanation, thanks.

Markus

#3 lore raw
Quoted 3 lines · Markus Schiltknecht

So, with mtd, I can erase the erase-block spanning pages 0 to 63, and then, write to page 0, wait for more data and only then write page 1, right?

You can also erase/write other blocks in the meantime.

Jörn

Signature · 2 lines
Time? What's that? Time is only worth what you do with it.
-- Theo de Raadt