Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Help me with calculating PIC USB system clock speed

Status
Not open for further replies.

urakhai911

Newbie level 6
Joined
Apr 15, 2010
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,413
Hey World,

I am working on a project in which I am using USB and CAN together. I am sending data to the PIC32MX795F512L on the Ethernet Starter Kit from the PC and sending data out through the CAN Bus.

I can get both modules to work individually but when placing the two together in the same program I face certain problems. I narrowed down the problem to the oscillator configuration. When the two programs are combined and I work with the Primary Oscillator (8 Mhz) with PLL the USB works and the CAN doesn't. When I use the internal FRC oscillator the CAN module works and the usb doesn't.

What I have decided to do is work with the Primary Oscillator with PLL and modify my CAN configuration to work with that system clock speed.

I need help with calculating my system clock speed. Here are the relevant configuration bits.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma config UPLLEN   = ON            // USB PLL Enabled
    #pragma config FPLLMUL  = MUL_20        // PLL Multiplier
    #pragma config UPLLIDIV = DIV_2         // USB PLL Input Divider
    #pragma config FPLLIDIV = DIV_2         // PLL Input Divider
    #pragma config FPLLODIV = DIV_1         // PLL Output Divider
    #pragma config FPBDIV   = DIV_1         // Peripheral Clock divisor
    #pragma config FWDTEN   = OFF           // Watchdog Timer 
    #pragma config WDTPS    = PS1           // Watchdog Timer Postscale
    #pragma config FCKSM    = CSDCMD        // Clock Switching & Fail Safe Clock Monitor
    #pragma config OSCIOFNC = OFF           // CLKO Enable
    #pragma config POSCMOD  = HS            // Primary Oscillator
    #pragma config IESO     = OFF           // Internal/External Switch-over
    #pragma config FSOSCEN  = OFF           // Secondary Oscillator Enable
    #pragma config FNOSC    = PRIPLL        // Oscillator Selection



I have attached an image of the oscillator configuration for the PIC32MX.

Thanks!

Please tell me if I didn't explain the question properly.
 

Attachments


phobos1

Full Member level 2
Joined
Jan 18, 2010
Messages
135
Helped
15
Reputation
30
Reaction score
15
Trophy points
1,298
Location
Salem, Tamil Nadu, India
Activity points
2,112
hi i am having the same trouble u faced with pic32 ethernet starter kit. please let me know if u have got an answer to set the usb clock
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top