Well, this is somewhat embarrassing, but I'm finally frustrated enough to ask for help. I have a simple routine to read 3 bytes from the SPI. It worked just fine through months of development, and then something changed, and now it always returns zeros despite the correct data clearly present on a scope (screenshots attached). This is an MK10DX128VMP5, using the IAR tools, with the SPI routines and drivers generated by PE. What I should get is statbyte[0] = 0x40, statbyte[1] = 0x00, and statbyte[2] = 0x0B, but instead they are all 0x00.
MYSPI_ClearRxBuf();
STROBE_MISO_PutVal(1); //strobe is done with GPIO pins
STROBE_MISO_PutVal(0);
for(i=0; i<3; i++){
MYSPI_SendChar(0x00); //clock in a char
spibyte = MYSPI_RecvChar(&statbyte[i]); //get it
}
STROBE_MISO_PutVal(0);
Does anybody know what's going on? I also attached a screenshot showing the spi configuration registers.
Thank you!!!