Hi everyone,
I'm facing a problem with the interrupt DSPI driver on Kinetis K60, using MQX 3.7 and Codewarrior 10.1.
I'm interfacing a SPI dataflash AT45DB161D. If I use the polled DSPI driver everything works fine, the problem rises only in interrupt mode.
My code is the following:
/* assert CS, send command*/ data[ 0 ] = 0x9F; if( 1 != fwrite( data, 1, 1, com )) { fflush( com ); return FALSE; } /* wait for response */ if(4 != fread( data, 1, 4, com )) { fflush (com); return FALSE; } /* deassert CS */ if (MQX_OK != fflush (com)) { return FALSE; } return TRUE;With an oscilloscope, I can see 5 clock packets on the SCK line, the 0x9F command byte on the SOUT line at the first clock packet and the 4 data bytes on the SIN line at the other 4 clock packets: the hardware works ok. The problem is that the fread function returns always 0 byte read.
How can I fix this? Must the interrupt DSPI driver be changed due to a bug or my code has to be modified?
Many thanks
Teckna