Author
Topic: Need quick PIC help (Read 3546 times)

I'm trying to run a dsPIC but in testing. The code seems to freeze after like a quarter of a second. Playing with capacitors across the power supply seems to do something...I don't know what though, cause bigger capacitors don't mean flawless running.

I'm using a dsPIC30F3012using a regulated power supplyinternal FRC oscillator at full speed with 16x PLL (speed is needed)no MRCL (since the chip can't be reprogrammed with MRCL and internal oscillator

so when you power cycle it, it will work again for a 'quarter of a second', right?

out of curiousity, where do you have the capacitor? it sounds like it is in series with your power. after the capacitor charges up over say a 'quater of a second', the current flow stops and your PIC would stop working . . . if this is the case, the capacitor should connect power and ground pins only.

remove the capacitor and see if you still have the problem or not (this will rule out the capacitor being the problem)

what is the PIC being programmed to do? what components do you have attached to it?

there is a possibility that you just made an error in a program loop that doesnt do what you meant it to do. program the PIC to just emit a simple square wave to a pin (and nothing else) and measure the pin with an oscope. if you dont have an oscope, try and pulse a pin high low high every second and measure that with a multimeter (might not work if PIC stops working before then). this will give you a good idea of exactly how long it works till failure, and verifies that your code isnt the problem.

Ugh, it just keeps getting worse. I took out a lot of the code to make things cleaner. Now the problem seems to have changed a bit. It's now a fairly simple program...an SOIC dsPIC30F3012 with just a blinking light.

Scenarios that work:1)Right after programming, the light starts blinking automatically

2)if I attach 5V to the voltage regulator (which regulates to 5V) it works right away

Scenarios that don't work/don't work well:

1)If I put anything above 7V onto the regulator it doesn't work2)if I put a 0.33uF capacitor with 7V it takes like 5 seconds to start3)if I put a 220uF capacitor with 7V it takes like 4.5 seconds to start4)if I put any capacitor with >8V it doens't seem to start at all

I found a "solution" but I still want to know why this happens if anyone can tell me.

I found that by adding a capacitor >30uF between the voltage regulator and the PIC rather than where I tried before between the power source and voltage regulator, things work fine. Why is the capacitor necessary? Why do I need so much capacitence. I still get a start up delay when I use like 10uF.

I tried both battery and power supply, but mostly I was relying on a power supply. The batteries I tried were a 7.4V Lithium Polymer and a Alkaline 9V. And there's also the 5V from the programmer that worked. I can post the PCB Layout that I'm using. But I'm not sure how to use the "Image" option. The layout might look a bit complex, but when I did the above tests, I only had one LED which is on the corner of the board out from Portb3,3 switches, the two 8 pin SOICs and voltage regulators. The switches you can consider shorted, and the SOICs aren't doing anything right now.

hook your circuit up to a power supply and let me know what the current draw is. it should be under 50mA (with the LED on) . . .

also, get out a multimeter and check various pins across your circuit for anything unusual (if you haven't already). also, do a resistivity check on connections that are close to each other and make sure nothing is shorting.

to upload schematic:there is a text link that will say 'Additional Options...' towards the bottom of a reply post.it will bring down a drop down menu that allows you to post attachments. schematics save best in the .png format for good image compression.

the other method is to use the image button. you put the image on your server, and just link to it.

The current is actually around 100mA and I've found this to be true for other models I've built, I think due to the fact that I'm using the PLL option. I've read several times that running a chip at it's greatest speed draws a lot of current. I'm not positive, but I think the PLL might also be the source of my start up issues. I just wish I knew what the details are so I can make sure I prevent this in the future.

Here it is again. I've circled the mentioned components. you might find a disconnect in the Voltage source in the top right, but that's just basically jumpered when the device is in use. I'm working on a theory from reading some sources at Microchip. I haven't tried it out. But I think the reason the chip may be bugging out on me is cause the chip is a dsPIC30F3012 20E/S and not a dsPIC30F3012 30E/S. I've been running the PIC at internal FRC 7.37 Mhz x 16 PLL which divided by 4 oscillations per instruction brings it to 29.48 which is greater than 20MIPS rating. So unfortunately, if this is the problem, I'll only be able to run it at 8xPLL. The chip does work at the 16x, but I guess it might just be unstable.