View previous topic :: View next topic |
Author |
Message |
denis_11
Joined: 13 Jul 2010 Posts: 45
|
USB CDC problem with CPUDIV |
Posted: Tue Sep 21, 2010 4:22 pm |
|
|
Hi I'm trying a PIC 18f14k50 with usb-cdc emulating a serial com, I use a real crystal of 20MHz but unfortunately when I connect the circuit to the pc tells me that it did not work properly ... I'm sure I have some problem with the crystal and its setting ... I also connected capacitor 470nF and the circuit is ok ... these are the fuses:
Code: |
#include <18F14k50.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES NOBROWNOUT //No browno BORV19
#FUSES NOPUT //No Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOWRTC //configuration not registers write protected
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOMCLR //Master Clear pin disabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOCPB //No Boot Block code protection
#FUSES NOWRTB //Boot block not write protected
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES HFOFST
#FUSES NOWRT0
#FUSES NOWRT1
#FUSES USBDIV1
#FUSES BBSIZ2K //2K words Boot Block size
#FUSES CPUDIV3
#FUSES PLLEN
#FUSES PCLKEN
#use delay(clock=20000000) |
What's wrong? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 21, 2010 4:47 pm |
|
|
The 18F14K50 data sheet doesn't show a 20 MHz crystal to be an option
for USB. It must be a 6 MHz or 12 MHz crystal. Look at these tables
in the PIC data sheet:
Quote: |
TABLE 2-4: LOW SPEED USB CLOCK SETTINGS
TABLE 2-5: FULL-SPEED USB CLOCK SETTINGS
|
Besides those crystals, there are some other options for an external
oscillator, as shown in the tables given above.
Also, you can't use the internal oscillator. The data sheet says:
Quote: | 2.11 USB Operation
Because of timing requirements imposed by the USB
specifications, the Primary External Oscillator is
required for the USB module. |
If you want more crystal options for USB, you need to use a PIC that
allows them, such as the 18F4550. |
|
|
|