View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
Can't configure PIC24FJ internal oscillator [Solved] |
Posted: Fri Sep 13, 2019 12:14 pm |
|
|
Can't configure PIC24FJ internal oscillator.
Device: PIC24FJ1024GB606
CCS: v5.078
MPLAB X IDE: v5.15
I want to use the internal oscillator(FRC) to drive the PLL for USB(96MHz) and MCU core(32MHz).
I tried with this
Code: | #include <24FJ1024GB606.h>
#fuses FRC_PLL,PLL_FROM_FRC,NOJTAG |
With no luck.
Also tried
Code: |
#include <24FJ1024GB606.h>
#use delay(internal=32MHz, USB_FULL) |
Doesn't work either; the device gets programmed but didn't start.(debug halted)
I check the configuration bits and says PLL_PRI -> PLL is fed by the primary oscillator.
It's like the configuration is not being applied, I don't understand why
I'm new on PIC24 devices, so probably I'm making a very silly mistake.
Could you guide me please? _________________ Electric Blue |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Fri Sep 13, 2019 12:54 pm |
|
|
I don't understand where are you going with this but I'm using this code to set the ICD pins
And I have the ICD3 connected to PIN15 and PIN16.
That's why I think that the problem is that the oscillator FRC is not driving the core. _________________ Electric Blue |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Sep 13, 2019 1:04 pm |
|
|
Can you blink an LED ? Remove the USB_FULL and see if you can even
blink an LED. |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Fri Sep 13, 2019 1:36 pm |
|
|
I tried this and get the same result, device halted.
Code: | #include <24FJ1024GB606.h>
//#fuses FRC_PLL,PLL_FROM_FRC,NOJTAG
#device ICD=1
#DEVICE ADC=10
#ZERO_RAM
#use delay(internal=32MHz)
/*
*
*/
int main(int argc, char** argv)
{
while(1)
{
output_toggle(PIN_D6);
delay_ms(500);
}
} |
_________________ Electric Blue |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Fri Sep 13, 2019 2:28 pm |
|
|
hmm.. is this CCS legal ??
Quote: |
int main(int argc, char** argv)
|
just curious
Jay |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Fri Sep 13, 2019 2:29 pm |
|
|
temtronic wrote: | hmm.. is this CCS legal ??
int main(int argc, char** argv)
just curious
Jay |
Nein. |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Fri Sep 13, 2019 2:31 pm |
|
|
I don't know but CCS doesn't complain about.
Also I tried this with same results.
Code: | #include <24FJ1024GB606.h>
//#fuses FRC_PLL,PLL_FROM_FRC,NOJTAG
#device ICD=1
#ZERO_RAM
#use delay(internal=32MHz)
/*
*
*/
int main()
{
while(1)
{
output_toggle(PIN_D6);
delay_ms(500);
}
} |
_________________ Electric Blue |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Fri Sep 13, 2019 2:49 pm |
|
|
The structure of your main() is that of a windows terminal program which is expecting user input when it runs.
Code: | void main(void) {
...
} |
is standard for any embedded application. |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Fri Sep 13, 2019 3:45 pm |
|
|
Ok, I changed the function to void main() and is running ok.
Now I will try with the full program. _________________ Electric Blue |
|
|
|