View previous topic :: View next topic |
Author |
Message |
imabme
Joined: 06 Feb 2014 Posts: 2
|
18F25K50 internal oscillator configuration for USB problem |
Posted: Thu Feb 06, 2014 2:05 am |
|
|
I use 18F25K50 with internal oscillator for USB operation.
But it is not enumerated. What problem is in code?
When I connect board to PC, unknown device error message.
Anybody help me?
Code: |
#include <18F25K50.h>
#include <pic18_usb.h>
#include <usb_desc_kbmouse2.h>
#include <usb.c>
#fuses NOWDT,NOPROTECT,NODEBUG
#fuses NOPBADEN // PORTB PIN DIGITAL I/O
//oscillator configuration for USB with 25K50
#fuses NOCPUDIV,PLL3X,PLLEN
#use delay(internal=16MHz, USB_FULL)
main()
{
usb_init_cs();
while(1)
{
usb_task();
usb_debug_task();
if(usb_enumerated())
{
output_high(LED1);
delay_ms(100);
output_low(LED1);
delay_ms(100);
}
}
} |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Thu Feb 06, 2014 2:26 am |
|
|
This is a 'read the data sheet' question....
The internal clock can't be used for USB. On this chip it is several orders of magnitude too inaccurate for USB operation. Look at table 3-7 in the data sheet. Note what clock modes are listed as being useable for USB.
There are some other more recent chips that have a PLL ability to lock the internal clock onto the clock on the USB bus to allow them to run without an external oscillator, but even on these, only low speed USB operation is supported (this has a clock accuracy requirement about an order of magnitude lower than full speed operation). |
|
|
imabme
Joined: 06 Feb 2014 Posts: 2
|
|
Posted: Thu Feb 06, 2014 5:22 am |
|
|
thanks for your answer.
but, what mean? In the datasheet(Table 3-7) below.
TABLE 3-7 : OSCILLATOR CONFIGURATION OPTIONS FOR USB OPERATION
Inpt Oscillator Frequency : 16MHz
Clock Mode(FOSC<3:0>) : EC, HS or INTOSC with 3xPLL
MCU Clock Division(CPUDIV<1:0>) : None(11)
Microcontroller Clock Frequency : 48MHz
Please give me some help |
|
|
|