hi,
i have a csm12c32 dev. board. im trying to use SPIto communicate with an accelerometer sensor.
according to the manual of mc9s12 series, SPIF flag of SPISR(status reg.) shouldnt be cleared until SPIDR is read. but it is going back to 0 while im trying to check if a transmition is complete. with debug, i can see SPIF becomes '1' after writing data to SPIDR. when i try to read this flag i get 0.
i compiled same code for full chip simulation and it works as it is suppsed to be.
any ideas about what i am doing wrong?
Hello,
The read of the registers by the debugger will provide the flag clearing mechanism. So it is possible that the wait loop for the completion of the transfer will never exit if the flag becomes spuriously cleared within the loop. Do not directly monitor either the SPI status register or the SPI data register during debug.
Regards,
Mac