2
\$\begingroup\$

I'm setting up my PIC oscillator frequency and I'm using a PIC24HJ128GP202. From what I've seen in the datasheet, two of my total options were to use a crystal or a internal oscillator (FRC) which would go through the PLL and scale my frequency of operation up to 80MHz.

I decided to use a 10MHz external crystal. To reach 40 MIPS I should configure correclty the PLL parameters N1, N2 and M. It all seems to be fine except that these last parameters are configurable by software. I was used to PIC's like PIC18f4550 where these oscillator settings were configurable through the configuration bits. So whenever I program the device, it would have those settings always after reset.

In this case (PIC24HJ128GP202) I can only configure what kind of oscillator I will use in the configuration bits (HS with PLL). PLL is only configurable by software. So, since the PLL default values will get my frequency out of the bounds specified by the datasheet, how can I configure the PLL by software if the software requires a correct oscillator frequency of operation? Is it the case of using IESO (start-up with internal oscillator)? Any other way around this problem?

\$\endgroup\$
  • \$\begingroup\$ How is this not answered clearly in the oscillator section of the datasheet? \$\endgroup\$ – Olin Lathrop Mar 3 '14 at 18:44
  • \$\begingroup\$ I was looking at the complete datasheet PDF. This specific issue is dealt with in the specific Oscillator PDF. I had to start running with HS w/o PLL (not necessarily FRC) and then make a clock switch. \$\endgroup\$ – Felipe_Ribas Mar 3 '14 at 19:17
  • \$\begingroup\$ The datasheet includes a section on the oscillator, which points to the oscillator chapter in the family reference manual for more information. \$\endgroup\$ – Olin Lathrop Mar 3 '14 at 21:45
0
\$\begingroup\$

Please refer to section 2.7 in the datasheet.

If the PLL of the target device is enabled and configured for the device start-up oscillator, the maximum oscillator source frequency must be limited to 4 MHz < FIN < 8 MHz to comply with device PLL start-up conditions. This means that if the external oscillator frequency is outside this range, the application must start-up in the FRC mode first. The default PLL settings after a POR with an oscillator frequency outside this range will violate the device operating speed.

Looks like you will have to start-up with the internal oscillator and then switch to your specific settings.

\$\endgroup\$
  • \$\begingroup\$ Please see my edits to your answer. Don't just paste hyperlinks, use the link tool in the editor to make them inline. Also, summarize the critical information in your answer in case the hyperlink ever changes. \$\endgroup\$ – Adam Lawrence Mar 3 '14 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.