完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
好的,我有一个非常简单的程序,它只需要从UART中发射一个字符数组。在它开始通信之前,它会发送一个高电平的数字线,然后一旦它完成,它就再次使它变低。
该项目是附加的,但这里是任何人谁想要一个快速扫描。 它是直向前的,据我所知,在UART已经完成发送它的每个字节之前,没有任何方法可以达到零。然而现实却大不相同。 如果你看绿色通道是UART TX线,黄线是划线。如果你注意到在你可以预料到的情况下,传输线会很高,但是在所有字符完成发送之前,它会立即变低。我认为UART是从C代码异步操作的,它只是从for循环中输入,然后在稍后的计时器发送它们。有人知道如何强制它同步运行吗?也许有一个状态位我可以检查? 以上来自于百度翻译 以下为原文 Okay so I have an extremely simple program, all it does it shoot an array of chars out of the UART. Before it starts communicating it sends a digital line high, then once it's done it makes it low again. The project is attached but here it is for anyone who wants a quick scan. It is straight forwards enough, as far as I can tell, there is no way that the line can go to zero until the UART has finished sending every one of its bytes. However the reality is much different. If you look the green channel is the UART TX line and the yellow line is the lineDriver. If you notice the line goes high just before transmitting as you could expect, however it then goes immediately low before all the chars have finished sending. I think that the UART is operating asynchronously from the C code, it is just taking the inputs from the for loop and then sending them at a later timer. Does anyone know how to force it to run synchronously? maybe there is a status bit I can check for? |
|
相关推荐
9个回答
|
|
忘了附上这个项目
这是所有的PSoC 4245-AXI48 3的方式。 PSoC 4测试 609.3 K 以上来自于百度翻译 以下为原文 oops forgot to attach the project This is all on the psoc 4245-axi483 by the way.. |
|
|
|
您的TX缓冲区大小为8,因此for循环正在快速填充。
(只要BUS可用,写就是阻塞未决总线可用性)。 基本上,for循环早完成,UART稍后完成。 因此,加载缓冲器然后启动UART,或者使用ISR来指示TX缓冲器为空。 后者意味着你要小心地启用ISR以确保它不会过早起火。 问候,Dana。 以上来自于百度翻译 以下为原文 Your Tx buffer is sized at 8, so the for loop is filling that up rapidly (as long as buss is available, write is blocking pending buss availability). So essentially the for loop completes early and UART finishes later. So load buffer then start UART and or use ISR to indicate Tx buffer empty. Latter means you enable that ISR carefully to insure it does not fire early. Regards, Dana. |
|
|
|
图像没有张贴。
忘了提到,在ISR翻转引脚低。 附上图像。 UART TX ISR.JPG 334.9 K 以上来自于百度翻译 以下为原文 Image did not post. Forgot to mention, in ISR flip pin low. Image attached.
|
|
|
|
当你等待发送的所有字符,然后设置低行,一切都会好的。函数UARTPTCHARE()将字符存储在缓冲器中,并在缓冲区满时仅阻塞。
使用UARTHAREADTXXSTATUS(),您可以看到FIFO是否为空,并且可以看到最后一个字节是否成功传输。 鲍勃 以上来自于百度翻译 以下为原文 When you wait for all characters transmitted and THEN set the line low, all would be fine. The function UARTPutchar() stores the characters in a buffer and only blocks when the buffer is full. With UART_ReadTxStatus() you can see if the FIFO is empty and you can see if the last byte is transmitted successfully. Bob |
|
|
|
好的,谢谢你的回复,但我有点困惑。
鲍伯uuUARTHealtXXSTATUSER();函数对我来说是不可撤销的,它似乎没有在自动完成上出现。 丹达克你是说我需要增加我的缓冲区大小,然后设置一个TX空中断。如果是这样的话,这个中断不仅仅是在我不发送的时候连续地发射,就像在我得到UART代码之前一样?此外,在您的示例JPEG中使用了内部中断,我不知道如何处理这些,我以前只使用外部中断。 以上来自于百度翻译 以下为原文 Okay thanks for the replies but I am a bit confused. Bob you UART_ReadTxStatus(); function is unvailable to me it seems, it doesn't come up on autocomplete. danadak are you saying that I need to increase my buffer size, and then set a tx empty interrupt. If so does this interrupt not just fire continuously while I am not transmitting, like before I even get to my UART code? Also in your example jpeg you used an internal interrupt, I am not sure what to do with these, I have only used external ones before. |
|
|
|
对不起,我在UDB组件。
内部中断是模块内部并保持其工作状态。在您的示例中,它关心从缓冲区向Tx寄存器发送下一个AAYLabbit字符(从一个比特传输一个比特)。当发送时,中断(启用时)中断,这样您就有机会对发送的字符进行计数。完成后把你的线设置为“低”。 鲍勃 以上来自于百度翻译 以下为原文 Sorry, I was at the UDB-Component. Internal interrupts are INTERNAL to the module and keep it working. In your example it cares for sending the next availlable character from the buffer to the Tx register (from which it is transmitted bit-by-bit). When transmitted an interrupt is fired (when enabled) so you have the chance to count the transmitted characters. When done set your line to "low". Bob |
|
|
|
由于每次发送一个字节,PutChar函数只需填充TX缓冲器,而不等待传输实际完成。不幸的是,你不能减少TX缓冲液波纹管8。
您可以使用SCBISPIGARTGETTXBuffResiZe()来查找TX缓冲区是否为空,并且可以等待直到它。虽然我不确定它是否在最后一个比特被成功传输之后,或者当它从缓冲器中被发送来进行传输时。 以上来自于百度翻译 以下为原文 since you are sending a byte at a time the PutChar function is simply filling the TX buffer and returning not waiting for the transmission actually completing. Unfortunatelly you can´t reduce the TX buffer bellow 8. You could use SCB_SpiUartGetTxBufferSize() to find out if the TX buffer is empty and can wait intill it is. Although I'm not sure if it returns after the last bit has been succefukly transmitted or when it is picket from the buffer for transmission. |
|
|
|
Tx ISR在TX Buff为空时发生火灾,因此如果所有发送和lt;=缓冲区大小,则得到一个。
ISR,然后在ISR中禁用它,直到再次准备发送为止。如果你得到不止一个,炭 String超过缓冲区大小,忽略第一个N-ISR ISR的代码。 注意你可以编码 字符响应[]=“a”,“b”,“c”,“d”,“e”,“f”,“g”,‘0’}; 并使用PtrString发送整个字符串。ISR注释仍然来自上面。 问候,Dana。 以上来自于百度翻译 以下为原文 The Tx ISR fires when Tx buff is empty, so if all you send <= buffer size, you get one ISR, then you disable it in ISR until ready to send again. If you get more than one, char string exceeds bufffer size, code that to ignore the first N - 1 ISRs. Note you can code char response[] ={ 'a', 'b', 'c', 'd', 'e', 'f', 'g', '/0' }; and use putstring to send the whole string. ISR notes still pertainent from above. Regards, Dana. |
|
|
|
记住,你知道你将发送多少字符,因此
有多少ISR你会得到,直到最后一个,取决于 缓冲区大小。 问候,Dana。 以上来自于百度翻译 以下为原文 Keep in mind you know how many chars you will be sending, hence how many ISRs you are going to get until the last one, depending on buffer size. Regards, Dana. |
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2075 浏览 1 评论
1829 浏览 1 评论
3643 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1766 浏览 6 评论
1517 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
515浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
366浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
413浏览 2评论
360浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
867浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 18:17 , Processed in 1.009276 second(s), Total 93, Slave 76 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号