More tea please.

SD Joy

This makes me feel very happy:

Breakpoint 1, sd_state_run (in_byte=201 '', ob=0x272 "z\002\223")
    at sd.c:366
366                             r_received = FALSE;
(gdb) print r_err
$1 = FALSE
(gdb) print/x csd
$3 = {0xaa, 0x55, 0x0, 0x0, 0x0}

r_err is a variable which states whether the SD card reported an error in its response to the read command. The csd array stores 5 of the bytes read from the SD card. The byte ordering is the wrong way around, but other than that it’s all fine.

After spending several millennia attempting to discover what was causing my MSP430 to reset randomly, I realised that it was because I hadn’t got any RAM left. I think that the bss/text sections began to overlap with the stack – which wasn’t pretty! I had previously been attempting to store 64 bytes of data read from the SD card in an array. This meant that there were 114 bytes of the 128 bytes of memory in use, leaving only 14 bytes for the stack.

Reducing this array to 5 bytes (I’m not that interested in buffering more than 1 byte from the SD card) solved all problems. Now I can read data! w00t.

Posted at 5:01 pm on Tuesday 28th August 2007

Comments are closed.

Site by Rob Gilton. © 2008 - 2019