CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

18F25K50 internal oscillator configuration for USB problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
imabme



Joined: 06 Feb 2014
Posts: 2

View user's profile Send private message

18F25K50 internal oscillator configuration for USB problem
PostPosted: Thu Feb 06, 2014 2:05 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Feb 06, 2014 2:26 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Feb 06, 2014 5:22 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group