Forums

Newlib-lpc exmaples and baud rate

Started by ggindele October 10, 2004

I started on a LPC2124 with 10MHz xtal, and none of the newlib-lpc
examples picking up the right baud rate. (of course after adjusting
SetNativeSpeed).

Then I tried the UT040803A example, no luck on 10MHz. Then I throw in
a 14.7456MHz xtal, and the UT040803A is working OK now. But the
newlib-lpc examples still not picking up the right baud rate. This is
how it's configured:

SetNativeSpeed(14746uL);
sp.baud = 115200uL;
sp.length = UART_WORD_LEN_8;
sp.parity = UART_PARITY_NONE;
sp.stop = UART_STOP_BITS_1;
SetMAM( 3u, MAM_full_enable);
VPBControl(VPB_DIV1);
SetDesiredSpeed(60000uL);

Is there any obvious reason why this is not working? (lpc_hello_rs232
from WinARM)?

Gabe




An Engineer's Guide to the LPC2100 Series

At 03:00 PM 10/10/04 +0000, you wrote: >I started on a LPC2124 with 10MHz xtal, and none of the newlib-lpc
>examples picking up the right baud rate. (of course after adjusting
>SetNativeSpeed).
>
>Then I tried the UT040803A example, no luck on 10MHz. Then I throw in
>a 14.7456MHz xtal, and the UT040803A is working OK now. But the
>newlib-lpc examples still not picking up the right baud rate. This is
>how it's configured:
>
> SetNativeSpeed(14746uL);
> sp.baud = 115200uL;
> sp.length = UART_WORD_LEN_8;
> sp.parity = UART_PARITY_NONE;
> sp.stop = UART_STOP_BITS_1;
> SetMAM( 3u, MAM_full_enable);
> VPBControl(VPB_DIV1);
> SetDesiredSpeed(60000uL);
>
>Is there any obvious reason why this is not working? (lpc_hello_rs232
>from WinARM)?

This doesn't actually set the baud rate anywhere.

From the example test2.c

/* Set up serial port to desired rate. */
(void)ioctl( fileno(stdout), UART_SETUP, &sp);

Until the ioctl call is made nothing has set the baud rate.

Robert

" 'Freedom' has no meaning of itself. There are always restrictions,
be they legal, genetic, or physical. If you don't believe me, try to
chew a radio signal. "

Kelvin Throop, III


FOr UT040803A, open 'config.h' and change the settings for FOSC,
PLL_MUL, and PBSD to the appropriate values. The values already
in the code are for a 10MHz crystal and the PCLK for a correctly
configured 10MHz & 14.7456MHz crystals are only about 1.7% different.
That MIGHT allow the serial port to communicate with the same
settings. Possibly your 10MHz crystal is not functional?

Regards
-Bill Knight
www.theARMPatch.com

On Sun, 10 Oct 2004 15:00:59 -0000, ggindele wrote:

I started on a LPC2124 with 10MHz xtal, and none of the newlib-lpc
examples picking up the right baud rate. (of course after adjusting
SetNativeSpeed).

Then I tried the UT040803A example, no luck on 10MHz. Then I throw in
a 14.7456MHz xtal, and the UT040803A is working OK now. But the
newlib-lpc examples still not picking up the right baud rate. This is
how it's configured:

SetNativeSpeed(14746uL);
sp.baud = 115200uL;
sp.length = UART_WORD_LEN_8;
sp.parity = UART_PARITY_NONE;
sp.stop = UART_STOP_BITS_1;
SetMAM( 3u, MAM_full_enable);
VPBControl(VPB_DIV1);
SetDesiredSpeed(60000uL);

Is there any obvious reason why this is not working? (lpc_hello_rs232
from WinARM)?

Gabe