This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi
I am working with Flash memory through SPI.
My code looks like that:
ReadPage( ... ...)
{
...
SendFlashCmd(READ); // Send READ command
...
...
}
void SendFlashCmd(char cmd)
{
SpiaRegs.SPITXBUF = cmd << 8; // Send command
PollSPIInterrupt();
}
void PollSPIInterrupt()
{
char dummy; // dummy character to access read SPI
while (!SpiaRegs.SPISTS.bit.INT_FLAG) {} // Check that command is sent
dummy = SpiaRegs.SPIRXBUF; // Reset Interrupt flag
}
Hi Yvon
thank you for your reply. I am not sure why but the example code I posted above works when I do not write the dummy byte (line above bold one). Since I am working on another problem I will leave SPI for a while. If I find an explanation for this or if it was not the solution I will post it here.
regards stephan