App note: Using Atmel’s DataFlash ICs

Atmel describes their DataFlash memory chips and how to interface with them:
This entry was posted in app notes and tagged app note, atmel, DataFlash.The DataFlash is perfectly suited for digital voice-, image-, code- and data-storage applications, especially where low power consumption is required. In these storage applications, the DataFlash’s small page size not only makes it easier to manipulate data, it also increases storage efficiency.


Comments
On the forum: http://dangerousprototypes.com/forum/viewtopic.php?f=40&t=4292#p42475
I added a C program to flash and read Atmel DataFlash (AT45DB161D – 16 megabit one) using Bus Pirate binary SPI mode :)
I spent some quality time with these parts this year – the painful part is the 264 byte (note NOT 256 byte) row size – you need to insert a ’0′ into bit 8 of the address (and shift the higher bits left) you apply to the part
Haven’t used those one the small side but these larger ones are 528 byte page. Now, I assume the small ones are same only half the value, thing is, when you purchase then they are 528 but
– you can order them to have 512 byte page
– you can (only once !!) set a config bit and make then 512 byte page device (even if they were 528) – unfortunately you can’t move back to 528
“Power of 2” binary page size Configuration Register is a user-programmable nonvolatile register that allows thepage size of the main memory to be configured for binary page size (512-bytes) or standard Atmel® DataFlash page size (528-bytes). The “power of 2” page size is a one-time programmable configuration register and once the device is configured for “power of 2” page size, it cannot be reconfigured again. The devices are initially shipped with the page size set to 528-bytes. The user has the option of ordering binary page size (512 bytes) devices from the factory. For details, please refer to Section 26. “Ordering Information” on page 47.
For the binary “power of 2” page size to become effective, the following steps must be followed:
1. Program the one-time programmable configuration resister using opcode sequence 3DH, 2AH, 80H and A6H (please see Section 13.1).
2. Power cycle the device (i.e. power down and power up again).
3. User can now program the page for the binary page size.
If the above steps are not followed in setting the the page size prior to page programming, user may expect incorrect data during a read operation.
Programming the Configuration Register
To program the Configuration Register for “power of 2” binary page size, the CS pin must first be asserted as it would be with any other command. Once the CS pin has been asserted, the appropriate 4-byte opcode sequence must be clocked into the device in the correct order. The 4-byte opcode sequence must start with 3DH and be followed by 2AH, 80H, and A6H. After the last bit of the opcode sequence has been clocked in, the CS pin must be deasserted to initiate the internally self-timed program cycle. The programming of the Configuration Register should take place in a time of tP, during which time the Status Register will indicate that the device is busy. The device must be power cycled after the completion of the program cycle to set the “power of 2” page size. If the device is powered-down before the completion of the program cycle, then setting the Configuration Register cannot be guaranteed. However, the user should check bit zero of the status register to see whether the page size
was configured for binary page size. If not, the command can be re-issued again.
Yeah – I avoided the one time programmable thing – didn’t want to add an extra step to the manufacturing process (especially one involving an extra board power cycle during manufacturing test)
We used these on the first batches of Logic Sniffers. I remember fighting to get the 264 byte page and addressing situation under control.
We didn’t use the 256 byte page boundary bit, don’t remember why. In retrospect we should have because now we’ve switches to several different flash chips and they’re all 256 and now we have to support both…
If we had decided to burn the bit I planned to have the PIC firmware that does the programming just check the register and set it to 256 as part of the update routine.
I just checked out the 4 megabit AT45DB041B and from what I read it does not support “power of 2″ operation (no config bit you can set even otp), ATMEL states it’s deprecated and that for new projects you should use AT45DB041D and the D version DOES support “power of 2″ (section 13, opcodes “3DH, 2AH, 80H and A6H” – so same as for 16megabit version).. So when ordering these you have to be careful on the last letter if it’s B or D or ..