I have been experimenting with interfacing my analog microcontroller with an SD card using the FatFs module.
I have worked out the communication with the card through SPI. Initialization, reading and writing all function nicely.
Thing is, when I try to save the data transmitted by the sd card for the fat module to use, the microcontroller crashes.
I am sure I am overlooking something very basic, but can not seem to find the error.
I have attached an image of the code snippet, which I suspect to be wrong in some way. It first sends the reading command to the sd card, then it waits for the sd card to start transmitting and saves the recieved data into the buffer as intended. Then the crash occurs right after the return statement. According to the debugger, the processor recieves a fault interrupt, putting it into an infinite loop.
I would be grateful if someone could help clearing this up for me.