完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,所有,我正在努力与PIC32 MZ2048 EFM144和突然崩溃(RCON 0x40 -软复位)几个星期。现在我得到了它的原因…当我启用UART2错误中断时,我启用和禁用了阴影ISR,在ISR优先级和软/自动等周围播放,但是无论我尝试什么,都能使IE结果在CPU崩溃中出现。奇怪的是当EIE=0时,对于错误标记的投票,在RS232数据小时之后,没有人接受。但是总线上的相同数据和EIE=1,经过几秒钟的数据和CPU崩溃。也许总线上有什么东西(我没有检查,因为我目前没有使用范围的权限),但是即使总线上存在一个真正的问题,为什么要在CPU崩溃时启用错误中断?我还使用IF=0和VRead UrthWh()-Gt的位置读取U2Reg并将其复制到内部RAM。此时IP=6,使用IPL6SoT。但是汽车或是什么导致了同样的行为。这里有什么问题?
以上来自于百度翻译 以下为原文 Hi all, I'm stuggling for weeks with the PIC32MZ2048EFM144 and suddenly crashes (RCON 0x40 - softreset). Now I'v got the cause of it.. it's when I enable UART2 error interrupt. I'v enabled and disabled the shadow ISR's, played around with ISR priorities and SOFT/AUTO etc. but whatever I try, enabling IE results in crashing of the CPU. The strange thing is when EIE = 0, and polls for errorflags, after hours of RS232 data no one takes place. But same data on the bus and EIE = 1 and after just a couple of seconds of data and the cpu crashes. Maybe there is something on the bus (I didn't checked that because I have no abbility of using a scope at the moment), but even if there is a real problem on the bus, why crashes the CPU when enabling the error interrupt? void vInitUart2(void) { U2MODE = 0x0; ANSELGCLR = 0x0040; TRISGSET = 0x0040; U2STAbits.UTXEN = 0; U2STAbits.URXEN = 0; RPB14R = 0b0010; //RPB14R = U2TX U2RXR = 0b0001; //U2RX = RPG6 //RPG6R = 0b0010; //U2RXR = //TRISBCLR = 0x4000; //TRISGSET = 0x0040; //TRISBSET = 0x4000; U2BRG = 53; //100Mhz --> 115k200 U2STAbits.URXISEL = 0b00; U2TXIF; U2TXIE = 0; U2RXIF; IFS4bits.U2EIF = 0; IPC36bits.U2RXIS = 0;//2 IPC36bits.U2RXIP = 7; IPC36bits.U2EIP = 6; IPC36bits.U2EIS = 0;//3 IEC4bits.U2EIE = 1; U2RXIE = 1; U2MODEbits.ON = 1; U2STAbits.UTXEN = 1; U2STAbits.URXEN = 1; __XC_UART = 2; } void __ISR(_UART2_FAULT_VECTOR,ipl6SOFT) Usart2Fault(void) { IFS4bits.U2EIF = 0; if(U2STAbits.FERR) { UartData.ui32_FrameErrorCount++; } if(U2STAbits.OERR) { UartData.ui32_OverflowCount++; } if(U2STAbits.PERR) { UartData.ui32_ParityErrorCount++; } U2STAbits.OERR = 0; vReadUartHW(); //save data bRXError = TRUE; } I also played with the position of the IF=0 and vReadUartHW() -> reads U2REG and copies it to internal ram. At this moment IP = 6 and using ipl6SOFT. But AUTO or whatever results in the same behaviour. What is the problem here? |
|
相关推荐
1个回答
|
|
您可能希望为一般异常和TLB填充异常创建自己的异常处理程序。查看XC32用户指南中的第14.5部分“异常处理程序”以获取更多信息。XC32使用的默认处理程序简单地重置PIC32,这可能就是为什么您只看到软复位作为症状。
以上来自于百度翻译 以下为原文 You may want to create your own exception handlers for the General Exception and the TLB Refill Exception. Have a look at Section 14.5 "Exception Handlers" in the XC32 Users Guide for more info. The default handlers that are used by XC32 simply reset the PIC32, which might be why you're seeing only a soft reset as the symptom. |
|
|
|
只有小组成员才能发言,加入小组>>
5170 浏览 9 评论
2001 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3176 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
737浏览 1评论
622浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
509浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
635浏览 0评论
531浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 16:46 , Processed in 1.598502 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号