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 support@ccsinfo.com

dsPIC30F5015 Baud rate out of range

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



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

dsPIC30F5015 Baud rate out of range
PostPosted: Tue Jun 21, 2016 12:01 pm     Reply with quote

Greetings! I'm configuring dsPIC30F5015's UART module. I'm using 12MHz quartz and HS2_PLL8 (48MHz clock) setting. The problem is when I try to set the UART baud rate to 115200 I'm receiving an error: Baud rate out of range.
The datasheet of dsPIC30F5015 says there is no min value for UxBRG so I can't see where is the problem.
If I choose HS2_PLL16 (96MHz clock) everything is fine, but the controller temperature is increasing rapidly. So I want to work on 48MHz.
Why the compiler doesn't allow me to use 115200? I've used it with smaller controllers from PIC18s series.
Thanks!
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

PostPosted: Tue Jun 21, 2016 12:19 pm     Reply with quote

With that clock rate the compiler can't come up with a BRG setting that hits your desired speed within the ~2% max error (or thereabouts).
Ttelmah



Joined: 11 Mar 2010
Posts: 19339

View user's profile Send private message

PostPosted: Thu Jun 23, 2016 12:16 pm     Reply with quote

The key problem is how slow the clock is, relative to the baud rate required.

48MHz oscillator, implies 12MHz instruction clock.

The BRG, runs off the instruction clock/16.

So the master oscillator being used to feed the UART, is 750000Hz.

Your 115200bps, would need a divider of 6.5104. The two possible 'nearest' dividers (6, and 7), give 125000bps, and 107142bps. 8.5% & 7.5% in error respectively. The compiler 'knows' that errors this large, won't work....

The BRG on these PIC's, is designed on the assumption you will be running off a fast clock, hence the built in /16. The PIC18's don't have this.

One choice is to run off an oscillator frequency that is a easier multiple of your required baud. So (for instance), running off 44.2368MHz.

11MHz crystal, and 44MHz master oscillator, gives /6 division giving 114583baud, less than 0.5% error.

I've edited the post, to add, that you should be checking to see if there is some other reason for the chip running this hot. The chips do use significant power, but certainly at 80 to 100MHz, don't run that hot. So I'd be making absolutely sure the heating isn't being caused by perhaps a high capacitance loading on a line (or something silly like a short)....
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