完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我有两个带有PIC32 MZ2048 EFM144(带有密码)的D3307板,用和声编码和XC32 1.44编译器。我有很多关于PIC24和DSPIC33的经验,所以我认为这是一块蛋糕,但不是。我已经配置了time2,t= 100nS和PR。10中的2个得到1US中断。在ISR中,它计算一个32位值。问题是我尝试的任何一个,IfPuPuthIn HealthBealTealPixVal1M1s变得大于100,它导致意外的行为,例如LED不闪烁1秒的速率,但非常不规则。调试表明,即使IfStimeDebug .UI32 IyAdvalPaldRealPrimeStaldPrime/Salk不为true,但该语句将变成真的。在将时钟设置为动态的和谐后,它工作得更好,但现在CPU在接收UART RX数据时冻结(然而,故障ISR或ORR变为真)。似乎没有错误的长VARS出了问题。有什么想法吗?
以上来自于百度翻译 以下为原文 Hello, I have a couple of DM320007 boards with the PIC32MZ2048EFM144 (with Crypto) and using HARMony for coding and XC32 1.44 compiler. I have lots of experience with the PIC24 and dsPIC33's, so I thought this one would be a piece of cake too, but not. I have configured timer2 with T=100ns and with PR2 of 10 its gets 1us interrupt. Within that ISR it counts a 32bit value. //====== DEFINITIONS ===================== struct strSysDebug{ unsigned long int ui32_RunTimeSec; unsigned long int ui32_MainloopCounter; unsigned long int ui32_MainloopCounterCompareValue; unsigned long int ui32_TimerValue; float f32_CPUBelasting; unsigned long int ui32_IntervalCounterLEDHeartbeat; unsigned long int ui32_IntervalLEDHeartbeat; unsigned char bStructInit; }; void __ISR(_TIMER_2_VECTOR,ipl6SRS) Timer2ISR(void) { SystemDebug.ui32_TimerValue++; SystemDebug.ui32_IntervalCounterLEDHeartbeat++; //LATHbits.LATH0 = !LATHbits.LATH0; T2IF;// = 0; } //Init if(!bInit) { SystemDebug.ui32_IntervalLEDHeartbeat = CPU_MAIN_HEARTBEATLED_INTERVAL_1MS; //Macro define 1000ul bInit = TRUE; } if (SystemDebug.ui32_IntervalCounterLEDHeartbeat >= SystemDebug.ui32_IntervalLEDHeartbeat) { //Led blink } Problem is whatever I try, if CPU_MAIN_HEARTBEATLED_INTERVAL_1MS gets bigger than 100 it results in unsuspected behaviour, such as leds doesn't blink with rate of 1sec but very irregular. Debugging shows that even if SystemDebug.ui32_IntervalCounterLEDHeartbeat not equal/ statement not true, this statement however becomes true. After I set clock to dynamic in Harmony it works a lot better, but now the cpu freezes when receiveing UART RX data (however FAULT ISR nor OERR becomes true). It seems like something going wrong with unsigned long vars. Any ideas? |
|
相关推荐
6个回答
|
|
UI32接口间心跳(以及在中断中修改但在用户级代码中使用的任何其他字段和变量)需要是易失性的。
以上来自于百度翻译 以下为原文 ui32_IntervalCounterLEDHeartbeat (and any other fields and variables modified in interrupts but used in user level code) needs to be volatile. |
|
|
|
您好,谢谢,结构原型是不稳定的(易失结构StrusSebug系统调试),但是我想我找到了原因。PRISS.RX工作正常,我可以使用比100更大的值(现在是10000个UL)。但是,使RTCC产生相同的行为,所以和谐框架代码并不像我预期的那么有用。我最好为这个做我自己的代码。EEPS相同常量奇怪值981284096)和一些奇怪字符出现在RX缓冲区。所以有些指针问题)但是我没有调查过,而且它也跟编译器没有关系:再次感谢约翰
以上来自于百度翻译 以下为原文 Hello and thanks, The structprototype is volatile (volatile struct strSysDebug SystemDebug). However I think I found the cause. It seems something went wrong with PRISS. RX is working correctly and I'am able to use bigger values than 100 (10000uL at the moment). However enabling RTCC result in same behaviour, so Harmony frameworks code isn't that helpfull as I expected. Id better make my own code for this. RTCC var (t_uint32) keeps same constant strange value 981284096) and some strange chars comes in RX buffer.. so some pointer problem). But I havent investigated that and it's also not related to the compiler:) Thanks again, John |
|
|
|
HI,关键点是,如果在中断中增加全局变量,并且增量不是汇编程序级的原子序列,则存在错误的可能。易失性只关心优化相关的问题。解决方法:1 /(不是最好的):禁用和重新启用在增量操作前后中断使序列原子2//(最好):使用访问器函数来修改这个变量
以上来自于百度翻译 以下为原文 Hi, The key point is that if you increment a global variable within an interrupt and the increment is not an atomic sequence at assembler level, you have the potential for error... volatile only takes care about optimization related issues 2 ways to solve that : 1/ (not the best) : disable and reenable interrupts before and after the increment operation to make the sequence atomic 2/ (the best) : use an accessor function to modify this variable Regards |
|
|
|
在PIC32上,32位写入将是原子的。我当前的问题:WTF是PrISS和RTCC?
以上来自于百度翻译 以下为原文 On PIC32 32 bit writes are expected to be atomic. My current problem: WTF are PRISS and RTCC ? |
|
|
|
|
|
|
|
PRISS是与ISR优先级和影子寄存器集相匹配的SR。它的默认值是0(没有影子集分配)和*和谐不改变这个*。所有的和谐中断被定义为IPLnAUTO。如果你想在你自己的代码中使用阴影集,你必须自己配置PISIs。因为在EF上有8个影子集,你可以设置PrISS,Pr.Prims= n(例如PrimsPi4SS=4)。确保PRISS在启用任何中断之前被配置。
以上来自于百度翻译 以下为原文 PRISS is the SR which matches ISR priority level and shadow register set. It's default value is 0 (No shadow set allocated) and *Harmony does not change this*. All interrupts in Harmony are defined as IPLnAUTO. If you want to use shadow sets in your own code you have to configure PRISS yourself. As there are 8 shadow sets on an 'EF you can set PRISS such that PRISS.PRInSS = n (e.g. PRISS.PRI4SS = 4). Make sure that PRISS is configured before enabling any interrupt. |
|
|
|
只有小组成员才能发言,加入小组>>
5158 浏览 9 评论
1997 浏览 8 评论
1926 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3169 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2222 浏览 5 评论
724浏览 1评论
607浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
495浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
621浏览 0评论
520浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-19 19:25 , Processed in 1.411880 second(s), Total 88, Slave 71 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号