Dspic and hangs when running on low frequence

Hi! I have a DSPIC 30F6014 and have a problem. It is used for sampling data at a frequence of 3,3 khz the external cristall of 32768 devided with 10. The DSPIC are running on 6MHZ external cristall and PLL 4 times, wich gives 24MHZ, and is trigged to start 3,3 khz. Using this speed everything works perfektly. But during standby mode i divide 32768 to get 51,2 HZ, to save power. Becouse of this the intstrument approx once a day hang. Before that recieving huge amount of Ochilator fail trap and even adress errors.

Increasing the standby freq to approx 500 hz solves the problem but drains my battery. Does anyone have a clue why this happens?

/Martin

"Source Code" T1IE =3D 0; // Interrupt Disable if(IsTimerLowPower()) { if(bFast) { if(g_LowSpeed && !IsTrigged()) PR1 =3D (PR1_LOW-1); // 1092,267 Hz from 32768 Hz external else PR1 =3D (PR1_ORG-1); // 3276,8 Hz from 32768 Hz external change here for different clock =E4ndra spleep och timer grejer ocks=E5 f=F6r det ska funka } else PR1 =3D (PR1_SLOW-1); // Timer ticks to generate 51,2 Hz from

32768 Hz external } else { if(bFast) { if(g_LowSpeed && !IsTrigged()) PR1 =3D ((MCK*PR1_LOW)/(32768*4)); // 1092,267 Hz from MCK internal else PR1 =3D ((MCK*PR1_ORG)/(32768*4)); // 3276,8 Hz from MCK internal } else { // Warning!!! this timer goes 2x, else the PR1 value would be greater than 65535 PR1 =3D (((MCK/8)*PR1_SLOW)/32768); // Timer ticks to generate 102,4 Hz from MCK internal } } if(bFast) { if(g_LowSpeed && !IsTrigged()) g_nTimerTickComp =3D PR1_SLOW/PR1_LOW; else g_nTimerTickComp =3D PR1_SLOW/PR1_ORG; } TMR1 =3D TMR1 % PR1; // Reset Timer1 to lower than PR1 T1IE =3D 1; // Interrupt Enable
Reply to
mupptupp
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.