Forums

PIC32 oscillator question

Started by Randy Day February 3, 2014
I'm using the following code to test my 
oscillator configuration setup, and I'm
puzzled. No matter what values I use for 
fpllidiv, fpllodiv, fpllmul, etc., my 
PORTB scope waveform never changes its 
period.

Code runs fine on the device, I just 
expect to see the output vary with clock 
freq settings. I must be missing 
something obvious. Any suggestions?

/* MPLAB v8.92, if that's important */
#pragma	FCKSM = CSDCMD
#pragma	IESO = OFF
#pragma	UPLLEN = OFF
#pragma	FNOSC = FRCPLL
#pragma	FSOSCEN = OFF
#pragma	POSCMOD = OFF
#pragma	OSCIOFNC = OFF
#pragma	JTAGEN = OFF
#pragma	FPLLIDIV = DIV_2
#pragma	FPLLODIV = DIV_256
#pragma	FPLLMUL = MUL_20
#pragma	FPBDIV = DIV_8

. 
.
.
	li	s1, 0xFFFFFFFF
test:
	sw	s1, PORTBINV
	b	test

In article <MPG.2d58d73ea27558fc989688@aioe.org>, randy.day@sasktel.netx 
says...

> I'm using the following code to test my
I finally caught on that the pragmas in my code were being ignored, and that the 'config bits' window in mplab actually allows you to change settings. I'm getting lots of speed now!
On Mon, 03 Feb 2014 10:17:15 -0600, Randy Day wrote:

> In article <MPG.2d58d73ea27558fc989688@aioe.org>, randy.day@sasktel.netx > says... > >> I'm using the following code to test my > > I finally caught on that the pragmas in my code were being ignored, and > that the 'config bits' window in mplab actually allows you to change > settings. > > I'm getting lots of speed now!
As a suggestion, if you're ever going to have someone else work on the design, make sure that this is all very well documented somehow. I hate IDE's, and obscure configuration settings, for just the reason you're running into. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On Mon, 03 Feb 2014 12:28:16 -0600, Tim Wescott
<tim@seemywebsite.really> wrote:

>On Mon, 03 Feb 2014 10:17:15 -0600, Randy Day wrote: > >> In article <MPG.2d58d73ea27558fc989688@aioe.org>, randy.day@sasktel.netx >> says... >> >>> I'm using the following code to test my >> >> I finally caught on that the pragmas in my code were being ignored, and >> that the 'config bits' window in mplab actually allows you to change >> settings. >> >> I'm getting lots of speed now! > >As a suggestion, if you're ever going to have someone else work on the >design, make sure that this is all very well documented somehow. > >I hate IDE's, and obscure configuration settings, for just the reason >you're running into.
With MPLAB I put the config bits in the Header file. That way I dont' have to figure it out in the future. Cheers
In article <fKmdnSGRLY5dQnLPnZ2dnUVZ_tKdnZ2d@giganews.com>, 
tim@seemywebsite.really says...

[snip]

> As a suggestion, if you're ever going to have someone else work on the > design, make sure that this is all very well documented somehow.
Thanks. I've put my little 'discoveries' in the comments.
On Mon, 03 Feb 2014 12:28:16 -0600, Tim Wescott wrote:

> On Mon, 03 Feb 2014 10:17:15 -0600, Randy Day wrote: > >> In article <MPG.2d58d73ea27558fc989688@aioe.org>, >> randy.day@sasktel.netx says... >> >>> I'm using the following code to test my >> >> I finally caught on that the pragmas in my code were being ignored, and >> that the 'config bits' window in mplab actually allows you to change >> settings. >> >> I'm getting lots of speed now! > > As a suggestion, if you're ever going to have someone else work on the > design, make sure that this is all very well documented somehow. > > I hate IDE's, and obscure configuration settings, for just the reason > you're running into.
I should mention that the first "someone else" who had to work on poorly commented code that I produced was me, six months after I had put a project aside for a while. Oh, the things we learn when we're 13 and stupid. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Tim Wescott <tim@seemywebsite.really> wrote:
> On Mon, 03 Feb 2014 12:28:16 -0600, Tim Wescott wrote: > >> On Mon, 03 Feb 2014 10:17:15 -0600, Randy Day wrote: >> >>> In article <MPG.2d58d73ea27558fc989688@aioe.org>, >>> randy.day@sasktel.netx says... >>> >>>> I'm using the following code to test my >>> >>> I finally caught on that the pragmas in my code were being ignored, and >>> that the 'config bits' window in mplab actually allows you to change >>> settings. >>> >>> I'm getting lots of speed now! >> >> As a suggestion, if you're ever going to have someone else work on the >> design, make sure that this is all very well documented somehow. >> >> I hate IDE's, and obscure configuration settings, for just the reason >> you're running into. > > I should mention that the first "someone else" who had to work on poorly > commented code that I produced was me, six months after I had put a > project aside for a while.
The lab reports that they taught me how to write back in engineering school are as critical to me as charting is to a physician or dentist. -- __ __/ \ / \__/ \__/ Don Kuenz / \__ \__/ \ \__/
On Monday, February 3, 2014 11:17:15 AM UTC-5, Randy Day wrote:
> In article <MPG.2d58d73ea27558fc989688@aioe.org>, randy.day@s=ktel.netx > > says... > > > > > I'm using the following code to test my > > > > I finally caught on that the pragmas > > in my code were being ignored, and > > that the 'config bits' window in mplab > > actually allows you to change settings. > > > > I'm getting lots of speed now!
Are you using mplabx? which PIC are you using? For what? jb
In article <1a3369d4-6ebc-41a6-92aa-8dcb4614fd9a@googlegroups.com>, 
haiticare2011@gmail.com says...

[snip]

> > I'm getting lots of speed now! > > Are you using mplabx?
MPLAB 8.92. I'm familiar enough with its quirks that I've resisted moving up to X.
> which PIC are you using? For what?
PIC32mx150. It's my first foray into 32-bit world.