This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Atmel DataFlash commands?
- From: Stanislav Meduna <stano at meduna dot org>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Sat, 20 Jun 2009 16:39:34 +0200
- Subject: [ECOS] Atmel DataFlash commands?
Hi,
I am trying to interface with the Atmel DataFlash AT45DB642D
(http://www.atmel.com/dyn/resources/prod_documents/doc3542.pdf)
in the serial mode over the SPI. The current
devs_flash_atmel_dataflash.c states
// Read commands opcodes
#define DF_CONT_ARRAY_READ_CMD 0x68
#define DF_MMEM_PAGE_READ_CMD 0x52
#define DF_BUF1_READ_CMD 0x54
#define DF_BUF2_READ_CMD 0x56
#define DF_STATUS_READ_CMD 0x57
However, these are _not_ what the datasheet of the part
defines and e.g. the DF_CONT_ARRAY_READ_CMD actually
returns wrong data (the bytes returned seem to be shifted
1 bit to the right)
According to the datasheet (and another working source I have
access to) the correct commands in the serial mode are:
#define DF_CONT_ARRAY_READ_CMD 0xe8
#define DF_MMEM_PAGE_READ_CMD 0xd2
#define DF_BUF1_READ_CMD 0xd4
#define DF_BUF2_READ_CMD 0xd6
#define DF_STATUS_READ_CMD 0xd7
This DF_CONT_ARRAY_READ_CMD works.
I have no access to other hardware using this or any other
DataFlash, so I am not sure whether these defines actually
work on other hardware.
It looks like I am not the only one encountering it - a similar
problem is discussed e.g. at
http://sourceware.org/ml/ecos-discuss/2007-10/msg00119.html
However, the original commands are not mentioned in the
AT45DB642D datasheet _at_all_, so the Andrew Lunn's advice
to use another SPI mode probably does not apply.
A http://simplecircuitdesign.com/html/dataflash_8h-source.html
has an interesting comment:
#define ContArrayRead 0x68 // Continuous Array Read (Note : Only A/B-parts supported)
so maybe this is the clue - this is a "D" part.
In the case it matters the hardware is an ERTEC 200 based
board. I am writing the SPI driver myself - I can't
guarantee it works 100%, but the other commands seem
to work.
Right now I just re-#defined the constants if my platform is being
used; however, this should probably be caught generically.
Regards
--
Stano
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss