Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I am getting an oscillator failure trap when I try to run some code on my dsPIC33FJ128GP804.

This has me very confused. I am using the FRC with a PLL to run the chip at 36.85 MHz.

I was always under the impression that an oscillator failure trap occurs only with crystal oscillators in certain conditions, and never with an on-board RC oscillator.

How could this be?

share|improve this question

1 Answer

Are you really sure you are getting a oscillator failure trap? Just because it ends up in that trap routine doesn't guarantee it got there via the trap. Have you set a breakpoint at the trap location and examined the stack to see how it might have gotten there?

share|improve this answer
Can you think of another way it could end up there? – Thomas O Jun 23 '11 at 17:42
Huh. You're right. INTCON1bits.OSCFAIL is not set. Now to figure out why it is ending up there...! – Thomas O Jun 23 '11 at 17:44
The only error is DMACERR, a DMA error. But I'm not using DMA... How weird...! – Thomas O Jun 23 '11 at 17:45
@Thomas: There are lots of ways of ending up in strange locations. On a dsPIC the most common are either W15 corruption or stack corruption, then doing a return. Also note that you don't know how many instructions got executed before it just happened to end up in your trap routine. – Olin Lathrop Jun 23 '11 at 18:32
@Olin Is there any way to get the dsPIC or MPLAB C30 to save a call stack? I'm getting a "<call trace not available due to optimisation>" error when I try viewing the call trace. – Thomas O Jun 23 '11 at 22:35
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.