Re: [Sdcc-user] Getting started with C8051F120 problem

2016-12-30 Thread Philipp Klaus Krause
On 29.12.2016 23:16, Maarten Brock wrote:
> 
> These values get you a 453 baudrate:
> 24.5MHz / 8 / (256-45) / 32 = 453
> 
> 300 baud is really low and impossible to achieve with T1 in 8-bit
> autoreload. Most USB-UARTs even have this as their lower level limit.



The 43 in the posted example was wrong. But the timer uses a prescaled
sysclk giving another division by 12, thus I can do:

24.5 * 100 / 8 / 12 / (256-229) / 32 = 295.38

when running at 3.0625 Mhz and

24.5 * 100 / 12 / (256-43) / 32 = 299.54

when running at 24.5 Mhz. The former didn't work for me (it is off from
300 by 1.54%), but the latter did (off from 300 by 0.15%).

Philipp


--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user


Re: [Sdcc-user] Getting started with C8051F120 problem

2016-12-30 Thread Maarten Brock
> On 29.12.2016 23:16, Maarten Brock wrote:
>>
>> These values get you a 453 baudrate:
>> 24.5MHz / 8 / (256-45) / 32 = 453
>>
>> 300 baud is really low and impossible to achieve with T1 in 8-bit
>> autoreload. Most USB-UARTs even have this as their lower level limit.
>
>
>
> The 43 in the posted example was wrong. But the timer uses a prescaled
> sysclk giving another division by 12,

You're right. I forgot about CKCON and its default.

> thus I can do:
>
> 24.5 * 100 / 8 / 12 / (256-229) / 32 = 295.38
>
> when running at 3.0625 Mhz and
>
> 24.5 * 100 / 12 / (256-43) / 32 = 299.54
>
> when running at 24.5 Mhz. The former didn't work for me (it is off from
> 300 by 1.54%), but the latter did (off from 300 by 0.15%).
>
> Philipp

In general for a UART 1.5% should be good enough. Anything below 2.5%
should work. But you must take the tolerance on the internal oscillator
into account as well. And then you get 1.5% + 2% = 3.5% which might fail.
It also depends on the accuracy of the other side.

Maarten

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user