No.80263 作者:liufengzhong 邮件:l_fz@sina.com ID:149522 登陆:12次 文章数:695篇 最后登陆IP:183.13.93.245 最后登陆:2015/6/16 17:02:27 注册:2014/7/29 21:51:15 财富:3671 发帖时间:2014/9/2 23:39:14 发贴者IP:111.221.200.181 标题:liufengzhong:[转帖]如何重置使用/ CS信号的XS1 SPI接口? 摘要:No.80263[转帖]如何重置使用/ CS信号的XS1 SPI接口? 您好所有XCore成员 我面临着一个严重的问题,从XMOS的SPI 1.4.0从组件。它似乎并不当主线程开始采取适当的考虑/ SPICS信号。 主循环开始以下列顺序: // Wait until CS is asserted nSPICS when pinseq(0):> void; // Wait until SPICLK is in idle state SPICLK when pinseq(1):> void; 端口反序列化使用的是32位,在while()循环缓冲端口的数据,但它永远不会再检查SPICS信号。但SPI要求通信必须重置(输入的数据将被丢弃,该位计数器必须重新启动为0)时/ SPICS再次变高。 如果我设置/ SPICS信号为高电平时,XS1口只是停止服用时钟考虑并停止反序列化。所以,如果我重置SPI主(的XS1是在我的应用程序的奴隶),无需重新设置XS1,而这是接收数据,该数据被移位(例如,如果我重新设置了主,而XS1已经收到5位,我将得到的XS1下一数据之后的下一个时间,而不是32 27个时钟,因为在端口的位计数器保留的最后一个值,而当/ SPICS被设置为1,须重置) 有没有一种方法来强制解串器的一个端口被重置为0时/ SPICS信号变为高电平(数据解串器是不完整的,当然,但至少解串器正确复位)? 我已看的XS1库文件,但是我无法找到任何东西重设缓冲端口 感谢由您的帮助 伯努瓦 回答: 您可以使用clearbuf(空端口P)丢弃在缓冲区中的任何数据; 这将重置串行器,你将同步了! 它的原型在xs1.h - 值得拥有的,通过这个文件的扫描。各种在里面有用的内部函数的高级用法! /** * Clears the buffer used by a port. Any data sampled by the port which has not * been input by the processor is discarded. Any data output by the processor which * has not been driven by the port is discarded. If the port is in the process * of serialising output, it is interrupted immediately. * If a pending output would have caused a change in direction of the port then * that change of direction does not take place. If the port is driving a value * on its pins when clearbuf() is called then it continues to drive * the value until an output statement changes the value driven. * \param p The port whose buffer is to be cleared. */ void clearbuf(void port p); 回复: 谢谢您的回答 不过,我仍然不知道cl ......
>>返回讨论的主题
|