完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
您好,什么是最好的方式建立可靠的UART通信(波特率:9600)之间的DSPIC33 EP和PIC32 MX没有中断时,都是全双工。我对下面的信号没有任何经验。(RTS)表示设备准备发送数据(CTS),表示设备已准备好接受毫秒内的数据传输,这不是问题。请咨询……TS9。
以上来自于百度翻译 以下为原文 Hello, What is best way establish Reliable UART Communication (Baud Rate : 9600) Between dsPIC33EP and PIC32MX without Interrupts when both are Full Duplex .? I have not any experiences on below signals. (RTS) Indicates the device is ready to send data (CTS ) Indicates the device is ready to accept data Delay in Milliseconds will not be an issue . Please Advice... -- TS9 |
|
相关推荐
19个回答
|
|
|
将一个芯片的RTS连接到另一个芯片的CTS,反之亦然。启用UART配置中的硬件流控制。在您的SW中,只有当传输缓冲器空闲时才发送新的数据部分。并在可能的情况下,当接收到字符时,从RX缓冲区中提取字符。由于硬件流量控制,只有当接收侧准备好时,一个芯片的发射机才会传输。我不能说特别是针对PIC32 MX,但以上对于任何具有RTS/CTS引脚的UART都是常见的。
以上来自于百度翻译 以下为原文 Connect RTS of one chip to CTS of another and vice versa. Enable hardware flow control in UART configuration. In your SW send new data portion only when the transmission buffer is free. And pull the characters from RX buffer when possible and when there is a character(s) received. Due to hardware flow control the transmitter of one chip will transmit only when reception side is ready. I can't say particularly for PIC32MX but the above is common for any UART with RTS/CTS pins. |
|
|
|
|
|
感谢更新…NKOLYAY-POI已经检查了DSPIC33 EP FRM和PIC32 MX FRM都支持硬件Flow Controlas你指导我缺省UART选项。我需要任何其他设置/清除/检查代码,而不是Unln & lt;1:0gt;在代码中。附加UEN设置
以上来自于百度翻译 以下为原文 Thanks for Update...Nikolay_Po I have checked dsPIC33EP FRM and PIC32MX FRM Both supports Hardware Flow Control as you guide me for default UART Options. Do I need any other Setting/Clearing/Checking in code rather than UEN<1:0> in Code.? Attached UEN Setting.. TS9 Attached Image(s) |
|
|
|
|
|
当一个继续发送,而另一个将在500个中断中忙碌时,两者将如何执行?程序中的任何设置都避免了这种情况。
以上来自于百度翻译 以下为原文 And How both will perform when one is keep sending and other will busy in 500us interrupts...?? Any setting in program avoid this situation |
|
|
|
|
|
为了确保异步串行流的长期可靠性,需要验证两个端点之间波特率的最大相对误差小于2.5%,如果可能小于1%,则需要考虑所有错误源。这些包括在最低限度:振荡器频率精度和实际波特率在两个端点使用。根据您的设计,可能还有其他错误来源。
以上来自于百度翻译 以下为原文 To assure long term reliability for asynchronous serial streams you will need to verify that the maximum relative error in baud rate between the two endpoints is less than 2.5% and if possible less than 1%. You need to account for ALL error sources. These included at minimum: the oscillator frequency accuracy and actual baud rates used at both endpoints. Depending on your design there may be other error sources. |
|
|
|
|
|
谢谢DA1138。但是如何使用RTS和CTS PIN…?正如在MSG 3中所写的…
以上来自于百度翻译 以下为原文 Thanks dan1138.. But how to use RTS and CTS pins....? As written in Msg #3... |
|
|
|
|
|
假设您已经正确配置和连接了它。您会发现发件人TX缓冲器保持完整,直到接收器发出信号,发送方发出信号发送数据。
以上来自于百度翻译 以下为原文 Assuming you have configured and connected it correctly. You will find the senders tx buffer stays full until the receiver signals the sender signals it to send its data. |
|
|
|
|
|
这究竟意味着什么?如果接收方将在接收FIFO之前对USAT进行轮询,那么您根本不需要硬件握手。
以上来自于百度翻译 以下为原文 What does this actually mean? If the receiver will always poll the USART before the receive FIFO fills, then you don't need hardware handshaking at all. |
|
|
|
|
|
NKurZman 1)除UEN外,程序中有什么特殊设置吗?2)何时读取接收缓冲区?3)如何在中断和握手信号之间发送优先级?中断应该是更高的优先级4)如果发射机发射更快,然后接收(可能忙于中断),接收器会做什么?5)发射机在没有协调的情况下发送、排队或仅在最后一次更新的字节(如4)6)任何演示代码。是的,UART模式(非USAT)轮询数据比发送速率慢(在主循环中执行无限循环)。然后我跳过一些字节。硬件握手是要使用除了中断。UART应该能够全部接收数据。
以上来自于百度翻译 以下为原文 @NKurzman 1) Any Special Setting in Program except UEN? 2) When to read Receive buffer? 3) How to send priority between Interrupts and Handshaking signals? Interrupts should be higher priority 4)What will be receiver do if transmitter transmit more fast then receive (may busy in Interrupts ) ? 5)Transmitter transmits, queue or only last updated byte in case as 4) 6)Any Demo code without harmony. @qhb Yes, UART MODE (Not USART) Polling data is slower (Execution of infinite loop in main) than Transmit rate. Then I am skipping some bytes. Hardware Handshaking is want to use apart from Interrupts. UART Should able to all receive data.. |
|
|
|
|
|
|
|
|
|
|
|
请更新……任何人都有UART硬件握手的经验。
以上来自于百度翻译 以下为原文 Please Update.... Anyone has experience with UART Hardware Handshaking.. |
|
|
|
|
|
你可能误解了这个论坛通常是如何工作的。这是一个用户支持的论坛,Microchip的员工会阅读并偶尔做出响应,但是绝大多数有用的回复来自独立的开发人员。这些开发人员在没有期望补偿的情况下提供了帮助。这不是一个期望得到一个完整和全面的回应任何请求帮助的地方。现在更具体的线程。您已经使用UART请求使用DSAR33和PIC32 MX类型控制器之间的通信请求,使用每个控制器的UART功能块中提供的硬件握手支持。似乎没有开发人员已经响应了您请求SP的帮助。具体实施。开发人员不太可能设置硬件来免费开发和测试这个特定配置的固件。为了获得您需要的帮助,您需要尝试为两个控制器创建代码,并演示如何使用开发。可以使用MPLAB协调来为PIC32 MX和MPLAB代码配置器生成一个项目来生成一个用于DSIC33的项目来初始化UART,并创建一个简单的测试应用程序,可以在接口上来回发送数据。将需要提供一个硬件电路图,您将使用它来测试固件实现。请理解此电路图仅为UART接口。描述整个项目的电路图是没有帮助的。使用Microchip的开发板来建立测试平台将有更好的机会,其他开发者愿意组装同一个硬件来评估你的固件。他下一步,展示你能做的事情。如果你不知道怎么做我建议的任何事情,那么我们可以从基础开始。
以上来自于百度翻译 以下为原文 You are perhaps misunderstanding how this forum usually works. This is a user supported forum, Microchip employees do read and occasionally respond but, the vast majority of the useful replies come from independent developers. These developers provide the help they do without expectation of compensation. This is not a place to expect to get a complete and comprehensive response to any request for help. Now to be more specific to your thread. You have posted a request for help using a UART to communicate between dsPIC33 and PIC32MX type controllers using the hardware handshake support provided in the UART function block of each controller. It would seem that no developer that has done this has responded to your request for help with a specific implementation. It is unlikely that a developer would setup the hardware to develop and test firmware for this specific configuration for free. To get the kind of assistance you seem to need will require that you try to create code for both controllers and demonstrate that you understand how to use the development tools for both target controllers. It seems possible to use MPLAB Harmony to generate a project for the PIC32MX and the MPLAB Code Configurator to generate a project for the dsPIC33 to initialize the UART and create a simple test application that can send data back and forth across the interface. You will need to provide a circuit diagram of the hardware you will be using to test your firmware implementation. Please understand that this circuit diagram should be only the UART interface. A circuit diagram describing your entire project would not be helpful. Using development boards from Microchip to setup a test platform will have a better chance of other developers being willing to assemble the same hardware that you have to evaluate your firmware. To sum up: It is for you to take the next step and show what you can get done. If you do not understand how to do any of the things I have suggested say so and we can start from the basics. |
|
|
|
|
|
谢谢你的长时间回复。纠正我…不需要从非常基础的开始。我写的初始化代码两边都有CTS,RTS PIN设置…我的问题,如在UART的MSG 9中,不针对任何MCU……1)除了UEN之外,程序中有什么特殊设置吗?(除此之外)2)何时读取接收缓冲器?3)如何在中断和握手信号之间发送优先级?中断应该是更高的优先级4)如果发射机发射更快,然后接收(可能忙于中断),接收器会做什么?5)发射机发送,队列或最后更新的字节,如4)任何方式…谢谢…反9
以上来自于百度翻译 以下为原文 Thanks for long reply.. and correcting me.. There is not need to start from very basics. I am written Initialization code on both the side with CTS , RTS Pin Setting .. // PIC32MX795F512L void INIT_UART2_PIC32MX(void) { U2BRG = BAUDRATEREG_2; U2MODE = 0; // UEN = 0x10 (UxTX, UxRX, UxCTSand UxRTSpins are enabled and used) U2MODEbits.UEN= 0b10 ; // Enable RTS/CTS Mode U2MODEbits.BRGH = BRGH_2; U2STA = 0; U2MODEbits.UARTEN = 1; U2STAbits.UTXEN = 1; IFS1bits.U2RXIF = 0; #if defined (__PIC32MX__) U2STAbits.URXEN = 1; #endif } // dsPIC33EP512MU810 void INIT_UART2_dsPIC33EP(void) { U1BRG = BRGVAL ; // Set Baud Rate to the value calculated by the // BRGVAL macro defined above U1MODEbits.UARTEN = 1; // enable UART // UEN = 0x10 (UxTX, UxRX, UxCTSand UxRTSpins are enabled and used) U1MODEbits.UEN= 0b10 ; // Enable RTS/CTS Mode U1STAbits.UTXEN = 1; // enable UART TX U1STAbits.URXISEL = 0; // interrupt after a characters is received __C30_UART=1; // assiciates printf with UART1 __builtin_write_OSCCONL(OSCCON & ~(1<<6)); //Unlock Registers // Assigned to UART1 TX RPOR11bits.RP108R = 1 ; //RF12 (U1TX ) Pin 40 // Assigned to UART1 RX _U1RXR = 77 ; // RPI77 (U1RX Pin 80 ) // Assigned to UART1 CTSR RPINR28bits.U4CTSR = 1 ; // U1RTS (RP79/RD15) Pin 48 RPOR4bits.RP79R = 0b00000010 ; // _U1CTSR (RPI17) Pin 38 _U1CTSR = 17 ; __builtin_write_OSCCONL(OSCCON | (1<<6)); // Lock Registers } My Question as in Msg #9 from general UART not specific to any MCU... 1) Any Special Setting in Program except UEN? (Except this one) 2) When to read Receive buffer? 3) How to send priority between Interrupts and Handshaking signals? Interrupts should be higher priority 4)What will be receiver do if transmitter transmit more fast then receive (may busy in Interrupts ) ? 5)Transmitter transmits, queue or only last updated byte in case as 4) Any Way......... Thanks.. Again TS9 Attached Image(s) |
|
|
|
|
|
RTS和CTS,这是老学校。为什么不使用SPI或I2C,你会得到更快的通信。
以上来自于百度翻译 以下为原文 RTS and CTS, that's old school. Why not use SPI or I2c, you'll get faster comms. |
|
|
|
|
|
|
|
|
|
|
|
OKU可能需要一个校验和发送或一些更优质的电缆如以太网电缆。你使用什么电缆?
以上来自于百度翻译 以下为原文 Ok You may want a checksum to be sent or some better quality cable like ethernet cable. What cable are you using? |
|
|
|
|
|
串行电缆…我的问题是协议,而不是电缆。
以上来自于百度翻译 以下为原文 Serial Cable... My issue is Protocol, not Cable. |
|
|
|
|
|
4。你得到了奇怪的结果,这就是为什么我提出了一个校验和。两次发送数据,第二位以反向位顺序发送。可能恢复数据或做一个重新排序。GooGLE系列,会有一个wiki。
以上来自于百度翻译 以下为原文 4. You get strange results, that's why I suggested a checksum. Send data twice, the 2nd in reverse bit order. Possibility to recover data or do a re-send. Google serial, there will be a wiki. |
|
|
|
|
|
回顾一下:从POST第1版请求:“什么是最好的方式建立可靠的UART通信(波特率:9600)之间的DSPIC33 EP和PIC32 MX没有中断时,都是全双工。”从第9页后,您要求:“6”任何演示代码都不和谐。“从POST 13中,您张贴了一些代码片段,试图为DSIC33 EP512MU810和PIC32 MX795F512L设置UART,但是这些片段太不完整无法构建。降噪工具如和声、MCC或遗留的外围库,我不知道如何尝试帮助你。你如何完成为每个DSPIC33 EP512MU810和PIC32 MX795F512L目标设备建立的“主C文件”。MIN()函数应该为数字I/O设置所有GPIO引脚,并将系统时钟初始化为每个目标要操作的频率。这样你就可以避免使用任何微芯片提供的代码。
以上来自于百度翻译 以下为原文 To recap a bit: From post #1 you requested: "What is best way establish Reliable UART Communication (Baud Rate : 9600) Between dsPIC33EP and PIC32MX without Interrupts when both are Full Duplex .?" From post #9 you requested: "6) Any Demo code without harmony." From post #13 you posted some code fragments to attempt to setup UARTs for the dsPIC33EP512MU810 and the PIC32MX795F512L, but these fragments are too incomplete to build. As you do not seem interested in examples that use the Microchip code generation tools like Harmony, MCC or the legacy peripheral libraries I am not sure how to try to help you. How about you post complete "main.c" files that build for each of the dsPIC33EP512MU810 and PIC32MX795F512L target devices. The main() function should set all of the GPIO pins for digital I/O and initialize the system clock to the frequency you want each target to operate at. This way you can avoid using any Microchip supplied code. |
|
|
|
|
|
好啊。。。谢谢更新。有演示代码吗?对于UART与RTS和CTS的MC网络或在FRM?
以上来自于百度翻译 以下为原文 Ok... Thanks for update.. Is there any Demo code? For UART with RTS and CTS on MC Web or in FRM? |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1122浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1095浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 00:49 , Processed in 0.991523 second(s), Total 78, Slave 71 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2645