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

Disable secondary oscillator in PIC24F16KA101

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



Joined: 05 Sep 2013
Posts: 14

View user's profile Send private message

Disable secondary oscillator in PIC24F16KA101
PostPosted: Thu Sep 05, 2013 2:25 am     Reply with quote

Hi,

I use a PIC24F16KA101 and i want to use the secondary oscillator pins for general purpose IO, but this doesn't work SOSCEN bit =0. If someone have an idea ?
Does the compile directive "#DELAY()" impact the secondary oscillator??

Any assistance would be greatly appreciated.

Best regards
jeremiah



Joined: 20 Jul 2010
Posts: 1349

View user's profile Send private message

PostPosted: Thu Sep 05, 2013 4:05 pm     Reply with quote

I don't have that specific chip, but for the PIC24F32KA302 a fuse must be set before you can use them as digital I/O. Check your fuses for the chip as a starting point.
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Fri Sep 06, 2013 12:17 am     Reply with quote

Post:

1) Compiler version.
2) Fuses.
3) #use delay line
4) Any 'setup_oscillator' statement(s).
5) Setup used on timer1.

Last is the most likely problem. You need to ensure timer1 is set to use 'internal', or _it_ uses the secondary oscillator.

Best Wishes
ELINAP



Joined: 05 Sep 2013
Posts: 14

View user's profile Send private message

PostPosted: Fri Sep 06, 2013 1:39 am     Reply with quote

Hi,

Thanks for theses answers.

For more infos:

Compiler CCS IDE V5.001
Fuses:
Code:

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOBSS                    //No boot segment
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOWINDIS                 //Watch Dog Timer in non-Window mode
#FUSES NOBROWNOUT               //No brownout reset
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NODSBOR
#FUSES NOIESO                   //Internal External Switch Over mode enabled
#FUSES OSCIO                  //OSC2 is general purpose output
#FUSES NOCKSFSM                 //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES NOPUT                    //Power Up Timer
#FUSES ICSP2                    //ICD uses PGC1/PGD1 pins
#FUSES NODSWDT

#FUSES NOPR
#FUSES FRC              //Internal oscillator FRC

#use delay(internal=8MHZ)

Init:
Code:

   OSCCON=0x0010;
   setup_rtc(RTC_DISABLE);
   setup_timer1(TMR_DISABLED);         // don't use it
   setup_timer2(TMR_INTERNAL |TMR_DIV_BY_256 ,1420);
   setup_timer3(TMR_DISABLED |TMR_DIV_BY_1 ,0);
   set_pullup(TRUE,PIN_A4);
   SOSCEN=0;
   OSWEN=0;
   setup_ADC_PORTS(sAN0,VSS_VDD);
   setup_adc(ADC_CLOCK_INTERNAL | ADC_TAD_MUL_4);
   set_adc_channel(0);

I don't use the "setup_oscillator" instruction because I need OSCI and OSCO pins as general purpose IO ( this is OK ) but I want the same thing with the pins SOSCI and SOSCO.

Best regards
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Sep 07, 2013 5:11 am     Reply with quote

I don't understand the problem.

24F16KA101 secondary oscillator is diabled by default, there's nothing you have to do about it to use the
respective pins as general IO.
ELINAP



Joined: 05 Sep 2013
Posts: 14

View user's profile Send private message

PostPosted: Mon Sep 09, 2013 5:53 am     Reply with quote

I don't understand too.

Thanks even so.
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Mon Sep 09, 2013 7:47 am     Reply with quote

I'd be suspicious of 5.001.
It was the first 'beta' release of V5. Might not be actually setting fuses correctly. Try loading the generated file into MPLAB, and verify what the actual fuse selections are.

Best Wishes
ELINAP



Joined: 05 Sep 2013
Posts: 14

View user's profile Send private message

Solved
PostPosted: Thu Sep 12, 2013 3:39 am     Reply with quote

Hi,

Thanks for the idea to use MPLAB. I found the problem.
"FUSES RTCOSC_LP" was missing. The RTCC still use the secondary oscillator.

Best regards
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