完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛扫一扫,分享给好友
|
在PSOC5设计中使用全双工UART。
当RX缓冲区大小为4时,我不理解中断是如何工作的。 从数据表: 当(Rx/Tx)缓冲区大小设置为大于4的值时,UART组件使用内部中断将数据从硬件FIFO移动到软件FIFO。在这种情况下,使用内部ISR添加自定义代码来处理“用户代码”区域中的数据。 注意外部中断只针对硬件FIFO生成。 当接收到的数据溢出我指定的RX缓冲区大小时,ISRUUARTARIX RX(自动生成)会发生火灾吗?还是在接收到每个字节后触发? 我已经看过了示例项目,目前还不清楚。 内部中断是否在后台工作,将字节转移到缓冲区中,还是触发ISRUUARTARYX RX自动生成代码? 在我的应用程序中,RX将接收来自另一个内部板的数据,所以我确切地知道需要多少字节(46字节)。所以,如果我能在收到很多字节时发射ISR,那就没问题了。 谢谢 丹 以上来自于百度翻译 以下为原文 Using a full duplex UART in a PSoC5 design. I don't understand how the interrupts work when the RX Buffer Size is > 4. From the data sheet: When the (Rx/Tx) Buffer size is set to a value greater than 4, the UART component uses the internal interrupts to move the data from Hardware FIFO to a software FIFO. In this case, use the internal ISR to add custom code to process the data in the "User Code" regions. Note External interrupts are generated only with respect to the Hardware FIFO. Does the ISR_UART_RX (auto-generated) fire when the received data overflows the RX Buffer Size that I have specified? Or does it fire after each byte is received? I have looked at the example projects and it's not clear. Does the internal interrupt work in the background to transfer the bytes into the buffer, or does it trigger the ISR_UART_RX auto-generated code? In my application, the RX will received data from another internal board, so I know exactly how many bytes to expect (46 bytes). So if I can fire the ISR when that many bytes are received that's fine. Thanks dan |
|
相关推荐
5个回答
|
|
|
当接收到的数据溢出RX缓冲区时,ISRUUARTYRX(自动生成)会发生火灾吗?
不,当接收FIFO中至少有一个字节并将数据传输到缓冲器时,它会发生火灾。 最简单的方法是使用UARTHETGETBuffResiZe()API进行投票,该API返回缓冲区中实际的字节数(而不是缓冲区的大小)。 鲍勃 以上来自于百度翻译 以下为原文 Does the ISR_UART_RX (auto-generated) fire when the received data overflows the RX Buffer No, it fires when there is at least one byte in the receive FIFO and transfers the data into the buffer. Easiest would be to poll using UART_GetBufferSize() API which returns the number of bytes actually in the buffer (not the size of the buffer) Bob |
|
|
|
|
ncmza 发表于 2018-12-6 09:12 谢谢鲍伯- 所以告诉我这是否正确:每一个接收字节触发ISR,并将该字节转移到软件缓冲区。当我使用UARTHAREADRXDATA()读取数据时,我得到了缓冲区中最新的字节吗? 有没有办法读取接收缓冲区作为字符数组?我想等待46字节,然后处理这些字节,然后清除缓冲区,等待下一个46字节。 在UART的数据表中,我没有看到以数组形式访问缓冲区的方法。 以上来自于百度翻译 以下为原文 Thanks Bob - So tell me if this is correct: each received byte triggers the ISR, and also transfers that byte into a software buffer. When I read athe data using UART_ReadRxData(), I get the most recent byte in that buffer? Is there a way to read the receive buffer as a character array? I want to wait for 46 bytes to be received, then process those bytes, then clear the buffer and wait for the next 46 bytes. In the data sheet for the UART I do not see a way to access the buffer as an array. |
|
|
|
|
zzecom 发表于 2018-12-6 09:28 缓冲器被布置为循环缓冲器。因此,虽然它是一个字节数组,但很难将数据作为数组访问。 当您不想像我前面所描述的那样进行轮询时,您需要编写自己的中断处理程序,这在FIFO不空时触发不是太困难。 鲍勃 以上来自于百度翻译 以下为原文 The buffer is arranged as a circular buffer. So, although it is a byte array, it is difficult to access the data as array. When you do not want to poll as I described before, you need to write your own interrupt handler This is not too difficult when triggering on FIFO not empty. Bob |
|
|
|
|
ncmza 发表于 2018-12-6 09:36 谢谢,是的,我一直在修改DVK上的一个示例项目,我看到,如果我只是在数据输入时加载自己的数组,它就可以工作得很好。将UART RX缓冲区设置为4,启用“字节上接收”中断,然后只需填充我的数组并跟踪其中有多少数据。这很好,所以我会坚持下去的。 丹 以上来自于百度翻译 以下为原文 Thanks, yes I've been modifying an example project on a DVK and I see that it works great if I just load up my own array as the data comes in. Set the UART RX buffer to 4, enable the "On Byte Received" interrupt, and then just fill up my array and keep track of how much data is in there. That's working fine so I'll stick with it. Dan |
|
|
|
|
zzecom 发表于 2018-12-6 09:53 最好使用“FIFO非空”中断。从接收器到FIFO的传输是在硬件中完成的,所以一些沉重的CPU使用不会导致数据被下一个字节覆盖。 鲍勃 以上来自于百度翻译 以下为原文 Better use the "FIFO not empty" interrupt. Transfer from receiver to FIFO is done in hardware, so some heavy CPU usage will not cause data to be overwritten with the next byte. Bob |
|
|
|
|
只有小组成员才能发言,加入小组>>
786个成员聚集在这个小组
加入小组cyUSB3014一直显示2.1,不能到3.0情况,谁遇到过
7088 浏览 0 评论
2474 浏览 1 评论
2166 浏览 1 评论
4031 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
2073 浏览 6 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
7566浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
6114浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
742浏览 2评论
710浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
7962浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 00:51 , Processed in 0.881003 second(s), Total 82, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2406