Hello,

I opened a new PR this morning adding some initial support for SPI MMC
cards. I left some remarks there on limitations, etc. For lack of having
a Mynewt supported board that also has onboard MMC I used a
STM32F4-discovery and wired up an external LCD board that bundles a MMC
slot. It is almost exactly like this model here:

https://aliexpress.com/store/product/2-8-inch-2-8-TFT-LCD-Module-Display-ILI9325-240x320-with-Touch-panel-SD-card/1194705_32251525148.html

The PR is this one:

https://github.com/apache/incubator-mynewt-core/pull/137

The tests were done using FAT formatted cards. I did not add the main
test app's code yet because it needs clean ups and changes to the
FS/"Flash?" layer. To get this to work right now the Mynewt FAT glue
needs to be changed to call mmc_read/mmc_write instead of
hal_flash_read/hal_flash_write. The code I used is available on another
branch here:

https://github.com/utzig/incubator-mynewt-core/blob/mmc-support-full/apps/mmctest/src/main.c

For the sake of completeness I'm copying some of the current limitations
below (also added them as comment on the PR):

1. After initialization the SPI clock can be switched to 25MHz (from
100KHz). I was not able to make it work probably because of the wire-ups
between my boards.

2. There are 3 main types of MMC/SD cards (standards!?!?). Two of them
use very similar initialization and another uses a different path
(older/smaller cards). I only tested the code with newer SDHC/SDXC path.

Btw, the path that initializes older cards is not complete and I
currently don't have a card that could be used to test that (but I have
a Palm E2 somewhere that has an 128MB SD that is probably that
standard). I left TODOs in the code:

https://github.com/apache/incubator-mynewt-core/pull/137/files#diff-1195ab38931fccef6483bb26911bf8f7R316

3. FAT already breaks big reads/writes into sector reads/writes (512
byte) so multi-block read/write commands were only tested with sector
sized reads/writes (basic sanity test).

4. All SPI transfers are currently done using polled byte transfers
instead of block transfers. Would also be better to do interrupt driven
block reads/writes.

The next step now is to make hal_flash, mmc (and the future spi flash)
devices interchangeable for the FS's.

Cheers,
Fabio Utzig

Reply via email to