diff --git a/fatfs/shimatta_sdio_driver/shimatta_sdio.c b/fatfs/shimatta_sdio_driver/shimatta_sdio.c index c327586..763079e 100644 --- a/fatfs/shimatta_sdio_driver/shimatta_sdio.c +++ b/fatfs/shimatta_sdio_driver/shimatta_sdio.c @@ -246,15 +246,19 @@ DRESULT SDIO_disk_read(BYTE *buff, DWORD sector, UINT count){ SDIO->DLEN = (1 << BLOCKSIZE); - /* Init Transfer */ - if (SDIO_send_read_block_CMD17(addr)) { - return RES_ERROR; - } + SDIO->ICR = SDIO_ICR_CCRCFAILC | SDIO_ICR_DCRCFAILC | SDIO_ICR_CTIMEOUTC | SDIO_ICR_DTIMEOUTC | SDIO_ICR_TXUNDERRC | SDIO_ICR_RXOVERRC | SDIO_ICR_CMDRENDC | SDIO_ICR_CMDSENTC | SDIO_ICR_DATAENDC | SDIO_ICR_STBITERRC | SDIO_ICR_DBCKENDC | SDIO_ICR_SDIOITC | SDIO_ICR_CEATAENDC; SDIO->DCTRL = (BLOCKSIZE<<4) | SDIO_DCTRL_DTDIR | /*SDIO_DCTRL_DMAEN |*/ SDIO_DCTRL_DTEN; + + /* Init Transfer */ + if (SDIO_send_read_block_CMD17(addr)) { + SDIO->DCTRL = 0; + return RES_ERROR; + } + debug=0; counter = 0; while (counter < (1<<(BLOCKSIZE-2)) || !(SDIO->STA & (SDIO_STA_DBCKEND | SDIO_STA_DATAEND))) { // TODO: Handle errors diff --git a/stm32f407vgt6_flash.ld b/stm32f407vgt6_flash.ld index 2b27460..d6d71ad 100644 --- a/stm32f407vgt6_flash.ld +++ b/stm32f407vgt6_flash.ld @@ -152,7 +152,7 @@ SECTIONS /* Uninitialized data section */ . = ALIGN(4); - .bss : + .bss (NOLOAD): { /* This is used by the startup in order to initialize the .bss secion */ _sbss = .; /* define a global symbol at bss start */ @@ -167,7 +167,7 @@ SECTIONS } >RAM /* User_heap_stack section, used to check that there is enough RAM left */ - ._user_heap_stack : + ._user_heap_stack (NOLOAD): { . = ALIGN(4); PROVIDE (heap_low = .); /* for _sbrk */