完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
嗨,
我有一个STM8S003F3,在双向半双工模式下配置为从机。 在它接收字节的时间内,我可以等待RXNE标志知道字节已被完全接收。但是,我想知道发送时的同一时间。 TXE没有帮助。 让我来证明一下。当有转移时,想象这是时钟。 (TXE)-_-_-_-_-_-_-_-_(RXNE) 由于TX缓冲区被复制到移位寄存器,因此字节时钟开始时的TXE变为真。这当然仅在发送模式下发生。但这显示了传输的_beginning_。 字节时钟结束时的RXNE变为真,因为RX缓冲区被从移位寄存器复制到。这仅在接收模式下发生。 我希望能够轮询同一时刻轮询RXNE,但是在传输模式下。 我试过(似乎没问题)使用BSY标志。但是,数据表本身说: 注意:请勿使用BSY标志来处理每次数据传输或接收。最好使用TXE和RXNE标志。 如果我不能使用BSY标志,那么我可以使用什么(因为RXNE没有设置为发送模式)? #slave #bidirectional #spi 以上来自于谷歌翻译 以下为原文 Hi, I have an STM8S003F3 that is configured as a slave in a bidirectional half-duplex mode. During the time it receives bytes, I can wait on the RXNE flag to know the byte has been completely received. However, I want to know the same time for when it is transmitting. TXE doesn't help. Let me demonstrate. When there is a transfer, imagine this is the clock. (TXE)-_-_-_-_-_-_-_-_(RXNE) TXE at the beginning of the clocking of the byte becomes true because the TX buffer gets copied to the shift register. This happens of course only in transmit mode. But this shows the _beginning_ of the transmission. RXNE at the end of the clocking of the byte becomes true because the RX buffer gets copied to from the shift register. This happens only in receive mode. I want to be able to poll the same moment polling RXNE would, but in transmit mode. I have tried (and it seems to be ok) to use the BSY flag. However, the datasheet itself says: Note: Do not use the BSY flag to handle each data transmission or reception. It is better to use TXE and RXNE flags instead. If I can't use the BSY flag, what can I use then (Since RXNE doesn't get set in transmit mode)? #slave #bidirectional #spi |
|
相关推荐
1个回答
|
|
|
我的测试表明,有时在传输过程中,BSY标志甚至不会在两个字节传输之间发生故障(无论我在它们之间放置什么延迟),因此看起来BSY标志对于此测试确实不可靠。
我试着等待TXE,然后查看13个时钟更改,这对于慢速通信(例如125Kpbs)有效,但由此产生的`for`-`while循环组合导致每个边缘的检测延迟大约为1.2us,这对于高端来说是不可接受的。 SPI速率(例如4Mbps)。 有没有人曾经在SPI从模式下使用STM8作为双向半双工?如果不知道在传输一个字节后何时切换到接收模式是安全的,那么整个模式就不值得蹲下! 附:我尝试在TXE设置后立即切换到接收模式(希望微型会等待传输结束),但是立即切换到接收模式,这当然会破坏输出。 以上来自于谷歌翻译 以下为原文 My tests show that sometimes during transmission, the BSY flag doesn't even go down between two byte transfers (no matter what delay I put in between them), so it seems that BSY flag is indeed unreliable for this test. I tried waiting for TXE and then looking at 13 clock changes which works for slow communication (e.g. 125Kpbs), but the resulting `for`-`while` loop combination results in about 1.2us detection delay for each edge, which is unacceptable for high SPI rates (e.g. 4Mbps). Has anyone ever used STM8 as bidirectional half-duplex in SPI slave-mode? Without knowing when it's safe to switch to receive mode after the transmission of a byte, this whole mode wouldn't be worth a squat! P.S. I tried switching to receive mode right after TXE is set (hoping the micro would wait for the transmission to end), but that immediately switched to receive mode which of course corrupted the output. |
|
|
|
|
只有小组成员才能发言,加入小组>>
stm32mp157的异核通信的rpmsg_sdb的m4固件和a7驱动该如何编写?
1453 浏览 0 评论
stm32f103用freertos对一个采样率为1kHz的传感器,进行采样,数据出差
1502 浏览 0 评论
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
3649 浏览 1 评论
3842 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
2461 浏览 1 评论
STM32H7打开DCache后,出现了串口接收信息为空的现象,是哪里出了问题?
727浏览 5评论
用NANO STM32F103RBT6的开发板烧录不了是哪里出了问题?
663浏览 5评论
710浏览 5评论
外部中断触发类型为双边沿触发,进入中断回调后有什么办法判断该边沿是上升沿还是下降沿?
941浏览 5评论
STM32L071CBT6低温环境下无法正常工作是什么原因引起的?
745浏览 5评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 07:27 , Processed in 0.687712 second(s), Total 72, Slave 55 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
864