本帖最后由 hello_zkp 于 2015-12-11 14:48 编辑
补充一下,我是通过单步调试查到程序一直卡在 “while(!(SPI0SR_SPIF)); //等待接收” 的,查过一个论坛,有这种说法:
Hello,
When processing a single byte at a time, such as with the previous code snippet, the period that SPTEF flag remains low will be very short, typically a few bus cycles only. During debug, it is therefore unlikely that you would ever observe the flag being cleared.
However, you should not single step through the function for another reason. The monitoring of the SPISR and SPIDR registers by the debugger can inadvertently cause the SPIF flag to be cleared prior to the wait loop being exited. The function will then never exit.
Regards,
Mac
以前很多其他程序也是用单步调试来排错的,现在有些困惑了
|