| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Mrinmoy 
 
 
 Joined: 20 Dec 2023
 Posts: 16
 
 
 
			        
 
 | 
			
				| PIC24F Clock frequency multiply problem |  
				|  Posted: Fri Sep 20, 2024 1:40 am |   |  
				| 
 |  
				| Hi Everyone, 
 I am using PIC24FJ512GL406 mcu in one of my project and using 32MHz external oscillator and want to double the clock frequency by using PLL.
 
 
  	  | Code: |  	  | 
 //********* CPU Settings *******************************************
 
 #device ICSP = 1
 #pragma use delay(osc=32000000,clock=64000000,restart_wdt,clock_out)
 #pragma fuses NOPROTECT,WDT,NOBROWNOUT,DEBUG,CKSNOFSM
 
 
 | 
 
 This is my system setup code but not working.
 If I change my line like -
 
 
  	  | Code: |  	  | 
 #pragma use delay(clock=64MHz,osc,restart_wdt,clock_out)
 
 
 | 
 
 Then the code will run but timer is not matching with 64MHz calculation and also clock out PIN shows 16MHz.
 
 Any help will be highly appreciated.
 Thanks in advance
  [/code] |  | 
	
		|  | 
	
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19966
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Fri Sep 20, 2024 3:59 am |   |  
				| 
 |  
				| The 16MHz, is right. Data sheet. CLKO = FOSC/2. 
 Are you sure what frequency you are running the timer off?. The timers by
 default are run off the 'peripheral clock'. This is also FOSC/2. Look at
 figure 9-1.
 |  | 
	
		|  | 
	
		| gaugeguy 
 
 
 Joined: 05 Apr 2011
 Posts: 350
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Fri Sep 20, 2024 5:53 am |   |  
				| 
 |  
				| With that processor, the CPU can only run at up to 32MHz.  The PLL can be used to get 48MHz for the USB. You cannot run the processor at 64MHz.
 |  | 
	
		|  | 
	
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19966
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Sep 21, 2024 12:21 am |   |  
				| 
 |  
				| Spot on. Maximum CPU instruction speed is 16MHz. Max clock 32MHz. |  | 
	
		|  | 
	
		| Mrinmoy 
 
 
 Joined: 20 Dec 2023
 Posts: 16
 
 
 
			        
 
 | 
			
				|  |  
				|  Posted: Sat Sep 21, 2024 1:19 am |   |  
				| 
 |  
				| Yes! I just check it. CPU of that particular controller can run maximum at 16MHz.
 
 Thanks guys.
  |  | 
	
		|  | 
	
		|  |