[En-Nut-Discussion] SAM7X SPI
Tim DeBaillie
debaillie at ciholas.com
Tue Sep 12 17:50:44 CEST 2006
On Wed, 6 Sep 2006, Harald Kipp wrote:
> Have a look to the arch/arm/dev/spimmc_at91.c.
>
> Not perfect, but it shows how to use the SPI interface for the
> MMC/SD Card interface.
from the spimmc_at91.c file:
/* SPI enable and reset. */
outr(SPI0_CR, SPI_SPIEN | SPI_SWRST);
outr(SPI0_CR, SPI_SPIEN);
/* Set SPI to master mode, fixed peripheral at CS1, fault detection
disabled. */
outr(SPI0_MR, (1 << SPI_PCS_LSB) | SPI_MODFDIS | SPI_MSTR);
/* Data changes during clock low and will be sampled on rising edges. */
outr(SPI0_CSR1, (3 << SPI_SCBR_LSB) | SPI_CPOL);
~~~~~~~~~
Why would you enable and reset the SPI, then enable it again, then setup
the mode register, then setup the chip select register?
Should I not setup the mode and chip select registers before enabling the
SPI?
Does anyone have working code that this driver was used in? I would like
to see how you interface with the driver.
Thanks,
Tim
--
Tim DeBaillie 812-476-2721 x102
Ciholas Technologies 812-476-2881
255 South Garvin St. debaillie at ciholas.com
Evansville, IN 47713 www.ciholas.com
More information about the En-Nut-Discussion
mailing list