dsPIC33EP512GM710 UART Configuration

Status
Not open for further replies.

vijaya_narayana

Full Member level 3
Joined
Jun 12, 2007
Messages
178
Helped
11
Reputation
22
Reaction score
1
Trophy points
1,298
Location
India
Activity points
2,182
Dear All

I am Trying to configure UART MODULE for 9600 Baud rate in dsPIC33EP512GM710 and here is my Code i am just trying to send a char to be monitored in serial port in the PC

my code for calculating the baud rate


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#define _XTAL_FREQ 10000000
#define FP 40000000
#define BAUDRATE 9600
#define BRGVAL ((FP/BAUDRATE)/16)-1
 
////clock settings
 
PLLFBD = 30;                                // M=32
    CLKDIVbits.PLLPOST = 0;                     // N1=2
    CLKDIVbits.PLLPRE = 0;                      // N2=2
    OSCTUN = 0;                                 // Tune FRC oscillator, if FRC is used
// Initiate Clock Switch to Primary Oscillator with PLL (NOSC=0b011)
__builtin_write_OSCCONH(0x03);
__builtin_write_OSCCONL(OSCCON | 0x01);
// Wait for Clock switch to occur
while (OSCCONbits.COSC!= 0b011);
// Wait for PLL to lock
while (OSCCONbits.LOCK!= 1);



my code for configuring the PLL and clock i am trying to calculate the same for 40Mhz operation with an external crystal of 10 Mhz


pls correct me if my setting are wrong
 
Last edited by a moderator:

You have only shown us the oscillator configuration code and none of the UART initialisation.
You have also told us nothing about what is going wrong - what is not working but you expect it should?
By the way, given a 10MHz crystal, you will get an Fosc of 80MHz, not 40MHz as you say. Your WILL get 40MIPS but that is not the same thing. However, you are actually saved by the fact that the UART uses Fosc/2 which will be 40MHz for this particular chip.
Susan
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…