+ Post New Thread
Results 1 to 20 of 21

21st January 2020, 13:32 #1
 Join Date
 Nov 2018
 Posts
 138
 Helped
 1 / 1
 Points
 903
 Level
 6
Microcontroller selection  higher baud rate
Hi,
I am looking for Microcontroller by Microchip that support higher baud rate like 115 k or higher with internal oscillator. Any suggestion ?

Advertisement

21st January 2020, 15:33 #2
 Join Date
 Jan 2008
 Location
 Bochum, Germany
 Posts
 46,151
 Helped
 14034 / 14034
 Points
 264,115
 Level
 100
Re: Microcontroller selection  higher baud rate
You might look for newer 18FxxKyy series that can achieve 64 MHz clock with internal oscillator and PLL. They support 115k or even higher baud rates. Please consider that internal oscillator has limited accuracy and temperature drift, it can be also detuned by applying mechanical force to the PCB.

21st January 2020, 21:49 #3
Awards:
 Join Date
 Apr 2014
 Posts
 16,429
 Helped
 3730 / 3730
 Points
 80,992
 Level
 69
Re: Microcontroller selection  higher baud rate
Hi,
I assume every PIC and AVR microcontroller can go higher than 115200 baud.
Just review the datasheets.
For sure it depends on the microcontroller's system clock frequency.
KlausPlease don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.

21st January 2020, 22:58 #4
 Join Date
 Jan 2015
 Posts
 1,123
 Helped
 350 / 350
 Points
 8,020
 Level
 21
Re: Microcontroller selection  higher baud rate
https://www.microchip.com/paramchart...?branchID=1005
Select the options that are important to you and then select the MCU that you want.
As a general rule, the clock used for UARTs need to be within ~2% to be reliable (also assuming a 16x sampling). Check very carefully that the internal clock is rated to that level of accuracy/stability.
Certainly the older MCUs should NOT be used without an external oscillator but some of the newer ones have better internal clock designs that might fit your purpose.
Susan

22nd January 2020, 09:46 #5
 Join Date
 Nov 2018
 Posts
 138
 Helped
 1 / 1
 Points
 903
 Level
 6
Re: Microcontroller selection  higher baud rate
I was checking once PIC18F2550 which I guess does not support 115k Baud rate with internal oscillator.

22nd January 2020, 22:56 #6
 Join Date
 Jan 2015
 Posts
 1,123
 Helped
 350 / 350
 Points
 8,020
 Level
 21
Re: Microcontroller selection  higher baud rate
Personally I would not use the internal oscillator for the UART (regardless of BAUD rate) with that (relatively) old chip. Depending on the temperature range and voltage, you can get +/ 10% between the max and min frequencies. Even at ideal temperature and voltage, the data sheet says between +/2% and typical of +/1%.
While that looks like it is within the +/2% I mentioned above, don't forget that the accuracy applies to BOTH ends of the communication line. If the device you are communicating with is absolutely accurate all the time then you need only consider the accuracy of your device. But any variation in the other device must be added to the variation in your  the PIC18F2550 can range over the full tolerance range itself so it can be quite easy for errors to be introduced.
Why not just add a crystal (and a couple of capacitors) and know that it will work?
Susan

23rd January 2020, 09:50 #7
 Join Date
 Nov 2018
 Posts
 138
 Helped
 1 / 1
 Points
 903
 Level
 6
Re: Microcontroller selection  higher baud rate
Hi Susan,
Thanks for your comment. I am also thinking to use external crystal to have more stable UART. I have 16 MHz and 20 MHz in stock. Any 18F PIC with 16 MHz or 20 MHz crystal recommended for 115k Baud or higher ?

23rd January 2020, 21:29 #8
Awards:
 Join Date
 Apr 2014
 Posts
 16,429
 Helped
 3730 / 3730
 Points
 80,992
 Level
 69
Re: Microcontroller selection  higher baud rate
Hi,
If you use (non UART standard) XTALs, then it's almost independent of microcontroller (as long as they don't include a PLL).
Because the usual way to generate baude rate is to integer divide the XTAL clock frequency.
Thus the frequency error is the same with all the microcontrollers.
KlausPlease don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.

Advertisement

23rd January 2020, 22:30 #9
 Join Date
 Jan 2015
 Posts
 1,123
 Helped
 350 / 350
 Points
 8,020
 Level
 21
Re: Microcontroller selection  higher baud rate
See the link in my reply #4, select the PIC18 MCUs under the '8 bit Microcontrollers' item on the left and make your choice  probably based on whatever else you want the MCU to do.
If you want to use a crystal then pick any.
If you want to use an internal oscillator, then I'd go for any of the ones with a K (or possibly a Q) in the part number and certainly ones with the OSCTUNE (or equivalently named) register as that will be the best (and recommended by Microchip) way to tune the oscillator to be within the required accuracy.
Susan

Advertisement

25th January 2020, 07:34 #10
 Join Date
 Nov 2018
 Posts
 138
 Helped
 1 / 1
 Points
 903
 Level
 6
Re: Microcontroller selection  higher baud rate
I guess with in Microcontroller with PLL it is possible to multiply the frequency by factor like 2 and 4 etc. and in Microcontroller XTAL connected externally we can divide the frequency by integer for BUAD, right ?

25th January 2020, 08:48 #11
Awards:
 Join Date
 Apr 2014
 Posts
 16,429
 Helped
 3730 / 3730
 Points
 80,992
 Level
 69
Re: Microcontroller selection  higher baud rate
Hi,
There are XTAL frequencies for UART operation, like 3.6864MHz or 7.3728MHz
You can't generate them by PLL "multiply with 2 or 4" from a 8MHz XTAL frequency.
The mathematical solution is:
The standard baud rates are:
* 9600 = 2 × 2 × 2 × 2 × 2 × 2 × 2 × 3 × 5 × 5 (divided by prime numbers)
* 19200 = 2 × 9600 = 2 × ( 2 × 2 × 2 × 2 × 2 × 2 × 2 × 3 × 5 × 5 )
...
* 115200 = 12 × 9600 = 2 × 2 × 3 × ( 2 × 2 × 2 × 2 × 2 × 2 × 2 × 3 × 5 × 5 )
If you want to use a 8MHz XTAL on 115200baud:
* 8M = 8.000.000 = 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 5 × 5 × 5 × 5 × 5 × 5
Equal prime numbers for both frequencues are:
2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 5 × 5
Divide the frequency be the equal numbers:
* 115200 / (2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 5 × 5 ) = 3 × 3
* 8M / (2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 5 × 5 ) = 5 × 5 × 5 × 5
The problem now is the missing "3 × 3" that the 8M does not include, but the 115200 does.
So the PLL solution is to multiply the XTAL frequency by the missing (3 × 3 ) = 9
Then you are able to generate all baud rates perfectly.
Link for prime factorisation: https://www.calculatorsoup.com/calcu...mefactors.php
KlausPlease don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.

25th January 2020, 09:55 #12
Awards:
 Join Date
 Jul 2009
 Location
 Aberdyfi, West Wales, UK
 Posts
 13,647
 Helped
 4535 / 4535
 Points
 83,020
 Level
 70
Re: Microcontroller selection  higher baud rate
Another point worth mentioning is the PIC range have Baud rate generators that can hold any 8 or in some cases 16 bit number. They are not confined to the industry standard rates from common clock frequencies. Although for 115,200 bauds the divisor (BRG value) will be low, you can set it to any value and use an appropriate clock frequency to produce almost any baud rate you want.
Brian.PLEASE  no friends requests or private emails, I simply don't have time to reply to them all.
It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.

30th January 2020, 09:45 #13
 Join Date
 Nov 2018
 Posts
 138
 Helped
 1 / 1
 Points
 903
 Level
 6
Re: Microcontroller selection  higher baud rate
I am sorry I don't get the calculations. Kindly explain it with an other example. I have 16 MHz and 20 MHz XTAL crystals. I need to find and buy 18F PIC Microcontroller which can work for 115 K and higher baud rates.

30th January 2020, 16:16 #14
Awards:
 Join Date
 Jul 2009
 Location
 Aberdyfi, West Wales, UK
 Posts
 13,647
 Helped
 4535 / 4535
 Points
 83,020
 Level
 70
Re: Microcontroller selection  higher baud rate
The baud rate is set by dividing the clock (your XTAL) by either 4 or 16 then by dividing again by the number in the baud rate divider register. It is a simple frequency divider.
You haven't said what baud rate you want, both ends of your serial link must use the same speed but that speed can be as fast or slow as the PIC will allow. Tell us what you mean by 'higher baud rate' , is is 115,201 bauds or something much faster? The formula for calculating the speed, based on the clock and divisor ratios is in every PIC data sheet. You are not constrained to using the values in the example tables in the data sheet, each different value in the divider register will produce a different baud rate.
Brian.PLEASE  no friends requests or private emails, I simply don't have time to reply to them all.
It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.

30th January 2020, 21:30 #15
Awards:
 Join Date
 Apr 2014
 Posts
 16,429
 Helped
 3730 / 3730
 Points
 80,992
 Level
 69
Re: Microcontroller selection  higher baud rate
Hi.
I am sorry I don't get the calculations. Kindly explain it with an other example. I have 16 MHz and 20 MHz XTAL crystals. I need to find and buy 18F PIC Microcontroller which can work for 115 K and higher baud rates.
Neither 16MHz is, nor 20MHz is. > impossible
KlausPlease don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.

30th January 2020, 23:00 #16
 Join Date
 Jan 2015
 Posts
 1,123
 Helped
 350 / 350
 Points
 8,020
 Level
 21
Re: Microcontroller selection  higher baud rate
@KlausST  the '...integer multiple of 9' part is true but not necessarily relevant depending on the actual device the OP chooses.
As @betwixt points out, most (if not all) of the PIC18F series of MCUs have a 'Baud Rate Generator' that is a dividebyN that is 8 or 16 bits wide. Therefore divide by 9, or any other number between 1 and 255 (or 65535)  especially multiples of 9  is entirely possible.
Given a 20MHz crystal (which is Fosc), a Baud rate of 115,200 and using the 16bit divider and the BRGH bit set, then the required division number is Fosc/(4 * 115200)1 = 20,000,000/460800  1 = 42.4 which is rounded down to 42. When you then use that to calculate the actual Baud rate, you get Fosc/(4*(n+1)) = 20,000,000/(4 * 43) = 116,279.07 which is .94% high which is within the normal tolerances for a UART. (I used the PIC18F4550 for this example but the formulae are almost identical for all of the PIC18F series.)
@joniengr  you keep saying '115,200 or higher' but this is probably the wrong way to go about your design. The questions you should be asking are: 1) how much data do I have to transfer and how fast  that will tell you the minimum Baud rate; then 2) what is the maximum Baud rate that the other device can handle  that will tell you the maximum Baud rate of the transfer. So long as the maximum is more than the minimum Baud rate then you can select whatever rate you need. It is usual to select one of the standard Baud rates but if both devices can handle nonstandard rates then you can use whatever you want.
Of course there are all sorts of other considerations in a design such as how fast the devices at each end can generate/process the information begin transferred but we don't have any information on that so that part is up to you.
I must admit, you seem to be struggling with this and that makes me think that you need to stop and learn a bit more about microcontrollers before you go any further. This is all very basic stuff and once you understand it, then you can progress on.
Susan

31st January 2020, 10:27 #17
 Join Date
 Nov 2018
 Posts
 138
 Helped
 1 / 1
 Points
 903
 Level
 6
Re: Microcontroller selection  higher baud rate
@Aussie  256000 bits per second Baud rate is actually required.

31st January 2020, 16:41 #18
Awards:
 Join Date
 Jul 2009
 Location
 Aberdyfi, West Wales, UK
 Posts
 13,647
 Helped
 4535 / 4535
 Points
 83,020
 Level
 70
Re: Microcontroller selection  higher baud rate
The best you can manage with a PIC18F is to set BRGH =1, SPBRG = 20 and use a clock of 21.5MHz, that gives a baud rate of 255,952, an error of 0.02%.
With a 20MHz clock, your limit is 250K bauds.
Brian.PLEASE  no friends requests or private emails, I simply don't have time to reply to them all.
It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.

2nd February 2020, 13:24 #19
 Join Date
 Nov 2018
 Posts
 138
 Helped
 1 / 1
 Points
 903
 Level
 6
Re: Microcontroller selection  higher baud rate
I guess the formula for calculating the baud rates are below.
SPBRG = (Fosc / (16 x Baud rate))  1, BRGH = 1 High Speed
SPBRG = (Fosc / (64 x Baud rate))  1, BRGH = 0 Low Speed
With BRGH = 1 which is high speed, and Fosc = 12 MHz, I get 115384 which is 2% error compared to 115200. This gives value 25 for SPBRG register.
Question is it possible to get Fosc = 12 MHz from XTAL 16 MHz or 20 MHz ?

Advertisement

2nd February 2020, 14:45 #20
Awards:
 Join Date
 Jul 2009
 Location
 Aberdyfi, West Wales, UK
 Posts
 13,647
 Helped
 4535 / 4535
 Points
 83,020
 Level
 70
Re: Microcontroller selection  higher baud rate
I guess the formula for calculating the baud rates are below.
SPBRG = (Fosc / (16 x Baud rate))  1, BRGH = 1 High Speed
SPBRG = (Fosc / (64 x Baud rate))  1, BRGH = 0 Low Speed
Question is it possible to get Fosc = 12 MHz from XTAL 16 MHz or 20 MHz ?
Brian.PLEASE  no friends requests or private emails, I simply don't have time to reply to them all.
It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.
+ Post New Thread
Please login