Max speed of SPI port for SD/MMC?
using SPI on the LPC2103. Normal SD/MMC cards support max 25MHz for SD
and 20MHz for MMC.
If my LPC2103 is clocked at 70MHz, APB divider set to 1, then it looks
like the maximum speed I can get out of SPI0 is by setting the S0SPCCR
SPI clock counter register to it's minimum value of 8. 70MHz/8 =
8.75MHz, which seems pretty slow.
SPI1 is more complicated. Set APB divider to 1, SSPCPSR clock prescale
register to minimum value of 2 and SSPCR0.SCR to 0. This gives 70MHz /
(2 * (0+1)) = 35MHz, which is too fast. The next best setting would
then be SSPCPSR to 4 (only even values allowed), giving 70MHz / (4 *
(0+1)) = 17.5MHz.
If I wanted to hit the magic speed of 25MHz for SD Cards, I would have
to run the LPC2103 clocked at 50MHz. Then SSPCPSR set to 2 would
provide 50MHz / (2 * (0+1)) = 25MHz.
From what I understand, SPI1 also provides 8 byte FIFOs for
send/receive. It sounds like I need to use the SPI1 port, and forget
about the SPI0 port.
> to run the LPC2103 clocked at 50MHz. Then SSPCPSR set to 2 would
> provide 50MHz / (2 * (0+1)) = 25MHz.
That is correct.
> From what I understand, SPI1 also provides 8 byte FIFOs for
> send/receive. It sounds like I need to use the SPI1 port, and forget
> about the SPI0 port.
I would suggest using SPI1 if possible. Joel
> I'm a little confused at what speeds can SD/MMC cards be accessed
> using SPI on the LPC2103. Normal SD/MMC cards support max 25MHz for SD
> and 20MHz for MMC.
SPI is a low performance compatibility mode for MMC/SD cards, so it
hardly seems reasonable to expect it's performance to equal the native
mode performance, does it? To achieve the full performance
capabilities of SD/MMC requires a dedicated controller in the
microcomputer, and the more general purpose SPI interface is not that
controller. The speeds that can be reached by SPI do seem to enable a
rather large number of useful MMC/SD applications though!