View previous topic :: View next topic |
Author |
Message |
paulcamantigue
Joined: 10 May 2013 Posts: 1
|
PIC18F Software UART Max Baudrate |
Posted: Fri May 10, 2013 10:37 am |
|
|
Hello all.
I currently have firmware in the PIC18F2580 utilizing a software UART with a baud of 10400 using the internal oscillator at 8 MHz.
Is there any sort of calculation or would any of you know if I'm able to bump the baud rate of the software UART to 125000 using the internal clock at 8 MHz? Would I have to bump it up to 16? Or does simply changing these values require me to also change some of the software?
This is what I have for settings:
Code: |
#use delay(clock = 8000000, restart_wdt) // 8 Mhz
// Oscillator Configuration Pin (PLL Enable Pin)
#byte OSCTUNE = 0xF9B
#bit PLLEN = OSCTUNE.6
#use rs232(baud = 10400, xmit = PIN_C2, rcv = PIN_C1, stream = SOFTWARE_STREAM) // software UART
|
I know that the max baud of the hardware UART is 115200 but I'm wondering if the software UART at 8MHz or 16MHz can be bumped even higher. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri May 10, 2013 10:49 am |
|
|
Quote: |
would any of you know if I'm able to bump the baud rate of the software
UART to 125000 using the internal clock at 8 MHz?
|
The compiler will give an error message if it can't do it. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Fri May 10, 2013 11:52 am |
|
|
PCM P is right again...
but..
if using the internal Oscillator, be careful about 'stability issues'. while you might get the speed it might not be accurate or stable to waht's on the other end.Serial communications should be <3% so really stick a crystal in ! Small changes in temperature can easily shift the internal clock 'out of spec'.
Spending an extra 50 cents now is worth it compared to the head banging and saying 'I should have' ,couple months from now, when you're tracking down a 'sometimes-it-doesn't work' problem....
hth
jay |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat May 11, 2013 10:24 am |
|
|
as a "rule of thumb" i have found the maximum safe baud to use
(errors from chip 2 chip variation && over the temperature range)
with an internal pic oscillator is Fosc/64
for an 8mhz clock , Fosc=2mhz
then max safe baud is 38400 or less
my experience and 2 cents worth |
|
|
Tom Jetland
Joined: 23 Jun 2011 Posts: 31 Location: UK
|
|
Posted: Thu May 23, 2013 8:00 am |
|
|
For interest only, I've successfully long term tested up to 3mbps (3 megabaud), between two 18f4620 pics using their internal UARTs over 250metres of cable (using a proprietary driver system).
External 10MHz crystal using 4xPLL.
Tom
EDIT: OK, just actually read your subject and realised you're using a software based handler, ignore my post... I need new glasses
I guess your hardware pins are already being used? That's the reason I went to the 46k22 pics, 2 hardware UARTs - yay!!! |
|
|
|