Ich hab eine Applikation mit MMC (angelehnt an das Beispiel im Framework
des Studios ohne RTOS) geschrieben. Die MMC Karte wird nach Start
erkannt und gelesen, entferne ich jedoch diese aus dem Slot und schiebe
sie wieder herein, so wird diese nicht mehr gelesen. Am folgenden Punkt
wird unterbrochen (siehe Pfeil):
original code aus framework sd_mmc_spi.c
1 | Bool sd_mmc_spi_check_presence(void)
|
2 | {
|
3 | U16 retry;
|
4 |
|
5 | retry = 0;
|
6 | if (sd_mmc_spi_init_done == FALSE)
|
7 | {
|
8 | // If memory is not initialized, try to initialize it (CMD0)
|
9 | // If no valid response, there is no card
|
10 | while ((r1 = sd_mmc_spi_send_command(MMC_GO_IDLE_STATE, 0)) != 0x01)
|
11 | {
|
12 | spi_write(SD_MMC_SPI,0xFF); // write dummy byte
|
13 | retry++;
|
14 | if (retry > 10)
|
15 | -> return KO; //
|
16 | }
|
17 | return OK;
|
18 | }
|
19 | else
|
20 | {
|
21 | if ((r1 = sd_mmc_spi_send_command(MMC_CRC_ON_OFF,0)) == 0x00)
|
22 | return OK;
|
23 | sd_mmc_spi_init_done = FALSE;
|
24 | return KO;
|
25 | }
|
26 | }
|
r1 ist hier dann immer 0xe0, müsste aber 0x01 sein. Ein Blick in das
Header-File sagt mir, dass die Flags MMC_R1_BUSY,MMC_R1_PARAMETER und
MMC_R1_ADDRESS gesetzt sind.
Das beschriebene Problem habe ich mit einer SanDisk 128MB Karte, jetzt
hab ich einfach mal zum Ausprobieren eine Fujifilm 256MB genommen und
siehe da, es geht!
Hat jemand eine Idee warum?