Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Thu Jun 23, 2016 12:16 pm |
|
|
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).... |
|