View previous topic :: View next topic |
Author |
Message |
1980best
Joined: 25 May 2007 Posts: 26
|
Working stop working why ? 33EV32GM002 |
Posted: Sun Oct 29, 2017 4:01 pm |
|
|
Hi everybody,
Is there a problem with my devices ?
Device first working after stop +++ after working after stop .. again
Where is the problem ?
osc ?
My crystal is 8 MHz, I want it to be working 80 MHz - 140 MHz.
Code: |
#include <33EV32GM002.h>
#device ICSP=1
#use delay(clock=32MHz,crystal=8MHz)
//#use delay(clock=32MHz)
#FUSES HS
#FUSES PR_PLL
#FUSES NOOSCIO
/*
• LP Low Frequency (Power) Crystal
• XT Crystal/Resonator
• HS High Speed Crystal/Resonator
• RC External Resistor/Capacitor (same as EXTRC with CLKOUT)
• EXTRC External Resistor/Capacitor
• EXTRC External Resistor/Capacitor with CLKOUT
• INTRC Internal 4 MHz Resistor/Capacitor
• INTRC Internal 4 MHz Resistor/Capacitor with CLKOUT
*/
/*
PR - Primary external clock (previous fuse tells what type)
PR_PLL - Primary external clock + PLL
FRC - Internal Fast RC circuit
FRC_PLL - Internal Fast RC + PLL
SOSC - Secondary external oscillator
LPRC - Internal low power RC circuit
*/
#FUSES NOWDT //No Watch Dog Timer
#FUSES CKSFSM //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES NOBROWNOUT //No brownout reset
#define LED PIN_B4
#define DELAY 100
void main()
{
//setup_oscillator( OSC_CRYSTAL);
//setup_oscillator( OSC_CRYSTAL, 800000, 32000000);
delay_ms(5000);
delay_ms(5000);
//Example blinking LED program
while(true)
{
output_low(LED);
delay_ms(DELAY);
output_high(LED);
delay_ms(DELAY);
}
} |
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Mon Oct 30, 2017 5:59 am |
|
|
While I don't use that PIC, I'll offer some comments.
You're using an 8 MHz xtal.
Have you the proper caps for it?
Depending on xtal, you may need a small series R.
There has been a fair amount of posts simlar to yours, so 'search' here and see what has been said.
I'd actually try the internal 4MHz oscillator. That has to work....Since no external parts are needed, it's just a matter of selecting the correct 'fuses' and delay(options...) to make it run.
Also it removes any PCB problems like solder whiskers.
Jay |
|
|
1980best
Joined: 25 May 2007 Posts: 26
|
|
Posted: Mon Oct 30, 2017 7:31 am |
|
|
Thanks for answer me,
but
I want to working 80MHz & 140MHz.
It is very speed devices.
Maybe my problem:
setup_oscillator(?); |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1353
|
|
Posted: Mon Oct 30, 2017 7:47 am |
|
|
I know a lot of the dspic33 devices cannot startup with the PLL so you generally startup with the internal and then switch to the oscillator + PLL.
Try messing around with something like this:
Code: |
#include <33EV32GM002.h>
#FUSES HS //go ahead and select the HS crystal circuit for later
#FUSES FRC //however, start with the internal
#FUSES NOWDT //No Watch Dog Timer
#FUSES CKSFSM //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES NOBROWNOUT //No brownout reset
//this should come after the FUSES
//only use "clock" so it doesn't try and overwrite the above FUSES
#use delay(clock=32MHz)
#define LED PIN_B4
#define DELAY 100
void main()
{
//chip started in FRC. Now switch to OSC + PLL
setup_oscillator( OSC_CRYSTAL, 32000000, 8000000);
delay_ms(5000);
delay_ms(5000);
//Example blinking LED program
while(true)
{
delay_ms(DELAY);
output_toggle(LED);
}
}
|
See if doing it like that (or possibly similar) works better. I don't have that particular chip to test, so this is off the cuff code. I've used similar with other dspic33F and dsp33EP chips.
EDIT: the PCD manual indicates that the target speed should be first, so I swapped 32MHz and 8MHz in the call to setup_osc. 32MHz should come first. You also had the 8MHz set as 800KHz. I assumed the 800KHz is wrong. |
|
|
1980best
Joined: 25 May 2007 Posts: 26
|
|
Posted: Mon Oct 30, 2017 8:09 am |
|
|
However, my problem no startup.
My devices normally working, maybe 2-5 minutes.
after reset ...
I see my led toogle and devices working.
But after reset wait delay_ms(5000); delay_ms(5000); (led off !!)
after, continuous led toggle. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Mon Oct 30, 2017 8:56 am |
|
|
I reason I suggested to run at 4MHz internal is to PROVE the PIC functions. It should run for hours if not days not just 2-5 minutes.
You could have a thermal problem...or a power supply problem.
Does the PIC get hot when it fails?
What is the power supply? Being 33 series, I assume 3 volts?? what's the ripple content?? What's the current draw ??
What 8MHz xtal ?? Again, if you run the PIC from the internal osc and it works fine, then that shows you the external xtal parts(xtal,caps) have a problem...wrong values, poor PCB, etc.
There is NO point in trying to get 80-140 MHz speed if the PIC fails at 4MHz. Also the faster you go, the more critcal it is to have proper power supply, bypass caps, heat sinking, etc.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Mon Oct 30, 2017 9:27 am |
|
|
First thing to understand is you can go to 140MHz with the internal oscillator (or very close to it). The PLL on these chips is not the simple *N PLL that more basic PIC's have. It has a programmable multiplication factor from 2* to 514*. This section has an input clock requirement of 0.8 to 8MHz, and is preceded by a programmable divider giving /2 to /34. It is then followed by another programmable divider giving /2 /4 /6 & /8.
Now unlike the basic PLL, this is all controlled in software, not by the fuses. The chip wakes in a default mode, and then the clock is reprogrammed once it has started. Also if the incoming clock would give an invalid operation with the default settings, then the chip wakes using the INTRC and only switches to the external oscillator after the factors are all setup.
The internal oscillator is 7.37MHz. It can give you with a division of 8, a multiplier of 304*, and a division by 2, 139.6Mhz. This is the default 'fast' setting for the chip.
The only reason to lose pins for an external oscillator is if you need the extra clock accuracy.
Do something really basic like:
Code: |
#include <33EV32GM002.h>
#device ICSP=1
#use delay(INTERNAL=140MHz)
#FUSES FRC_PLL
#FUSES NOOSCIO
#define LED PIN_B4
void main(void)
{
while (TRUE)
{
delay_ms(1000);
output_toggle(LED);
}
}
|
If this works and toggles the LED 1/second, then you have proved your chip can run at 140MHz. If it gives problems you need to be looking at your hardware...
I see Temtronic posted while I was typing, with a different approach to the same 'target'. Basically you need to work one step at a time towards proving what is going wrong. I'd be very suspicious of supply problems. What current are you driving the LED with? |
|
|
1980best
Joined: 25 May 2007 Posts: 26
|
|
Posted: Tue Oct 31, 2017 4:06 am |
|
|
5V>Led>1K>Pic pin
5mA sink current or source
Power 5V |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Tue Oct 31, 2017 5:01 am |
|
|
hmm 5 volt.. I thought all 32 PIC were 3 volts then I reread and see the device header....33ev.... NOT a dsPIC32 series device ?
Perhaps an evaluation board ??
You should post exactly what hardware you are using.
I had assumed it was a PIC on your PCB, hence my comment about possible power supply problems. If this is an 'evaluation module', perhaps it came with preloaded software(debugger / monitor) or some other 'custom' interface to the PC. Maybe there's a dip switch or jumper that needs to be changed ??
If it is a Microchip product they will have a lot of apnotes for it.
Without more information I can't help any more,aside from general possible causes...
Jay |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Tue Oct 31, 2017 5:15 am |
|
|
temtronic wrote: | hmm 5 volt.. I thought all 32 PIC were 3 volts then I reread and see the device header....33ev.... NOT a dsPIC32 series device ?
Perhaps an evaluation board ?? |
No, it's definitely a pukkah PIC, part of the dsPIC33EVXXXGM00X/10X family. They are indeed 5V, though the processor core is lower voltage. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Tue Oct 31, 2017 5:25 am |
|
|
temtronic wrote: | hmm 5 volt.. I thought all 32 PIC were 3 volts then I reread and see the device header....33ev.... NOT a dsPIC32 series device ?
Perhaps an evaluation board ??
You should post exactly what hardware you are using.
I had assumed it was a PIC on your PCB, hence my comment about possible power supply problems. If this is an 'evaluation module', perhaps it came with preloaded software(debugger / monitor) or some other 'custom' interface to the PC. Maybe there's a dip switch or jumper that needs to be changed ??
If it is a Microchip product they will have a lot of apnotes for it.
Without more information I can't help any more,aside from general possible causes...
Jay |
These are new. About 2v core, but with 5v I/O.
The number of notes is quite limited, because they are new!.
However the old rules apply _simplify_.
He needs to do a basic test as several people have said. They are fussy about the capacitors on the Vcore, and ripple here can cause erratic behaviour. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Tue Oct 31, 2017 5:44 am |
|
|
As Mr. T says....
They are fussy about the capacitors on the Vcore, and ripple here can cause erratic behaviour.
I downloaded the dtaasheet for the 'family'.
Not exactly a 'beginners PIC'.
It'd be interesting to find out WHAT board layout the OP has. My gut tells me it ain't '25 year old white breadboard' compatible.
Being a new PIC, perhaps the header or compiler has a bug in it BUT erratic operation, like the 2-5 minutes..., just smells like a power problem.
It'll be nice to see [solved] and HOW for this thread.
Jay |
|
|
1980best
Joined: 25 May 2007 Posts: 26
|
|
Posted: Thu Nov 02, 2017 2:35 am |
|
|
PRIMARY OSCILLATOR (POSC)
The Primary Oscillator (POSC) is available on the OSC1 and OSC2 pins of the dsPIC33E/PIC24E
device family. This connection enables an external crystal (or ceramic resonator) to provide the
clock to the device. Optionally, and depending on the device, it can be used with the internal PLL
to boost the system frequency (FOSC) up to 140 MHz for 70 MIPS execution. The primary
oscillator provides three modes of operation.
• Medium Speed Oscillator (XT Mode)
The XT mode is a medium gain, medium frequency mode used to work with crystal
frequencies of 3.5 MHz to 10 MHz.
• High-Speed Oscillator (HS Mode)
The HS mode is a high-gain, high-frequency mode used to work with crystal frequencies of
10 MHz to 25 MHz.
http://ww1.microchip.com/downloads/en/DeviceDoc/70580C.pdf |
|
|
1980best
Joined: 25 May 2007 Posts: 26
|
|
Posted: Thu Nov 02, 2017 4:14 am |
|
|
Section 8. Reset
INTRODUCTION
The Reset module combines all the reset sources, and controls the device Master Reset Signal,
SYSRST. The following is a list of device Reset sources:
• POR: Power-on Reset
• BOR: Brown-out Reset
• MCLR: Master Clear Pin Reset
• SWR: RESET Instruction
• WDTO: Watchdog Time-out Reset
• CM: Configuration Mismatch Reset
(This source is not available on all devices. Refer to the specific device data sheet for
details.)
• TRAPR: Trap Conflict Reset
• IOPUWR: Illegal Condition Device Reset
- Illegal Opcode Reset
- Uninitialized W Register Reset
- Security Reset
http://ww1.microchip.com/downloads/en/DeviceDoc/S8.pdf |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Thu Nov 02, 2017 5:24 am |
|
|
So, you are reading the data sheet at last. |
|
|
|