CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC24EP512GU810 problem
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PIC24EP512GU810 problem
PostPosted: Mon Jan 09, 2017 2:19 pm     Reply with quote

Hi! I'm developing a board that has a PIC 24EP512GU810, and I'm testing the third version of the board... the previous versions works fine, but this one i can't make it run... the weird thing is that when i put the oscilloscope probe on the OSC pins i get for a short time a correct sinusoidal wave and then it goes to ground... i see this repeatedly... all the time...

I assume that the board starts for a few milliseconds and then it resets... i have checked all the traces, components and voltage levels and are ok... exactly the same as the previous versions...

Is there something that I'm missing? is there something that can cause this behaviour? (osc starts then stops... starts... stop... etc)

thanks
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Mon Jan 09, 2017 3:17 pm     Reply with quote

What frequency is the crystal frequency, crystal caps = ?, and if you have a series resistor, what is its value?

Can you change your code to use only the internal oscillator? What happens then? Can you start using the internal oscillator, then perform a clock switchover to the crystal?

Just having a quick look at that processor's errata gives me an ulcer.
temtronic



Joined: 01 Jul 2010
Posts: 9230
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 09, 2017 7:09 pm     Reply with quote

while I don't use that PIC...
1) what is different in the PCB layout or component values ?
2) try basic '1 Hz LED' program
3) read all the errata pages
4) does a PIC from a working PCB fail in the new PCB?

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19524

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 2:06 am     Reply with quote

Is it possible that the new board is using chips from a different batch?.

Do you have the parallel 1MR resistor across the crystal?.

If you look at the data sheet (Figure 9-1 Note2), you will see that this is 'required'. However I've seen batch based variations on this. Some chips will run fine without it, but on others the oscillator will not start, or if it is started by an external kick, it then stops after a while. Exactly fits what you are seeing.

Temtronic's last question, reflects this possibility....
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 8:25 am     Reply with quote

Thanks for all your Help, answering your questions:

- It is a different PIC batch.
- The PCB only changes on external connectors and some traces... nothing changes on the VDD, VSS, MCLR, OSC and VDD core pins...
-I tried the 1Meg resistor in parallel and it didn't start the osc.

I will try to use the internal oscillator, do you have a working code configuration for this? It is very confusing how many modes there are.

And last of all... if nothing helps, i will replace a working board pic to this new board and check if that's the problem... The thing is that the pic is SMD TQFP100.

thanks!
jeremiah



Joined: 20 Jul 2010
Posts: 1351

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 8:51 am     Reply with quote

Without seeing your FUSES and startup code, it is hard to say completely, but with PIC24 fuses, you normally need to change:

PR => FRC
or
PR_PLL => FRC_PLL

And set your HS,XT,EC FUSE (whichever you picked) to NOPR

And you would need to change your clock statement to match the internal

something like:
#use delay(clock=XXXXXXX)
or if you use a PLL
#use delay(internal=XXXXXXX,clock=YYYYYY)

Where XXXXXXX is your FRC frequency from the datasheet, and YYYYYY is your frequency after the PLL (if you use the PLL).

Aside from that, I don't know what code you put in for your clock.
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 8:51 am     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=47757&highlight=crystal+switchover

Look at the last post. This is for a dsPIC33-series processor but the procedure for yours will be similar.
jeremiah



Joined: 20 Jul 2010
Posts: 1351

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 9:57 am     Reply with quote

As a note on that post, there are a lot of things you should consider:
1. You have both FRC and PR_PLL selected. These are conflicting fuses. I think the PR_PLL overrides FRC because of the order.

2. The second #use delay() statement is a "precompiler" directive and does not belong inside of functions. It does not generate run time code at that location by putting it there. It should be right below the #fuses.

3. There is a setup_oscillator() method that exists for what your setup_pll does. I actually just got through showing this to a coworker who did the same as you did for his dsPIC.

4. Your first #use delay() indicates an internal oscillator.

Not to say what you have doesn't end up working, but that the journey you had to get there can be problematic and create really nasty bugs later.

If your intent was to start with the FRC and switch to the high speed crystal later, I would have done the following:

Code:

#fuses FRC //start with the FRC
#fuses HS   //sets up the circuit for your crystal for later use
//other fuses

//here only specify the end clock speed for any delay_ms(), etc. calls
//specifying anything else affects the FUSES under the hood.
#use delay(clock=80000000) 

void main(void){
   setup_oscillator(OSC_CRYSTAL, 80000000,12000000);
   while(TRUE);
}


Mind you that is off the top of my head (no compiler on this comp) so I didn't get a chance to test it for your chip, but the manual should have better details on the setup_oscillator() function.
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 12:35 pm     Reply with quote

Your method was tried but didn't work with that chip and v4.141. Because of a crystal issue, found when I bought the CCS DSP Analog development kit, the kit just wouldn't reliably run at all. Buried in the processor's datasheet was a note that the oscillator wouldn't always start if using an external crystal with PLL if the crystal's value was above some threshold. The 12MHz crystal on the development kit was above that threshold. The method in the post was and is the only way to get that processor running with a 12MHz crystal and PLL 100% reliably with v4.141 of the compiler. ...The only that I've found, anyway.
jeremiah



Joined: 20 Jul 2010
Posts: 1351

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 12:57 pm     Reply with quote

newguy wrote:
Your method was tried but didn't work with that chip and v4.141. Because of a crystal issue, found when I bought the CCS DSP Analog development kit, the kit just wouldn't reliably run at all. Buried in the processor's datasheet was a note that the oscillator wouldn't always start if using an external crystal with PLL if the crystal's value was above some threshold. The 12MHz crystal on the development kit was above that threshold. The method in the post was and is the only way to get that processor running with a 12MHz crystal and PLL 100% reliably with v4.141 of the compiler. ...The only that I've found, anyway.


Yeah, we had the same issue with a dsPIC as well, which is why we started with the FRC then enabled the crystal and PLL afterwards. We used the 5x compiler though, so it might have been a bug in the 4x version.

EDIT: I was wrong, we didn't start with the FRC, we started with the crystal running without the PLL:

Code:

#include <33FJ128GP804.h> // check for dsPic we have
#DEVICE ADC=10 // 10 bit ADC

#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 NOPROTECT      //Code not protected from reading
#fuses IESO           //Internal External Switch Over mode enabled

#fuses PR             //Primary Oscillator
#fuses HS             //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#fuses CKSFSM         //Clock Switching is enabled, fail Safe clock monitor is enabled

#fuses NOIOL1WAY      //Allows multiple reconfigurations of peripheral pins
#fuses NOWDT          //No Watch Dog Timer
#fuses NOPUT          //No Power Up Timer
#fuses NOALTI2C1      //I2C1 mapped to SDA1/SCL1 pins
#fuses ICSP1          //ICD uses PGC1/PGD1 pins
#fuses NOJTAG         //JTAG disabled
#fuses NODEBUG        //No Debug mode for ICD

#use delay(clock = 80000000) // "clock" is generic and follows fuses, "crystal" might change things

void main(void){
   setup_oscillator(OSC_CRYSTAL,80000000,16000000); 
   while(TRUE);
}


That enabled us to get the PLL working after startup. It was compiled with 5.063 and a different chip though, so keep that in mind. Could very well be a version 4 compiler bug.


Last edited by jeremiah on Tue Jan 10, 2017 3:40 pm; edited 1 time in total
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 2:22 pm     Reply with quote

Hi, im trying to use the internal oscilator, but I dont know if this config its ok:

Code:
#include <24EP512GU810.h>
#build(stack=1024)
#device ADC=10

#device PASS_STRINGS = IN_RAM
#fuses NOWDT,PUT64,BROWNOUT,ICSP1,NOJTAG,NODEBUG,NOAWRT, NOPROTECT,NOIESO,NOPR ,SOSC,FRC_PLL 

#use delay(internal=8Mhz, clock=140Mhz)


is this correct?
Ttelmah



Joined: 11 Mar 2010
Posts: 19524

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 2:48 pm     Reply with quote

I think you will find the internal is fixed at 7.37MHz (it is on most PIC's in this family).
jeremiah



Joined: 20 Jul 2010
Posts: 1351

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 3:43 pm     Reply with quote

I'd have to go back and look, but I would think the SOSC fuse is a competitor to the FRC_PLL one (it tells the main clock to run off of SOSC), not a separate fuse. There is a fuse that controls the SOSC, but it is normally named differently.

Still, I think since FRC_PLL is after SOSC, it will overwrite it, so you should still be ok if so.

I would write a small empty test code, then look at the LST file to see what the actual fuses are (they can be different than what you put in the top of your code). Then you can compare them to what you specified.
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 4:34 pm     Reply with quote

well... damn... it works with this fuses:

Quote:
#device PASS_STRINGS = IN_RAM
#fuses NOWDT,PUT64,BROWNOUT,ICSP1,NOJTAG,NODEBUG,NOAWRT, NOPROTECT,NOIESO,NOPR ,SOSC,FRC

#use delay(internal=7370000)


So... the problem is my osc circuit? I use a 8mhz crystal with 2 15pf caps.

The traces are very short less than 10mm... but one of the traces its a little longer than the other (2mm longer). Could that be a problem? I dont know why on the older board it works and in this one not... the osc circuit its THE SAME...

Any suggestions? tomorrow i will try to solder again the 1Meg resistor in parallel and change crystal and caps... fingers crossed
temtronic



Joined: 01 Jul 2010
Posts: 9230
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 10, 2017 5:21 pm     Reply with quote

hmm..
same batch of xtals ?

maybe test xtal/caps on a breadboard and a simpler PIC ??

possible solder bridge/ flux not gone problem ?

I don't use SMT PICs, too dang small for my old eyes !

Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group