Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

GNU tools example - any demand

GNU tools example - any demand

2006-03-02 by brendanmurphy37

There's been a few occasions (including one current one) of people 
looking for examples of the files you need to get a basic program up 
and running using the GNU tools.

My question is whether there would be any interest in having such an 
example placed in the Files section of the group? I'd be willing to 
put a core together and make it publically available, to include:

- startup.s file with proper handling of vectors 
- interrupt dispatch, supporting nested interrupts
- link file
- make file

Documentation by extensive comments.

Nothing too complex: it would be be done for one particular varient, 
but would probably work for all.

People could add to it if they want.

If this has already been done, maybe someone could point this out, 
and provide a link to it.

Let me know what you think.

Brendan

UART baudrate

2006-03-02 by Iván Cayón

Hi !!
I'm trying to send data with the UART at 115200 bps with a Xtal of 10 Mhz and 
the PC doesn't receive the data correctly. Is the baud rate limited with this 
equation?

ratemax = PCLK / (16 x (2 + databits + paritybits + stopbits)

if this is correct then I can't get this baudrate with 10 Mhz xtal

Regards, 

Ivan

Re: [lpc2000] GNU tools example - any demand

2006-03-02 by Thiago Takehara

Yes, it´s a very good idea. I'll try to translate my source codes so they can be used for this goal.

I think a great project that we could handle all toghether is to make something like "Code Architect" for LPC2000 family. I have a little experience with javascript, but not a lot of time...

Regards,

Thiago Takehara
Computer Engineer
Engworks Industrial LTDA - R&D Division
Show quoted textHide quoted text
----- Original Message ----- 
  From: brendanmurphy37 
  To: lpc2000@yahoogroups.com 
  Sent: Thursday, March 02, 2006 11:45 AM
  Subject: [lpc2000] GNU tools example - any demand



  There's been a few occasions (including one current one) of people 
  looking for examples of the files you need to get a basic program up 
  and running using the GNU tools.

  My question is whether there would be any interest in having such an 
  example placed in the Files section of the group? I'd be willing to 
  put a core together and make it publically available, to include:

  - startup.s file with proper handling of vectors 
  - interrupt dispatch, supporting nested interrupts
  - link file
  - make file

  Documentation by extensive comments.

  Nothing too complex: it would be be done for one particular varient, 
  but would probably work for all.

  People could add to it if they want.

  If this has already been done, maybe someone could point this out, 
  and provide a link to it.

  Let me know what you think.

  Brendan






  SPONSORED LINKS Microcontrollers  Microprocessor  Intel microprocessors  
        Pic microcontrollers  


------------------------------------------------------------------------------
  YAHOO! GROUPS LINKS 

    a..  Visit your group "lpc2000" on the web.
      
    b..  To unsubscribe from this group, send an email to:
     lpc2000-unsubscribe@yahoogroups.com
      
    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


------------------------------------------------------------------------------



[Non-text portions of this message have been removed]

Re: [lpc2000] UART baudrate

2006-03-02 by Tom Walsh

Iv\ufffdn Cay\ufffdn wrote:

>Hi !!
>I'm trying to send data with the UART at 115200 bps with a Xtal of 10 Mhz and 
>the PC doesn't receive the data correctly. Is the baud rate limited with this 
>equation?
>
>ratemax = PCLK / (16 x (2 + databits + paritybits + stopbits)
>
>  
>
Crystal: 10000000
PLL MULT: 4
Periph Bus Div: 2
divisor: 4167  desired: 300  actual: 299.976  error: -0.008%
divisor: 2083  desired: 600  actual: 600.096  error: 0.016%
divisor: 1042  desired: 1200  actual: 1199.616  error: -0.032%
divisor: 521  desired: 2400  actual: 2399.232  error: -0.032%
divisor: 260  desired: 4800  actual: 4807.692  error: 0.1602%
divisor: 130  desired: 9600  actual: 9615.384  error: 0.1602%
divisor: 65  desired: 19200  actual: 19230.769  error: 0.1602%
divisor: 33  desired: 38400  actual: 37878.787  error: -1.3573%
divisor: 22  desired: 57600  actual: 56818.181  error: -1.3573%
divisor: 11  desired: 115200  actual: 113636.363  error: -1.3573%
divisor: 5  desired: 230400  actual: 250000  error: 8.5069%


>if this is correct then I can't get this baudrate with 10 Mhz xtal
>
>Regards, 
>
>Ivan
>
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>
>  
>


-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Re: [lpc2000] GNU tools example - any demand

2006-03-02 by Robert Adsett

Quoting brendanmurphy37 <brendan.murphy@...>:

>
> There's been a few occasions (including one current one) of people
> looking for examples of the files you need to get a basic program up
> and running using the GNU tools.
>
> My question is whether there would be any interest in having such an
> example placed in the Files section of the group? I'd be willing to
> put a core together and make it publically available, to include:
>
> - startup.s file with proper handling of vectors
> - interrupt dispatch, supporting nested interrupts
> - link file
> - make file
>
> Documentation by extensive comments.
>
> Nothing too complex: it would be be done for one particular varient,
> but would probably work for all.

I've got some of this.  It could use nested interrupt upgrade (non-nested is
there already) and perhaps a more complete makefile.

It's part of the newlib support routines
http://www.aeolusdevelopment.com/Articles/download.html but I don't think any
of the basics depends on newlib.  Also includes some basic set up
routines like
PLL, MAM, VPB and VIC initialization and a wait function.

Documentation is a work in precess as always but it is there and it's
reasonably
commented.

Robert

Re: UART baudrate

2006-03-02 by icapapindi

Can I do it with PLL_MULT=1? I use the Xtal frecuency without PLL, I'm
using these values:

PCLK = 10 Mhz
Divisor = 4
MULVAL = 14
DIVAddVal = 5

With these values It is suppose to get 115.131 bps, but when I test
with the oscilloscope the frecuency is about 128 Kbps. The code I used is:
---------------------------------------------------
unsigned int divisor=5;
UART1_LCR = 0x83; /* 8 bit, 1 stop bit, no parity, enable DLAB */
UART1_FDR=(UART1_FDR & 0xFFFFFF00) | 0xE5;
UART1_DLL = divisor & 0xFF;
UART1_DLM = (divisor >> 8) & 0xFF;
UART1_LCR &= ~0x80; /* Disable DLAB */
PCB_PINSEL0 = PCB_PINSEL0 & ~0x0F0000 | 0x050000;
UART1_FCR = 1;
----------------------------------------------------

Thanks

--- In lpc2000@yahoogroups.com, Tom Walsh <tom@...> wrote:
>
> Iván Cayón wrote:
> 
> >Hi !!
> >I'm trying to send data with the UART at 115200 bps with a Xtal of
10 Mhz and 
> >the PC doesn't receive the data correctly. Is the baud rate limited
with this 
Show quoted textHide quoted text
> >equation?
> >
> >ratemax = PCLK / (16 x (2 + databits + paritybits + stopbits)
> >
> >  
> >
> Crystal: 10000000
> PLL MULT: 4
> Periph Bus Div: 2
> divisor: 4167  desired: 300  actual: 299.976  error: -0.008%
> divisor: 2083  desired: 600  actual: 600.096  error: 0.016%
> divisor: 1042  desired: 1200  actual: 1199.616  error: -0.032%
> divisor: 521  desired: 2400  actual: 2399.232  error: -0.032%
> divisor: 260  desired: 4800  actual: 4807.692  error: 0.1602%
> divisor: 130  desired: 9600  actual: 9615.384  error: 0.1602%
> divisor: 65  desired: 19200  actual: 19230.769  error: 0.1602%
> divisor: 33  desired: 38400  actual: 37878.787  error: -1.3573%
> divisor: 22  desired: 57600  actual: 56818.181  error: -1.3573%
> divisor: 11  desired: 115200  actual: 113636.363  error: -1.3573%
> divisor: 5  desired: 230400  actual: 250000  error: 8.5069%
> 
> 
> >if this is correct then I can't get this baudrate with 10 Mhz xtal
> >
> >Regards, 
> >
> >Ivan
> >
> >
> > 
> >Yahoo! Groups Links
> >
> >
> >
> > 
> >
> >
> >
> >
> >
> >  
> >
> 
> 
> -- 
> Tom Walsh - WN3L - Embedded Systems Consultant
> http://openhardware.net, http://cyberiansoftware.com
> "Windows? No thanks, I have work to do..."
> ----------------------------------------------------
>

Re: [lpc2000] GNU tools example - any demand

2006-03-02 by Tong Le

it is a great idea.
  thanks
  

Thiago Takehara <thiago@...> wrote:
  Yes, it´s a very good idea. I'll try to translate my source codes so they can be used for this goal.

I think a great project that we could handle all toghether is to make something like "Code Architect" for LPC2000 family. I have a little experience with javascript, but not a lot of time...

Regards,

Thiago Takehara
Computer Engineer
Engworks Industrial LTDA - R&D Division
Show quoted textHide quoted text
----- Original Message ----- 
  From: brendanmurphy37 
  To: lpc2000@yahoogroups.com 
  Sent: Thursday, March 02, 2006 11:45 AM
  Subject: [lpc2000] GNU tools example - any demand



  There's been a few occasions (including one current one) of people 
  looking for examples of the files you need to get a basic program up 
  and running using the GNU tools.

  My question is whether there would be any interest in having such an 
  example placed in the Files section of the group? I'd be willing to 
  put a core together and make it publically available, to include:

  - startup.s file with proper handling of vectors 
  - interrupt dispatch, supporting nested interrupts
  - link file
  - make file

  Documentation by extensive comments.

  Nothing too complex: it would be be done for one particular varient, 
  but would probably work for all.

  People could add to it if they want.

  If this has already been done, maybe someone could point this out, 
  and provide a link to it.

  Let me know what you think.

  Brendan






  SPONSORED LINKS Microcontrollers  Microprocessor  Intel microprocessors  
        Pic microcontrollers  


------------------------------------------------------------------------------
  YAHOO! GROUPS LINKS 

    a..  Visit your group "lpc2000" on the web.
      
    b..  To unsubscribe from this group, send an email to:
     lpc2000-unsubscribe@yahoogroups.com
      
    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


------------------------------------------------------------------------------



[Non-text portions of this message have been removed]



  SPONSORED LINKS 
        Microcontrollers   Microprocessor   Intel microprocessors     Pic microcontrollers 
    
---------------------------------
  YAHOO! GROUPS LINKS 

    
    Visit your group "lpc2000" on the web.
    
    To unsubscribe from this group, send an email to:
 lpc2000-unsubscribe@yahoogroups.com
    
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

    
---------------------------------
  



		
---------------------------------
Yahoo! Mail
Bring photos to life! New PhotoMail  makes sharing a breeze. 

[Non-text portions of this message have been removed]

Re: [lpc2000] UART baudrate

2006-03-02 by Xtian Xultz

Em Qui 02 Mar 2006 12:04, Iván Cayón escreveu:
> Hi !!
> I'm trying to send data with the UART at 115200 bps with a Xtal of 10 Mhz
> and the PC doesn't receive the data correctly. Is the baud rate limited
> with this equation?
>
> ratemax = PCLK / (16 x (2 + databits + paritybits + stopbits)
>
> if this is correct then I can't get this baudrate with 10 Mhz xtal
>
> Regards,
>
> Ivan

Are you using PLL?
I am using right now an LPC2106 with 10MHz crystal.
To calculate the baudrate, you must first pick you pclk. For example, I am 
using 50MHz (pll * 5) and pclk = 1 (the pclk is the same as the core clock).
So, if I have a 50MHz, first divide it by 16. I get: 3,125,000 and at that 
frequency thats the clock that UART uses.
So, to calculate the dividers, divide that clock by the desired baudrate, 
which at 115,200 gives me: 27,1267 
Note that I have 0,1267 as decimal error on my divider, because the divider 
accpets only integer numbers. If I made the other side calculation, dividing 
3,125,000 by 27, I get 115741 bps which is the speed my LPC will talk.
If, for example, I make the pll running at 60MHz, my divider is 32,5521
Note how big is my decimal error, is practicaly the worst case, where the 
error resides in the middle betweem 0 and 1. If I use the divider as 33, my 
UART speed is 113636 bps. Very bad, huh?

So, to use 10MHz crystal, check this before. The lesser the decimal error, the 
best your serial communication will be. For example, with the pclk at 10MHz, 
the UART speed will be 125000bps. Try to calculate it.

Re: UART baudrate

2006-03-02 by icapapindi

Very good example !!

I think that I did calculations correct, the problem is that I use 10
Mhz as core clock with pll=1 and maybe this clock is not big enought
to get 115200 baudrate, isn't it?

Thanks !!


--- In lpc2000@yahoogroups.com, Xtian Xultz <xultz@...> wrote:
>
> Em Qui 02 Mar 2006 12:04, Iván Cayón escreveu:
> > Hi !!
> > I'm trying to send data with the UART at 115200 bps with a Xtal of
10 Mhz
> > and the PC doesn't receive the data correctly. Is the baud rate
limited
> > with this equation?
> >
> > ratemax = PCLK / (16 x (2 + databits + paritybits + stopbits)
> >
> > if this is correct then I can't get this baudrate with 10 Mhz xtal
> >
> > Regards,
> >
> > Ivan
> 
> Are you using PLL?
> I am using right now an LPC2106 with 10MHz crystal.
> To calculate the baudrate, you must first pick you pclk. For
example, I am 
> using 50MHz (pll * 5) and pclk = 1 (the pclk is the same as the core
clock).
> So, if I have a 50MHz, first divide it by 16. I get: 3,125,000 and
at that 
> frequency thats the clock that UART uses.
> So, to calculate the dividers, divide that clock by the desired
baudrate, 
> which at 115,200 gives me: 27,1267 
> Note that I have 0,1267 as decimal error on my divider, because the
divider 
> accpets only integer numbers. If I made the other side calculation,
dividing 
> 3,125,000 by 27, I get 115741 bps which is the speed my LPC will talk.
> If, for example, I make the pll running at 60MHz, my divider is 32,5521
> Note how big is my decimal error, is practicaly the worst case,
where the 
> error resides in the middle betweem 0 and 1. If I use the divider as
33, my 
> UART speed is 113636 bps. Very bad, huh?
> 
> So, to use 10MHz crystal, check this before. The lesser the decimal
error, the 
> best your serial communication will be. For example, with the pclk
at 10MHz, 
> the UART speed will be 125000bps. Try to calculate it.
>

Re: GNU tools example - any demand

2006-03-02 by icapapindi

I think is a great idea too,

thanks

--- In lpc2000@yahoogroups.com, Tong Le <gaquaycalifornia@...> wrote:
>
> it is a great idea.
>   thanks
>   
> 
> Thiago Takehara <thiago@...> wrote:
>   Yes, it´s a very good idea. I'll try to translate my source codes
so they can be used for this goal.
> 
> I think a great project that we could handle all toghether is to
make something like "Code Architect" for LPC2000 family. I have a
little experience with javascript, but not a lot of time...
> 
> Regards,
> 
> Thiago Takehara
> Computer Engineer
> Engworks Industrial LTDA - R&D Division
> 
> ----- Original Message ----- 
>   From: brendanmurphy37 
>   To: lpc2000@yahoogroups.com 
>   Sent: Thursday, March 02, 2006 11:45 AM
>   Subject: [lpc2000] GNU tools example - any demand
> 
> 
> 
>   There's been a few occasions (including one current one) of people 
>   looking for examples of the files you need to get a basic program up 
>   and running using the GNU tools.
> 
>   My question is whether there would be any interest in having such an 
>   example placed in the Files section of the group? I'd be willing to 
>   put a core together and make it publically available, to include:
> 
>   - startup.s file with proper handling of vectors 
>   - interrupt dispatch, supporting nested interrupts
>   - link file
>   - make file
> 
>   Documentation by extensive comments.
> 
>   Nothing too complex: it would be be done for one particular varient, 
>   but would probably work for all.
> 
>   People could add to it if they want.
> 
>   If this has already been done, maybe someone could point this out, 
>   and provide a link to it.
> 
>   Let me know what you think.
> 
>   Brendan
> 
> 
> 
> 
> 
> 
>   SPONSORED LINKS Microcontrollers  Microprocessor  Intel
microprocessors  
>         Pic microcontrollers  
> 
> 
>
------------------------------------------------------------------------------
>   YAHOO! GROUPS LINKS 
> 
>     a..  Visit your group "lpc2000" on the web.
>       
>     b..  To unsubscribe from this group, send an email to:
>      lpc2000-unsubscribe@...m
>       
>     c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service. 
> 
> 
>
------------------------------------------------------------------------------
> 
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
>   SPONSORED LINKS 
>         Microcontrollers   Microprocessor   Intel microprocessors  
  Pic microcontrollers 
>     
> ---------------------------------
>   YAHOO! GROUPS LINKS 
> 
>     
>     Visit your group "lpc2000" on the web.
>     
>     To unsubscribe from this group, send an email to:
>  lpc2000-unsubscribe@yahoogroups.com
>     
>     Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service. 
Show quoted textHide quoted text
> 
>     
> ---------------------------------
>   
> 
> 
> 
> 		
> ---------------------------------
> Yahoo! Mail
> Bring photos to life! New PhotoMail  makes sharing a breeze. 
> 
> [Non-text portions of this message have been removed]
>

Re: [lpc2000] Re: UART baudrate

2006-03-02 by Tom Walsh

icapapindi wrote:

>Can I do it with PLL_MULT=1? I use the Xtal frecuency without PLL, I'm
>using these values:
>
>PCLK = 10 Mhz
>Divisor = 4
>MULVAL = 14
>DIVAddVal = 5
>
>With these values It is suppose to get 115.131 bps, but when I test
>with the oscilloscope the frecuency is about 128 Kbps. The code I used is:
>---------------------------------------------------
>unsigned int divisor=5;
>UART1_LCR = 0x83; /* 8 bit, 1 stop bit, no parity, enable DLAB */
>UART1_FDR=(UART1_FDR & 0xFFFFFF00) | 0xE5;
>UART1_DLL = divisor & 0xFF;
>UART1_DLM = (divisor >> 8) & 0xFF;
>UART1_LCR &= ~0x80; /* Disable DLAB */
>PCB_PINSEL0 = PCB_PINSEL0 & ~0x0F0000 | 0x050000;
>UART1_FCR = 1;
>----------------------------------------------------
>
>  
>
I worked my way through the example given in the LPC2138 User Manual and 
I came up with this little perl program.  Perhaps others may find it useful:

=============== begin baudrate.pl =================
#!/usr/bin/perl
# this determines the degree of error between desired and actual
# baudrates on the LPC2000 processors.
#    UART_BAUD(baud) (uint16_t)((PCLK / ((baud) * 16.0)) + 0.5)

my $FREQ = 14745000;    # crystal on X1 X2 pins.
my $PLL_MUL = 4;  # pll mult value.
my $PBSD = 2;     # peripheral bus divider.
my $CCLK = ($FREQ * $PLL_MUL);
my $PCLK = ($CCLK / $PBSD);
my @commonRates = 
(300,600,1200,2400,4800,9600,19200,38400,57600,115200,230400);

sub calcBaud {
my $desired = $_[0];
my $divisor = int(($PCLK / ($desired*16.0))+ 0.5);
my $actual = int(($PCLK / (16*$divisor)) * 1000) / 1000;
my $error = int((($actual - $desired) / $desired) * 1000000) / 10000;
   print "divisor: ${divisor}  desired: ${desired}  ".
      "actual: ${actual}  error: ${error}%\n";
}

   print "Crystal: ${FREQ}\n";
   print "PLL MULT: ${PLL_MUL}\n";
   print "Periph Bus Div: ${PBSD}\n";
   while (@commonRates) {
      calcBaud (shift(@commonRates));
   }

================ snip ========================




-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Re: GNU tools example - any demand

2006-03-02 by valdef78

--- In lpc2000@yahoogroups.com, "brendanmurphy37" 
<brendan.murphy@...> wrote:
> 
> There's been a few occasions (including one current one) of people 
> looking for examples of the files you need to get a basic program 
up 
> and running using the GNU tools.
> 
> My question is whether there would be any interest in having such 
an 
> example placed in the Files section of the group? I'd be willing 
to 
> put a core together and make it publically available, to include:
> 
> - startup.s file with proper handling of vectors 
> - interrupt dispatch, supporting nested interrupts
> - link file
> - make file
> 
> Documentation by extensive comments.
> 
> Nothing too complex: it would be be done for one particular 
varient, 
> but would probably work for all.
> 
> People could add to it if they want.
> 
> If this has already been done, maybe someone could point this out, 
> and provide a link to it.
> 
> Let me know what you think.
> 
> Brendan

Yes, I'm interested too.. I begin to "re-create" those files with 
much comments to do the same thing, as a tutorial exercice for me. 
but I had many other things to do recently and didn't have time to 
play with LPC..
Thanks.

Fred.

Re: UART baudrate

2006-03-03 by icapapindi

I have used PLL MUL=4 with divisor=22 and It works perfectfly !!
Altouht I don't understand why It doesn't work without multiplie the
clock frequency

Thank you very much !!



--- In lpc2000@yahoogroups.com, Tom Walsh <tom@...> wrote:
>
> icapapindi wrote:
> 
> >Can I do it with PLL_MULT=1? I use the Xtal frecuency without PLL, I'm
> >using these values:
> >
> >PCLK = 10 Mhz
> >Divisor = 4
> >MULVAL = 14
> >DIVAddVal = 5
> >
> >With these values It is suppose to get 115.131 bps, but when I test
> >with the oscilloscope the frecuency is about 128 Kbps. The code I
used is:
> >---------------------------------------------------
> >unsigned int divisor=5;
> >UART1_LCR = 0x83; /* 8 bit, 1 stop bit, no parity, enable DLAB */
> >UART1_FDR=(UART1_FDR & 0xFFFFFF00) | 0xE5;
> >UART1_DLL = divisor & 0xFF;
> >UART1_DLM = (divisor >> 8) & 0xFF;
> >UART1_LCR &= ~0x80; /* Disable DLAB */
> >PCB_PINSEL0 = PCB_PINSEL0 & ~0x0F0000 | 0x050000;
> >UART1_FCR = 1;
> >----------------------------------------------------
> >
> >  
> >
> I worked my way through the example given in the LPC2138 User Manual
and 
> I came up with this little perl program.  Perhaps others may find it
useful:
Show quoted textHide quoted text
> 
> =============== begin baudrate.pl =================
> #!/usr/bin/perl
> # this determines the degree of error between desired and actual
> # baudrates on the LPC2000 processors.
> #    UART_BAUD(baud) (uint16_t)((PCLK / ((baud) * 16.0)) + 0.5)
> 
> my $FREQ = 14745000;    # crystal on X1 X2 pins.
> my $PLL_MUL = 4;  # pll mult value.
> my $PBSD = 2;     # peripheral bus divider.
> my $CCLK = ($FREQ * $PLL_MUL);
> my $PCLK = ($CCLK / $PBSD);
> my @commonRates = 
> (300,600,1200,2400,4800,9600,19200,38400,57600,115200,230400);
> 
> sub calcBaud {
> my $desired = $_[0];
> my $divisor = int(($PCLK / ($desired*16.0))+ 0.5);
> my $actual = int(($PCLK / (16*$divisor)) * 1000) / 1000;
> my $error = int((($actual - $desired) / $desired) * 1000000) / 10000;
>    print "divisor: ${divisor}  desired: ${desired}  ".
>       "actual: ${actual}  error: ${error}%\n";
> }
> 
>    print "Crystal: ${FREQ}\n";
>    print "PLL MULT: ${PLL_MUL}\n";
>    print "Periph Bus Div: ${PBSD}\n";
>    while (@commonRates) {
>       calcBaud (shift(@commonRates));
>    }
> 
> ================ snip ========================
> 
> 
> 
> 
> -- 
> Tom Walsh - WN3L - Embedded Systems Consultant
> http://openhardware.net, http://cyberiansoftware.com
> "Windows? No thanks, I have work to do..."
> ----------------------------------------------------
>

Re: [lpc2000] Re: UART baudrate

2006-03-03 by Xtian Xultz

Yes and no.
The problem is not the speed, but the divisor error. 
For example, if you drive your LPC with 60MHz (10MHz*6 on PLL) you get an 
enourmous error at 115200. But at 50MHz the error is lesser. 
If you drive with just 14.7456 the error is zero. For any UART speed, at any 
PLL configuration. 
Got it?

Em Qui 02 Mar 2006 15:10, icapapindi escreveu:
Show quoted textHide quoted text
> Very good example !!
>
> I think that I did calculations correct, the problem is that I use 10
> Mhz as core clock with pll=1 and maybe this clock is not big enought
> to get 115200 baudrate, isn't it?
>
> Thanks !!
>
> --- In lpc2000@yahoogroups.com, Xtian Xultz <xultz@...> wrote:
> > Em Qui 02 Mar 2006 12:04, Iván Cayón escreveu:
> > > Hi !!
> > > I'm trying to send data with the UART at 115200 bps with a Xtal of
>
> 10 Mhz
>
> > > and the PC doesn't receive the data correctly. Is the baud rate
>
> limited
>
> > > with this equation?
> > >
> > > ratemax = PCLK / (16 x (2 + databits + paritybits + stopbits)
> > >
> > > if this is correct then I can't get this baudrate with 10 Mhz xtal
> > >
> > > Regards,
> > >
> > > Ivan
> >
> > Are you using PLL?
> > I am using right now an LPC2106 with 10MHz crystal.
> > To calculate the baudrate, you must first pick you pclk. For
>
> example, I am
>
> > using 50MHz (pll * 5) and pclk = 1 (the pclk is the same as the core
>
> clock).
>
> > So, if I have a 50MHz, first divide it by 16. I get: 3,125,000 and
>
> at that
>
> > frequency thats the clock that UART uses.
> > So, to calculate the dividers, divide that clock by the desired
>
> baudrate,
>
> > which at 115,200 gives me: 27,1267
> > Note that I have 0,1267 as decimal error on my divider, because the
>
> divider
>
> > accpets only integer numbers. If I made the other side calculation,
>
> dividing
>
> > 3,125,000 by 27, I get 115741 bps which is the speed my LPC will talk.
> > If, for example, I make the pll running at 60MHz, my divider is 32,5521
> > Note how big is my decimal error, is practicaly the worst case,
>
> where the
>
> > error resides in the middle betweem 0 and 1. If I use the divider as
>
> 33, my
>
> > UART speed is 113636 bps. Very bad, huh?
> >
> > So, to use 10MHz crystal, check this before. The lesser the decimal
>
> error, the
>
> > best your serial communication will be. For example, with the pclk
>
> at 10MHz,
>
> > the UART speed will be 125000bps. Try to calculate it.
>
> Yahoo! Groups Links
>
>
>

Re: UART baudrate

2006-03-03 by lpc2100_fan

Friendly amendment,

you can run at 7.3728 MHz and as fast as 460.8 kbit/sec without any
errors, this would also include the 115200 with zero error. If you do
not plan to use the PLL at all, you can use this or even go down
further. The secret is to select a crystal that is an integer
n*16*115200 for zero error. Lowest possible frequency would be 1.843
MHz. So it is not the speed primarily, the divider which is an integer
from your clock rate to the desired baudrate is the key.

Closest to your desired frequency and still able to use the PLL, which
requires a min of 10 MHz, would be 11.059 MHz 

If you use the LPC2148 or the newest LPC2103 these devices have a so
called fractional baudrate generator which enables other than integer
dividers and would provide accurate 115200 also with 10 MHz. 

Bob

--- In lpc2000@yahoogroups.com, Xtian Xultz <xultz@...> wrote:
>
> Yes and no.
> The problem is not the speed, but the divisor error. 
> For example, if you drive your LPC with 60MHz (10MHz*6 on PLL) you
get an 
> enourmous error at 115200. But at 50MHz the error is lesser. 
> If you drive with just 14.7456 the error is zero. For any UART
speed, at any 
> PLL configuration. 
> Got it?
> 
> Em Qui 02 Mar 2006 15:10, icapapindi escreveu:
> > Very good example !!
> >
> > I think that I did calculations correct, the problem is that I use 10
> > Mhz as core clock with pll=1 and maybe this clock is not big enought
> > to get 115200 baudrate, isn't it?
> >
> > Thanks !!
> >
> > --- In lpc2000@yahoogroups.com, Xtian Xultz <xultz@> wrote:
> > > Em Qui 02 Mar 2006 12:04, Iván Cayón escreveu:
> > > > Hi !!
> > > > I'm trying to send data with the UART at 115200 bps with a Xtal of
> >
> > 10 Mhz
> >
> > > > and the PC doesn't receive the data correctly. Is the baud rate
> >
> > limited
> >
> > > > with this equation?
> > > >
> > > > ratemax = PCLK / (16 x (2 + databits + paritybits + stopbits)
> > > >
> > > > if this is correct then I can't get this baudrate with 10 Mhz xtal
> > > >
> > > > Regards,
> > > >
> > > > Ivan
> > >
> > > Are you using PLL?
> > > I am using right now an LPC2106 with 10MHz crystal.
> > > To calculate the baudrate, you must first pick you pclk. For
> >
> > example, I am
> >
> > > using 50MHz (pll * 5) and pclk = 1 (the pclk is the same as the core
> >
> > clock).
> >
> > > So, if I have a 50MHz, first divide it by 16. I get: 3,125,000 and
> >
> > at that
> >
> > > frequency thats the clock that UART uses.
> > > So, to calculate the dividers, divide that clock by the desired
> >
> > baudrate,
> >
> > > which at 115,200 gives me: 27,1267
> > > Note that I have 0,1267 as decimal error on my divider, because the
> >
> > divider
> >
> > > accpets only integer numbers. If I made the other side calculation,
> >
> > dividing
> >
> > > 3,125,000 by 27, I get 115741 bps which is the speed my LPC will
talk.
> > > If, for example, I make the pll running at 60MHz, my divider is
32,5521
Show quoted textHide quoted text
> > > Note how big is my decimal error, is practicaly the worst case,
> >
> > where the
> >
> > > error resides in the middle betweem 0 and 1. If I use the divider as
> >
> > 33, my
> >
> > > UART speed is 113636 bps. Very bad, huh?
> > >
> > > So, to use 10MHz crystal, check this before. The lesser the decimal
> >
> > error, the
> >
> > > best your serial communication will be. For example, with the pclk
> >
> > at 10MHz,
> >
> > > the UART speed will be 125000bps. Try to calculate it.
> >
> > Yahoo! Groups Links
> >
> >
> >
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.