A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
Hello everyone, I've got a bizzare problem with a PIC18F4431. It seems that whenever I change the duty cycle of a PWM output *too frequently* the PIC will run run for 25-30 seconds and then crap out, exhibiting random behaviour. Now before you think I'm nuts, here is a list of evidence for my claim: 1. When I run the PIC with constant PWM duty cycle set, the PIC runs fine and performs many non-repetitive tasks perfectly (e.g, writing to an LCD, reading sensors and displaying the data, etc.) 2. When I set the PWM to steadily increment every 100mS (just for testing) the system will run fine, performing all the same non-repetitive tasks as before, but it will just go nuts after about 30 seconds. It is *not* consistent - sometimes it will only last a few seconds, sometimes a few minutes. 3. Interrupts do not effect it - i.e, disabling interrupt routines does nothing, and the problem still occurs. 4. Disabling PLL fixes the problem! when I set the crystal to HS rather than PLL the system runs fine forever with no problems. 5. Nothing external to the PIC is running i.e, the problem still occurs whether motors are plugged into the motor driver or not (and whether motor driver is plugged in or not...) 6. The problem is somewhat persistent. Meaning, when the PIC goes nuts cycling the power sometimes doesn't fix it, even if it is left off for 15-20 seconds (e.g, it doesn't start up at all, or just behaves crazy.) But sometimes it isn't, and will start up right away! Reprogramming it always works, and it will start up right afterwards. 7. Observing the crystal oscillation on a scope, when the PIC "goes nuts" the waveform decreases in amplitude by about 20-30%. Here is the system setup, it is super simple: There is a PIC that has two PWM outputs feeding into a motor driver via a quick disconnect cable. The PIC is a buffer on 8 digital outputs that run servos. The PIC has 8 analog I/O connected to sensors. The PIC run on a 6MHz cryzstal. The voltage regulator is an LM1084. Disconnecting sensors and motor driver has no effect as mentioned... Anyway, I hope someone has an idea of what might be going on because I'm stumped. This really seems like an internal problem with the PIC and nothing I can do much about. I'll probably just disable PLL and try putting in a faster crystal. I'll post code if anyone is actually interested in seeing the guts.
I should mention that I'm not a newbie, and that the PCB layout is done quite intelligently. I've got a fair bit of experience building these types of systems, so please don't bother with obvious suggestions like checking whether the capacitors on the crystal are correct. I am just wondering if anyone has seem something similar to this and has a solution.
> I've got a bizzare problem with a PIC18F4431. I would say: reduce both your program and the hardeware to the utmost minumum. That will either eliminate your problem (so you can focus on the elimination step that elimintade the problem), or you will end up with somthing that you can ask Mirochip. And/or ask on the MIT piclist. Wouter van Ooijen -- ------------------------------------------- Van Ooijen Technische Informatica: www.voti.nl consultancy, development, PICmicro products docent Hogeschool van Utrecht: www.voti.nl/hvu
----- Original Message ----- From: "Vecheslav Silagadze" <uwobjectivist@uwob...> To: <piclist@picl...> Sent: Saturday, March 25, 2006 7:41 AM Subject: [piclist] PIC PWM crazyness > Hello everyone, > > I've got a bizzare problem with a PIC18F4431. It seems that whenever I > change the duty cycle of a PWM output *too frequently* the PIC will run > run > for 25-30 seconds and then crap out, exhibiting random behaviour. Now > before > you think I'm nuts, here is a list of evidence for my claim: [deleted] Is only one board affected? Leon --- [This E-mail has been scanned for viruses but it is your responsibility to maintain up to date anti virus software on the device that you are currently using to read this email. ]
I swapped out the crystal (with the same exact model I should add...) and now it works perfectly... hurray for electro magic. It's only been running for 5 minutes so I might be optimistic. I'll keep it going for another hour or two to make sure it keeps going. Regarding the questions: This is the only board in existence. It's a simple controller for a robot for www.robotracing.org Regarding the reductionism method - unfortunately since this is a custom PCB I'd basically have to either desolder the SMD parts or build a new board and test it in stages... neither of which is really an attractive option. But yes, typically that is a very good approach. Anyway, as I type this message the system keeps working so I'm happy :) --- In piclist@picl..., "Leon Heller" <leon.heller@...> wrote: > > ----- Original Message ----- > From: "Vecheslav Silagadze" <uwobjectivist@...> > To: <piclist@picl...> > Sent: Saturday, March 25, 2006 7:41 AM > Subject: [piclist] PIC PWM crazyness > > > > Hello everyone, > > > > I've got a bizzare problem with a PIC18F4431. It seems that whenever I > > change the duty cycle of a PWM output *too frequently* the PIC will run > > run > > for 25-30 seconds and then crap out, exhibiting random behaviour. Now > > before > > you think I'm nuts, here is a list of evidence for my claim: > > [deleted] > > Is only one board affected? > > Leon > > --- > [This E-mail has been scanned for viruses but it is your responsibility > to maintain up to date anti virus software on the device that you are > currently using to read this email. ] >