本帖最后由 Mindor 于 2010-1-22 19:06 编辑
一些调试总结:
1、写完代码开始硬件调试的时候,发现在keil上调试仿真的时候控制开发板上的LED等闪烁是没问题的,可是下到单片机上调试却发现很不符合逻辑,该闪的时候不闪,不该闪的时候闪个不停。后来发现原来是我定义一个缓冲区(用来接收从SD卡读取的数据)定义到data去了,改成xdata之后又行了。不过不明白为什么,有人知道吗?
2、SD卡手册中提示:After power up, the host starts the clock and sends the initializing sequence on the CMD line. This sequence is a contiguous stream of logical ‘1’s. The sequence length is the maximum of 1msec, 74 clocks or the supply-ramp-uptime; the additional 10 clocks (over the 64 clocks after what the card should be ready for communication) is provided to eliminate power-up synchronization problems.
即:在SD卡上电期间需要往SD卡发送连续的高电平‘1’
3、写完一个命令后延时8个时钟,以确保和SD卡时钟同步。
4、写完一个数据块时返回的数据为 0X×××00101,调试过程中发现收到的数据是0xE5,但数据依然可以写进去,搞了半天,还以为数据手册有误呢~(要有怀疑精神嘛^_^),其实0xE5也是没错的。
……
先说这几点吧!调试过程中没注意记下问题,下次会注意点哈~如果有人也在做这个有不明白的一起交流,都是新手,怕啥?哈哈~
|