This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Atmel Dataflash driver in combination with AT91SAM7SE512
- From: "Tom Deconinck" <t dot deconinck at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 23 Oct 2007 14:38:07 +0200
- Subject: [ECOS] Atmel Dataflash driver in combination with AT91SAM7SE512
Hi,
I'm currently working on porting eCos to support the Atmel
AT91SAM7SE-EK board. This board hosts the Atmel AT91SAM7SE512, which
is very similar to the AT91SAM7S which is already supported. The main
differences are the support for an EBI (external bus interface) to
interface all kind of memory devices and the incorporated SDRAM
controller.
I'm using the normal eCos branch enhanced with the flash_v2 branch extensions.
I was playing around with the SPI peripheral and an Atmel AT45DB041B
and the dataflash driver. The AT91SAM7SE512 forces me to pick a
certain SPI mode, so I configured the controller to use SPI mode 0
(also supported by the AT45DB041B). The problem is that the AT45DB041B
uses other OP codes for reading when in SPI mode 0 or 3.
The dataflash driver uses following OP codes for reading:
#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
according to the AT45DB041B datasheet these are only used when the
clock polarity of SPI is don't care. (Inactive Clock polarity low or
high to quote the datasheet)
Since I'm forced to use an SPI mode, the OP codes (for SPI mode 0 or
3) should be:
#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
I was wondering how I could adapt the driver to use the different OP
codes in this case. Would a CDL configuration like
DATAFLASH_MODE03_OPCODES be a good approach?
Currently, this is the only working solution I can imagine, since the
dataflash driver only knows a generic cyg_spi_device which has no clue
about the SPI mode needed by the physical SPI device.
Any suggestion are most welcome.
Regards,
Tom Deconinck
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss