完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在调试正在度假的同事的STM8软件,我面临一个我无法立即解决的问题......(我是模拟工程师,所以软件不是我的一杯茶)
该器件具有USART接口(250kBaud)。 99%的接收数据是正确的,但有时会跳过数据槽。 Usualy(总是???)跳过的插槽是 休息后的前几个。发射器的中断是3,4ms,MAB是108μs,只发送32个插槽。当我使用另一台15毫秒的发射器时,136μs的MAB和 512个数据插槽,接收器完美无瑕。我已将代码简化为基本功能,如下图所示,但问题仍然存在...... INTERRUPT_HANDLER(UART2_RX_IRQHandler,21) { RxBuffer [RxPos] = UART2_ReceiveData8(); if(UART2_GetFlagStatus(UART2_FLAG_FE)) { Data_1 = RxBuffer [DMX_Structure.start_address]; Data_2 = RxBuffer [DMX_Structure.start_address + 1]; Data_3 = RxBuffer [DMX_Structure.start_address + 2]; Data_4 = RxBuffer [DMX_Structure.start_address + 3]; Data_5 = RxBuffer [DMX_Structure.start_address + 4]; RxPos = 0; UART2_ClearFlag(UART2_FLAG_FE); //清除UART的帧错误标志 } 如果(RxPos&LT; 513) RxPos ++; UART2_ClearFlag(UART2_FLAG_RXNE); } 什么可能出错的想法?问候。 以上来自于谷歌翻译 以下为原文 I'm currently debugging STM8 software of a colleague who is on holiday and i face a problem which i cannot immediatly solve... (I’m an analog engineer, so software is not really my cup of tea) The device has a USART interface (at 250kBaud). 99% of the received data is correct, but sometimes dataslots are skipped. Usualy (allways???) skipped slots are the first few after the break.The break of the transmitter is 3,4ms and the MAB is 108µs, only 32 slots are sent. When i use another transmitter with 15ms break, 136µs MAB and 512 data slots, the receiver works flawless.I have simplified the code to the basic functionality as shown below, but the problem remains... INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21) { RxBuffer[RxPos] = UART2_ReceiveData8(); if(UART2_GetFlagStatus(UART2_FLAG_FE) ) { Data_1 = RxBuffer[DMX_Structure.start_address]; Data_2 = RxBuffer[DMX_Structure.start_address + 1]; Data_3 = RxBuffer[DMX_Structure.start_address + 2]; Data_4 = RxBuffer[DMX_Structure.start_address + 3]; Data_5 = RxBuffer[DMX_Structure.start_address + 4]; RxPos = 0; UART2_ClearFlag (UART2_FLAG_FE); // Clear frame error flag of UART } if(RxPos<513) RxPos++; UART2_ClearFlag(UART2_FLAG_RXNE); } Any ideas what might go wrong?Regards. |
|
相关推荐
1个回答
|
|
我一直在捕捉uart收到的数据,似乎uart偶尔会在数据帧中间看到中断并重置framecounter。
框架错误是否可能发生错误解释为中断?在上面的代码中检测到中断的方式是正确的吗? 问候, 约翰 以上来自于谷歌翻译 以下为原文 I've been capturing data the uart receives, and it seems as if the uart occasionaly sees a break in the middle of a data frame and resettes the framecounter. Is it possible that framing errors occur, that are misinterpreted as a break? Is the way the break is detected in my code above correct? Regards, Johan |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2646 浏览 1 评论
3209 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1784 浏览 1 评论
3613 浏览 6 评论
5992 浏览 21 评论
942浏览 4评论
1318浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
588浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1305浏览 3评论
1365浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 22:42 , Processed in 0.995664 second(s), Total 76, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号