完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我使用PIC32 MZ2048 EFH144,MPLABX4.00,XC32 V1.44,MPLAB和谐V2.04。我为UART 5(也为UART 1)生成了和声驱动程序。我使用字节支持模式,这样我就可以读/写单字节上的UART。我能够成功地传输字节数据,但在恢复数据时,我观察到,它不能正确地接收iNETTUPT。一旦接收到字节,它就进入UART5RX ISR并执行它,并且在某个时候再次出现在ISR。我通过在ISR中给出断点来检查这一点。我还观察到,我希望接收的任何数据都可以在U5RXRG中获得。但是,它不能读懂与和谐图书馆有关的问题,或者我的设备或其他东西……(谢谢任何建议)。
以上来自于百度翻译 以下为原文 Hi, I am using PIC32MZ2048EFH144, MPLABx4.00, XC32 V1.44, MPLAB HARMony v2.04. I have generated harmony driver for UART 5 (also for UART 1). I am using byte support mode so that I can read/write single byte on UART. I am able to transmit byte data successfully but while receving data, I have observed that, its not able to serve receive inetterupt properly. As soon as byte is received, it comes in UART5RX ISR and execute it and again after sometime it again comes in ISR. I checked this by giving breakpoint in ISR. I also observed that whatever data I am expecting to receive is available in U5RXREG. but it is not able to read as below if(DRV_USART_TRANSFER_STATUS_RECEIVER_DATA_PRESENT & DRV_USART_TransferStatus(appData.UARTHandle)) { Frame[Data.frameNextPtr] = DRV_USART_ReadByte(appData.UARTHandle); } Is this issue with Harmony library, or my device or something else...:( Thanks for any suggestion(s). |
|
相关推荐
10个回答
|
|
“我通过在ISR中给出断点来检查这一点。我还观察到,在U5RXRG中,我希望得到的任何数据都是可用的。即使在调试器中观察到它,情况也可能如此。至于“一旦收到字节,它就进入UART5RX ISR并执行它,并且在某个时候再次出现在ISR中”。
以上来自于百度翻译 以下为原文 "I checked this by giving breakpoint in ISR. I also observed that whatever data I am expecting to receive is available in U5RXREG." If you read the register, you remove that data. Even if you observe it in the debugger, that may be the case. As to " As soon as byte is received, it comes in UART5RX ISR and execute it and again after sometime it again comes in ISR.", it sounds like the interrupt flag is not clearing. |
|
|
|
是的,即使在完成ISR之后,中断标志似乎也未被清除。现在,我把UART变为轮询模式,它正在工作。我知道这不是一个实际的解决办法,但不管怎样,它是有效的。
以上来自于百度翻译 以下为原文 Yes the interrupt flag seems uncleared even after completing execution of ISR. Now, I changed UART to polling mode, it is working. I know its not a actual solution, but anyway its working. |
|
|
|
你是在ISR中清除它还是假设ISR机制为你服务?
以上来自于百度翻译 以下为原文 Are you clearing it in the ISR or assuming the ISR mechanism does it for you? |
|
|
|
是的,我假设ISR机制正在清除它。而且似乎ISR也在调用函数来清除中断标志。
以上来自于百度翻译 以下为原文 Yes, I am assuming the ISR mechanism is clearing it. And it seems that ISR is also calling the function to clear that interrupt flag. |
|
|
|
我会通过它,看看它是否真的执行。如果它根本没有清除中断,那么你就有更大的问题了。如果它在读取数据之前清除它,那么它可能会重新出现。如果它在它重新开始之后清除它,那么还有另一个条件(例如FIFO中的更多数据,或者像帧错误之类的其他条件)。
以上来自于百度翻译 以下为原文 I would step through that and see that it really executes. If it is not clearing the interrupt, at all, then you have a bigger problem. If it clears it before you read data, then it might reassert. If it clears it after but it reasserts, then there is another condition (e.g. more data in a FIFO than you expect or other conditions like frame error). |
|
|
|
嗨,Jcandle,我还尝试了一步一步的调试,观察ISR的执行情况。它正在清除不规则的旗帜,但是在“继续”执行之后,它又在一段时间后进入ISR。当我只发送一个字节时,它可能不是“FIFO中的更多数据”的可能性,我们也可以看到RX缓冲区中的有效数据,也可能与框架无关。
以上来自于百度翻译 以下为原文 Hi Jcandle, I have also tried step-by-step debugging and observed the execution of ISR. It is clearing the inetrrupt flag but again after "continue"ing execution it come in ISR after some time. As I am sending only single byte then it may not be possibility of 'more data in FIFO' and also as we can see valid data in RX buffer then also may not be problem with framing. |
|
|
|
在RX上有上拉电阻吗?它可能是线噪声。
以上来自于百度翻译 以下为原文 Do you have a pullup resistor on RX? It could be line noise. |
|
|
|
|
|
|
|
你好,Ravic,我有UART使用回调中断RX。我的Tx是通过调用每个循环的函数从我的环形缓冲区转储到TX FIFO。注意,我也有UART错误中断之前,由于奇怪的行为,但似乎还好在OrthyV20501到目前为止(并且你不能禁用UART错误中断在MHCV2052)。我不使用UART错误回调,因为这个经验(我的协议校验和捕获错误,所以我没事)。我正在使用:PIC32 MZ2048 EFM144,MPLABXV355,XC32 V142,OrthyV20200 BPIC32 MZ2048 EFM144,MPLABXV415,XC32 V205,OrthyV20501注:从HV202B升级到HV20501是容易的:删除项目文件夹,然后删除所有旧的生成和编译的文件/文件夹,对.MHC和.xml文件进行开机,然后用最新的工具打开项目,在MHC中重新生成(手动启用ADC),对生成的代码进行定制(推荐您保留列表或使用工具,如Excel)。是“比较老文件夹与新文件夹,编译,它工作!代码提取附上:HV2XXUUART= RXCALBACKIVUVPR.TXTHORD,忙,所以没有时间把这个拆掉。希望你能理解这一点。包括参考和声帮助UART回调。保罗
以上来自于百度翻译 以下为原文 Hi Ravic, I have UARTs working in Interrupt for Rx by using Callbacks. My Tx is by calling a function every cycle to dump from my ring buffers to the Tx FIFOs. Note I also had UART Err Interrupts disabled previously due to odd behaviour, but it seems OK in HarmonyV20501 so far (And you can't disable UART Err interrupts in MHCv2052). I don't use UART Err Callbacks because of this Experience (My protocol checksums catch errors so I'm OK). I'm using: PIC32MZ2048EFM144, MPLABXv355, XC32 V142, HarmonyV20200b PIC32MZ2048EFM144, MPLABXv415, XC32 V205, HarmonyV20501 Note: To upgrade from Hv202b to Hv20501 was easy this time: - First I zipped the project folder, then I deleted all old generated and compiled files/folders, kepting the .mhc and .xml files, Then I opened project with latest tools, regenerated in MHC (manually enabling ADC), made my customizations to generated code (Recommend you keep a list or use tool like "beyond compare" to compare folders of older versus new, compiled, and it worked!! Code Extracts attached: Hv2xx_UART=RxCallback_V00PR.txt Sorry, busy so no time to strip this down. Hope you can make sense of it. Includes reference to Harmony Help for UART Callbacks. Paul Attachment(s) Hv2xx_UART=RxCallback_V00PR.txt (5.57 KB) - downloaded 56 times |
|
|
|
嗨,保罗,非常感谢你,你的回答对我来说是非常健康的,我会用我的代码尝试它,让你知道是否有任何问题将在那里。
以上来自于百度翻译 以下为原文 Hi Paul, Thank you very much, Your answer is very healpful for me, I will try it in my code and let you know if any issue will be there. |
|
|
|
只有小组成员才能发言,加入小组>>
5159 浏览 9 评论
1998 浏览 8 评论
1927 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3170 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2223 浏览 5 评论
724浏览 1评论
608浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
496浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
621浏览 0评论
520浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-19 23:29 , Processed in 1.349123 second(s), Total 95, Slave 80 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号