Skip to content

Commit 1882ae3

Browse files
committed
calling SPI config only once to avoid panic code 090
1 parent b8fee07 commit 1882ae3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sdmm.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ static DSTATUS Stat = STA_NOINIT;
113113

114114
static BYTE CardType;
115115

116+
bool enabled = false;
117+
116118
static void xmit_mmc(
117119
const BYTE *buff,
118120
UINT bc)
@@ -281,9 +283,15 @@ DSTATUS disk_initialize(
281283

282284
CS_INIT();
283285
CS_H();
284-
p = allocSPI();
285-
p->frequency(1000000);
286-
p->format(8, 0);
286+
287+
if(!enabled)
288+
{
289+
p = allocSPI();
290+
p->frequency(10000);
291+
p->format(8, 0);
292+
enabled = true;
293+
uBit.serial.send("Called!\n");
294+
}
287295

288296
for (n = 10; n; n--)
289297
{

0 commit comments

Comments
 (0)