diff --git a/BaS_gcc/.cproject b/BaS_gcc/.cproject index 03fcccc..8d224bc 100644 --- a/BaS_gcc/.cproject +++ b/BaS_gcc/.cproject @@ -1,7 +1,5 @@ - - - + @@ -57,7 +55,6 @@ - @@ -118,6 +115,9 @@ + + + diff --git a/BaS_gcc/sources/init_fpga.c b/BaS_gcc/sources/init_fpga.c index fbddc13..1571713 100644 --- a/BaS_gcc/sources/init_fpga.c +++ b/BaS_gcc/sources/init_fpga.c @@ -24,6 +24,7 @@ #include #include "sysinit.h" +#include #define FPGA_STATUS (1 << 0) #define FPGA_CLOCK (1 << 1) diff --git a/BaS_gcc/sources/mmc.c b/BaS_gcc/sources/mmc.c index 24ed1b2..9343523 100644 --- a/BaS_gcc/sources/mmc.c +++ b/BaS_gcc/sources/mmc.c @@ -251,6 +251,13 @@ static int rcvr_datablock(uint8_t *buff, uint32_t btr) token = xchg_spi(0xFF, 0); /* This loop will take a time. Insert rot_rdq() here for multitask environment. */ } while ((token == 0xFF) && MCF_SLT_SCNT(0) > target); + + if (token == 0xff) + { + xprintf("no data start token received after 500ms in rcvr_datablock\r\n"); + return 0; + } + if (token != 0xFE) { xprintf("invalid token (%x) in rcvr_datablock()!\r\n", token); @@ -296,6 +303,9 @@ static int xmit_datablock(const uint8_t *buff, uint8_t token) return 0; } } + + wait_ready(30000); + return 1; } #endif