1
\$\begingroup\$

Maybe there are some experienced "wolves", who could help out to clear out confusion about internal/external clock sources. Particularly, I got lost while reading PIC32 family reference manual, "Section 6. Oscillators".

As for the fact, I know that using external oscillators are recommended for stability, accuracy and flexibility. However, I was trying to figure out if I would be fine using only internal oscillator of PIC32MX250F128D, I do have requirement to establish communication with PC using internal USB hardware.

At initial impression it seemed, that I'd be just fine, then I started reading in greater detail and notice that:

  1. It states that internal oscillator isn't used for normal USB operation:

6.3.4 USB Clock (USBCLK) Generation The USBCLK can be derived from the 8 MHz internal FRC Oscillator, 48 MHz POSC, or the 96 MHz PLL from the POSC. For normal operation, the USB module requires exact 48 MHz clock. When using 96 MHz PLL, the output is internally divided to obtain 48 MHz clock. The FRC clock source is used to detect USB activity and bring USB module out of Suspend mode. Once USB module is out of Suspend mode, it must use a 48 MHz clock to perform the USB transactions. The internal FRC Oscillator is not used for normal USB module operation.

  1. Another paragraph states that it can be used, even not very clearly:

The internal 8 MHz FRC Oscillator is available as a clock source to detect any USB activity during USB Suspend mode and bring the module out of the Suspend mode. To enable FRC for USB usage, the UFRCEN bit (OSCCON<2>) must be set to ‘1’ before putting the USB module in Suspend mode.

  1. Then from block diagram, we can see that for the USB we need clock signal of 48MHz, however internal clock is only 8MHz, and it doesn't go throughout any multipliers to USB block: Oscillator System Block Diagram

Actually, once I written this post it became more clearly. I still have questions such as, if my goal is to use this MCU as USB device (CDC class(to act as virtual serial port)) I may not need full speed of USB, therefore it may be enough just to use internal clock source of 8MHz? Otherwise, could we conclude that there is no other way out except using external oscillator based on my requirements.

\$\endgroup\$
3
\$\begingroup\$

From your quote of the datasheet:

For normal operation, the USB module requires exact 48 MHz clock

and

Once USB module is out of Suspend mode, it must use a 48 MHz clock to perform the USB transactions

Those pretty much say it all. You cannot use the internal 8MHz clock to perform USB transactions. The USB core built in to the PIC requires a 48MHz clock in order to function as a USB slave.

The USB link runs at a fixed speed - both the host and slave must run from clocks of roughly the same speed in order to function, regardless of whether your throughput is using the full capabilities of the link. So just because you are using CDC which doesn't require a lot of throughput, you still need your slave to run at a similar frequency to the host.

You must use an external crystal in order for the device to operate as a USB slave.

\$\endgroup\$
  • \$\begingroup\$ Thanks, now it is clear enough. I think I should read more about USB and its protocol, to get better overall picture. Thanks for your time and effort, it helped! \$\endgroup\$ – Nerijus Džindželėta Mar 20 '16 at 1:18

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.