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 support@ccsinfo.com

Can't configure PIC24FJ internal oscillator [Solved]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
E_Blue



Joined: 13 Apr 2011
Posts: 410

View user's profile Send private message

Can't configure PIC24FJ internal oscillator [Solved]
PostPosted: Fri Sep 13, 2019 12:14 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Sep 13, 2019 12:28 pm     Reply with quote

Read Ttelmah's comment about how you have to set a fuse to specify
the PIC pins to be used for the debugger:
http://www.ccsinfo.com/forum/viewtopic.php?t=58110
E_Blue



Joined: 13 Apr 2011
Posts: 410

View user's profile Send private message

PostPosted: Fri Sep 13, 2019 12:54 pm     Reply with quote

I don't understand where are you going with this but I'm using this code to set the ICD pins

Code:
#device ICD=1


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

View user's profile Send private message

PostPosted: Fri Sep 13, 2019 1:04 pm     Reply with quote

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: 410

View user's profile Send private message

PostPosted: Fri Sep 13, 2019 1:36 pm     Reply with quote

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: 9100
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Sep 13, 2019 2:28 pm     Reply with quote

hmm.. is this CCS legal ??
Quote:

int main(int argc, char** argv)

just curious
Jay
newguy



Joined: 24 Jun 2004
Posts: 1901

View user's profile Send private message

PostPosted: Fri Sep 13, 2019 2:29 pm     Reply with quote

temtronic wrote:
hmm.. is this CCS legal ??

int main(int argc, char** argv)

just curious
Jay


Nein.
E_Blue



Joined: 13 Apr 2011
Posts: 410

View user's profile Send private message

PostPosted: Fri Sep 13, 2019 2:31 pm     Reply with quote

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: 1901

View user's profile Send private message

PostPosted: Fri Sep 13, 2019 2:49 pm     Reply with quote

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: 410

View user's profile Send private message

PostPosted: Fri Sep 13, 2019 3:45 pm     Reply with quote

Ok, I changed the function to void main() and is running ok.
Now I will try with the full program.
_________________
Electric Blue
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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