View previous topic :: View next topic |
Author |
Message |
z1rqdym
Joined: 14 Dec 2014 Posts: 24
|
CCS C 5.015 dsPIC33FJ128GP802 DO NOT WORK |
Posted: Thu Jun 04, 2015 7:44 pm |
|
|
Code: | #include <33FJ128GP802.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOWRTB //Boot block not write protected
#FUSES NOBSS //No boot segment
#FUSES NORBS //No Boot RAM defined
#FUSES NOWRTSS //Secure segment not write protected
#FUSES NOSSS //No secure segment
#FUSES NORSS //No secure segment RAM
#FUSES NOWRT //Program memory not write protected
#FUSES NOOSCIO
#FUSES HS
#FUSES PR_PLL
#FUSES NOPROTECT //Code not protected from reading
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES NOOSCIO //OSC2 is clock output
#FUSES IOL1WAY //Allows only one reconfiguration of peripheral pins
#FUSES CKSFSM //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES WINDIS //Watch Dog Timer in non-Window mode
#FUSES PUT128 //Power On Reset Timer value 128ms
#FUSES NOALTI2C1 //I2C1 mapped to SDA1/SCL1 pins
#FUSES NOJTAG //JTAG disabled
#device ICSP=1
#use delay(clock=80MHz,crystal=20MHz)
#define LED PIN_A4
#define DELAY 10
void main()
{
//Example blinking LED program
while(true)
{
output_low(LED);
delay_ms(DELAY);
output_high(LED);
delay_ms(DELAY);
}
} |
This is a simple LED blinking program.
But it doesn't work.
I write the hex file with Brenner8p-rev5 pic programmer. They give me 21error in hex files and give me an error FPOR too.
What's the matter?
I tried external and internal osc but it doesn't work.
Any ideas?
I used between Vdd-Vss and AVdd-AVss 100nF Ceramic capacitor. In Vcap I used 10uF 16V Electrolytic capacitor ( i know it must be a tantalum one.) |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1355
|
|
Posted: Thu Jun 04, 2015 8:53 pm |
|
|
On a lot of chips in that family, the A4 pin is one of the secondary oscillator pins (SOSCO usually). On many chips, this has to be disabled and set to digital by either a FUSE or an oscillator configuration option.
Try a different pin, one of the port B pins maybe. Something without a crazy peripheral. That'll help identify if the SOSC module is preventing you from using A4 or if it is something more sinister.
Also note that is an early more beta version of the compiler, so that might be part of the problem. |
|
|
z1rqdym
Joined: 14 Dec 2014 Posts: 24
|
|
Posted: Thu Jun 04, 2015 8:54 pm |
|
|
I tried some things like that;
i changed the
#use delay(clock=80mhz, crystal=10mhz)
to
#use delay(clock=10mhz, crystal=10mhz)
the #FUSES HS, PR_PLL are the same
with this it works.
so i do not thought thats the problem from SOCSO pin.
but i need to configure the pic with PLL upto 80MHz but i have no idea how could i do this
When I increase the clock like 20mhz then the dsPIC make trouble. |
|
|
z1rqdym
Joined: 14 Dec 2014 Posts: 24
|
|
Posted: Fri Jun 05, 2015 12:48 am |
|
|
I just want to know the code wich do; 10Mhz external crystal to with PLL up to 80MHz to use at 40MIPS that dsPIC33FJ128GP802.
i tried many things, i lost my brain but i can not find any solutions.
on my circuit there is a 10MHz Crystal 2 pear of 15pF capacitor.
that dsPIC works fine with his own crystal/internal frequency. but that doesnt makes different between 18F or 16F pic series.
i should that dsPIC use with 40MIPS/80MHz with 10MHz crystal.
please i need to help of them. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19548
|
|
Posted: Fri Jun 05, 2015 1:07 am |
|
|
If you are getting an error when you program, you need to go to the forum for the programmer and find out what this means. The 'odds' are the chip is not actually programmed properly, and it isn't going to run until it is......
First, test using another pin. Something where the pin I/O function, is the highest priority function, like A0. If this works, then you know you are actually programming the chip OK, so can now look for a problem on the pin you are trying to use. Try turning off the parallel master port. This pin has two things 'higher priority' than the I/O functions. The first the secondary oscillator, the second the PMP. The configuration you show should be turning off the SOSC, but the PMP does wake up enabled in many cases. |
|
|
z1rqdym
Joined: 14 Dec 2014 Posts: 24
|
|
Posted: Fri Jun 05, 2015 10:08 am |
|
|
I don't know what am I do or what's happend but at now it works perfectly with these Fuses
Code: |
#include <33FJ128GP802.h>
#device ICSP=1
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOWRTB //Boot block not write protected
#FUSES NOBSS //No boot segment
#FUSES NORBS //No Boot RAM defined
#FUSES NOWRTSS //Secure segment not write protected
#FUSES NOSSS //No secure segment
#FUSES NORSS //No secure segment RAM
#FUSES NOWRT //Program memory not write protected
#FUSES NOOSCIO //OSC1 and OSC2 pins are configured to Fin
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOIESO //Internal External Switch Over mode enabled
#FUSES NOOSCIO //OSC2 is clock output
#FUSES IOL1WAY //Allows only one reconfiguration of peripheral pins
#FUSES CKSFSM //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES WINDIS //Watch Dog Timer in non-Window mode
#FUSES PUT128 //Power On Reset Timer value 128ms
#FUSES NOALTI2C1 //I2C1 mapped to SDA1/SCL1 pins
#FUSES NOJTAG //JTAG disabled
#FUSES XT
#FUSES PR_PLL
#use delay(clock=80MHz,CRYSTAL=8MHz)
|
i read again and again and again the specification notes of the dsPIC from microchip.
Fin wich is my crystal frequance, that could be only 0.8-8MHz to use in PLL.
anyway
with HS PR_LL clock=80mhz crystal=10mhz it works.
with XT PR_LL clock=80mhz crystal=10mhz it works too.
for the datasheet it wont be able to work correct but ccs c does. why?
i worked bunch of hours to work that PLL but now i dont change anything but its work. why?
by the way... the problem is solved.
but i will know these why? that i ask above |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1355
|
|
Posted: Fri Jun 05, 2015 10:36 am |
|
|
z1rqdym wrote: |
i read again and again and again the specification notes of the dsPIC from microchip.
Fin wich is my crystal frequance, that could be only 0.8-8MHz to use in PLL.
anyway
with HS PR_LL clock=80mhz crystal=10mhz it works.
with XT PR_LL clock=80mhz crystal=10mhz it works too.
for the datasheet it wont be able to work correct but ccs c does. why?
i worked bunch of hours to work that PLL but now i dont change anything but its work. why?
by the way... the problem is solved.
but i will know these why? that i ask above |
Look at the datasheet again. the 0.8-8.0MHz is after the PREPLL block (see figure 9.2) which divides the incoming clock down before entering the rest of the PLL block.
The compiler is probably dividing the clock down in the PREPLL block so that it is between 0.8-8.0 MHz. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19548
|
|
Posted: Fri Jun 05, 2015 12:58 pm |
|
|
Yes.
It divides the 10MHz by 2, then multiplies it by 32, then divides by 2.
I checked before posting this pattern, that the fuses and registers are set correctly.
I'd suggest that the error you were getting from the programmer was it failing to set something in the fuses and making the larger change has forced it to do a full erase. |
|
|
drolleman
Joined: 03 Feb 2011 Posts: 116
|
|
Posted: Fri Jun 05, 2015 1:55 pm |
|
|
start simple
intrc 7mhz no pll get the led flashing
intrc with pll get the led flashing
hs and no pll get the led flashing this makes sure your crystal works
now add pll and you will be at the freq you want.
trying to do too many steps at once makes the job a lot harder. guessing as to where the issues are. you may want to use the 32 kHz clock because of your cap not being tantalum. I've never tried to use an electrolytic. |
|
|
|