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

0 Members and 1 Guest are viewing this topic.

Offline jsmokerTopic starter

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Need quick PIC help
« on: March 07, 2007, 03:02:51 AM »
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 dsPIC30F3012
using a regulated power supply
internal 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

Any advice?

-JSmoker

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: Need quick PIC help
« Reply #1 on: March 07, 2007, 09:53:38 PM »
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.

Offline jsmokerTopic starter

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Re: Need quick PIC help
« Reply #2 on: March 08, 2007, 01:11:08 AM »
yeah, when I power cycle, it only works a moment again, but the capacitor is in parallel, not in series.  ie one lead on the Vss pin and one one the Vdd.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: Need quick PIC help
« Reply #3 on: March 08, 2007, 10:18:24 AM »
hmmmm this is a tough one . . .

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.


just for others to reference, this is the dsPIC30F3012 datasheet
http://ww1.microchip.com/downloads/en/DeviceDoc/70139C.pdf

Offline jsmokerTopic starter

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Re: Need quick PIC help
« Reply #4 on: March 08, 2007, 06:09:41 PM »
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 work
2)if I put a 0.33uF capacitor with 7V it takes like 5 seconds to start
3)if I put a 220uF capacitor with 7V it takes like 4.5 seconds to start
4)if I put any capacitor with >8V it doens't seem to start at all >:( ???

Offline jsmokerTopic starter

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Re: Need quick PIC help
« Reply #5 on: March 08, 2007, 06:32:16 PM »
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.

-JSmoker

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: Need quick PIC help
« Reply #6 on: March 08, 2007, 10:49:33 PM »
what is your power supply? a battery? it sounds like you have a very low current problem . . .


the regulator issue seems odd, cause you need at least 6V input for a voltage regulator to output 5V (there is like a 1V dropout) . . .

as for the capacitor, its better design for it to be between the regulator and PIC . . .

i have no idea what is causing your problem . . . do you have a schematic you can upload?

Offline jsmokerTopic starter

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Re: Need quick PIC help
« Reply #7 on: March 09, 2007, 10:32:36 AM »
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.



-JSmoker

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: Need quick PIC help
« Reply #8 on: March 09, 2007, 12:31:11 PM »
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.

Offline jsmokerTopic starter

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Re: Need quick PIC help
« Reply #9 on: March 11, 2007, 06:45:32 PM »
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.

-JSmoker

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
Re: Need quick PIC help
« Reply #10 on: March 12, 2007, 06:11:28 AM »
Can you highlight in that pcb layout where the battery plugs in, where the voltage regulator is, and where you are putting the capacitors?

- Jon

Offline jsmokerTopic starter

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Re: Need quick PIC help
« Reply #11 on: March 12, 2007, 11:32:13 AM »
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.

-JSmoker

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
Re: Need quick PIC help
« Reply #12 on: March 12, 2007, 11:36:49 AM »
Okay, what model regulator are you using (specific part #)?

What kind of capacitor are you using, and what size? Is it polarized, and are you hooking it up correctly?

- Jon

 


Get Your Ad Here

data_list