EmbeddedRelated.com
Forums

problem communication UART LPC2129 to LM400 bluetooth

Started by zied130187 December 13, 2010
> Have you checked that your baud rate is actually what you think it is?
> Tim Mitchell
>

hello TIM,

LM400 work with baud rate 19200. (in datasheet)

and i have config my UART with this :

quartz ,7456 MHz

PLLCFG_bit.MSEL=3; // * 4
PLLCFG_bit.PSEL=1; // / 1

clock CCLK is 58,9824 MHz

VPBDIV = 0 ==> PCLK = CCLK/4 = 14,7456 Mhz

divider baud rate = 14745600/(16*19200) = 48
U1DLL = 48; when DLAB =1
U1DLM = 0; when DLAB =1.

then, normally my baud rate of UART1 is 19200.

An Engineer's Guide to the LPC2100 Series

zied,

Do you know what a oscilloscope it ?

Do you know how to use one ??

Have you LOOKed at the signals on the Tx and Rx lines of the LM400.

If you have not looked at them with a 'scope, how do you know ?

don

--- In l..., "zied130187" wrote:
> > Have you checked that your baud rate is actually what you think it is?
> > Tim Mitchell
> > hello TIM,
>
> LM400 work with baud rate 19200. (in datasheet)
>
> and i have config my UART with this :
>
> quartz ,7456 MHz
>
> PLLCFG_bit.MSEL=3; // * 4
> PLLCFG_bit.PSEL=1; // / 1
>
> clock CCLK is 58,9824 MHz
>
> VPBDIV = 0 ==> PCLK = CCLK/4 = 14,7456 Mhz
>
> divider baud rate = 14745600/(16*19200) = 48
> U1DLL = 48; when DLAB =1
> U1DLM = 0; when DLAB =1.
>
> then, normally my baud rate of UART1 is 19200.
>

don't do like that .try to write general purpose UART.

means to support all baudrates.

go to pudn.com,there u will get codes man.try to use that.

On Mon, Dec 13, 2010 at 7:15 PM, zied130187 wrote:

>
> > Have you checked that your baud rate is actually what you think it is?
> > Tim Mitchell
> > hello TIM,
>
> LM400 work with baud rate 19200. (in datasheet)
>
> and i have config my UART with this :
>
> quartz ,7456 MHz
>
> PLLCFG_bit.MSEL=3; // * 4
> PLLCFG_bit.PSEL=1; // / 1
>
> clock CCLK is 58,9824 MHz
>
> VPBDIV = 0 ==> PCLK = CCLK/4 = 14,7456 Mhz
>
> divider baud rate = 14745600/(16*19200) = 48
> U1DLL = 48; when DLAB =1
> U1DLM = 0; when DLAB =1.
>
> then, normally my baud rate of UART1 is 19200.
>
>
>

--
Regards,
Suresh
----Original Message----
From: l...
[mailto:l...] On Behalf Of zied130187
Sent: 13 December 2010 13:45 To: l...
Subject: [lpc2000] Re: problem communication UART LPC2129
to LM400 bluetooth

> hello TIM,
>
> LM400 work with baud rate 19200. (in datasheet)
>
> and i have config my UART with this :
>
> quartz ,7456 MHz
>
> PLLCFG_bit.MSEL=3; // * 4
> PLLCFG_bit.PSEL=1; // / 1
>
> clock CCLK is 58,9824 MHz
>
> VPBDIV = 0 ==> PCLK = CCLK/4 = 14,7456 Mhz
>
> divider baud rate = 14745600/(16*19200) = 48
> U1DLL = 48; when DLAB =1
> U1DLM = 0; when DLAB =1.
>
> then, normally my baud rate of UART1 is 19200.

Your calculations look correct, but maybe they aren't...

Connect oscilloscope to TxD
send a "U" (01010101 binary)

measure the bit period
If it is 19200, then you have eliminated one possibility for the problem.

If it isn't...

--
Tim Mitchell

#define Fosc 12000000
#define Fcclk (Fosc * 4)
#define Fcco (Fcclk * 4)
#define Fpclk (Fcclk / 4)

void PLL_Init(void)
{
PLLCFG=0x00000024;
PLLCON=0x00000001;
PLLFEED=0x000000AA;
PLLFEED=0x00000055;
while(!(PLLSTAT & 0x00000400));
PLLCON=0x00000003;
PLLFEED=0x000000AA;
PLLFEED=0x00000055;
VPBDIV=0x00000001;
}

change the crysta frequency.it will work
On Mon, Dec 13, 2010 at 7:33 PM, Soori wrote:

> #define Fosc 12000000
> #define Fcclk (Fosc * 4)
> #define Fcco (Fcclk * 4)
> #define Fpclk (Fcclk / 4)
> #define baudrate 19200
>
void uart0Init(unsigned int BaudRate)
{

unsigned int Fdiv;
Fdiv =(Fpclk/16)/BaudRate;
U0LCR = 0x83;
U0DLL = Fdiv%256;
U0DLM = Fdiv/256;
U0LCR = 0x03;
U0IER = 0x01;
U0FCR = 0x01;

}

> void PLL_Init(void)
> {
> PLLCFG=0x00000024;
> PLLCON=0x00000001;
> PLLFEED=0x000000AA;
> PLLFEED=0x00000055;
> while(!(PLLSTAT & 0x00000400));
> PLLCON=0x00000003;
> PLLFEED=0x000000AA;
> PLLFEED=0x00000055;
> VPBDIV=0x00000001;
> }
>
> change the crysta frequency.it will work
>

--
Regards,
Suresh
--- In l..., Soori wrote:
>
> don't do like that .try to write general purpose UART.
>
> means to support all baudrates.
>
> go to pudn.com,there u will get codes man.try to use that.
>
> On Mon, Dec 13, 2010 at 7:15 PM, zied130187 wrote:
>
> >
> >
> >
> > > Have you checked that your baud rate is actually what you think it is?
> > > Tim Mitchell
> > >
> >
> > hello TIM,
> >
> > LM400 work with baud rate 19200. (in datasheet)
> >
> > and i have config my UART with this :
> >
> > quartz ,7456 MHz
> >
> > PLLCFG_bit.MSEL=3; // * 4
> > PLLCFG_bit.PSEL=1; // / 1
> >
> > clock CCLK is 58,9824 MHz
> >
> > VPBDIV = 0 ==> PCLK = CCLK/4 = 14,7456 Mhz
> >
> > divider baud rate = 14745600/(16*19200) = 48
> > U1DLL = 48; when DLAB =1
> > U1DLM = 0; when DLAB =1.
> >
> > then, normally my baud rate of UART1 is 19200.
> >
> >
> > --
> Regards,
> Suresh
>
thank you suresh, i know this site.
my problem not to config UART ,
because my prgram work if i connect U1TX to U1RX,
is not the problem of UART,
but the problem is to communicate with LM400.

--- In l..., "Tim Mitchell" wrote:
>
> ----Original Message----
> From: l...
> [mailto:l...] On Behalf Of zied130187
> Sent: 13 December 2010 13:45 To: l...
> Subject: [lpc2000] Re: problem communication UART LPC2129
> to LM400 bluetooth
>
> > hello TIM,
> >
> > LM400 work with baud rate 19200. (in datasheet)
> >
> > and i have config my UART with this :
> >
> > quartz ,7456 MHz
> >
> > PLLCFG_bit.MSEL=3; // * 4
> > PLLCFG_bit.PSEL=1; // / 1
> >
> > clock CCLK is 58,9824 MHz
> >
> > VPBDIV = 0 ==> PCLK = CCLK/4 = 14,7456 Mhz
> >
> > divider baud rate = 14745600/(16*19200) = 48
> > U1DLL = 48; when DLAB =1
> > U1DLM = 0; when DLAB =1.
> >
> > then, normally my baud rate of UART1 is 19200.
>
> Your calculations look correct, but maybe they aren't...
>
> Connect oscilloscope to TxD
> send a "U" (01010101 binary)
>
> measure the bit period
> If it is 19200, then you have eliminated one possibility for the problem.
>
> If it isn't...
>
> --
> Tim Mitchell
>
thank you Tim , i contact you when i measure the bit period with scope

--- In l..., "Donald H" wrote:
>
> zied,
>
> Do you know what a oscilloscope it ?
>
> Do you know how to use one ??
>
> Have you LOOKed at the signals on the Tx and Rx lines of the LM400.
>
> If you have not looked at them with a 'scope, how do you know ?
>
> don
>
> --- In l..., "zied130187" wrote:
> >
> >
> > > Have you checked that your baud rate is actually what you think it is?
> > > Tim Mitchell
> > >
> >
> > hello TIM,
> >
> > LM400 work with baud rate 19200. (in datasheet)
> >
> > and i have config my UART with this :
> >
> > quartz ,7456 MHz
> >
> > PLLCFG_bit.MSEL=3; // * 4
> > PLLCFG_bit.PSEL=1; // / 1
> >
> > clock CCLK is 58,9824 MHz
> >
> > VPBDIV = 0 ==> PCLK = CCLK/4 = 14,7456 Mhz
> >
> > divider baud rate = 14745600/(16*19200) = 48
> > U1DLL = 48; when DLAB =1
> > U1DLM = 0; when DLAB =1.
> >
> > then, normally my baud rate of UART1 is 19200.
>

i try to measure the baud with scope , and i contact you, to give you the result.

but normally , i have coded the correct config.
why may be i can not have 19200.

i respect the config with datasheet of LPC2129.
and the value of my quartz 14,7456 Mhz

--- In l..., Soori wrote:
>
> #define Fosc 12000000
> #define Fcclk (Fosc * 4)
> #define Fcco (Fcclk * 4)
> #define Fpclk (Fcclk / 4)
>
> void PLL_Init(void)
> {
> PLLCFG=0x00000024;
> PLLCON=0x00000001;
> PLLFEED=0x000000AA;
> PLLFEED=0x00000055;
> while(!(PLLSTAT & 0x00000400));
> PLLCON=0x00000003;
> PLLFEED=0x000000AA;
> PLLFEED=0x00000055;
> VPBDIV=0x00000001;
> }
>
> change the crysta frequency.it will work
>
> #define Fosc 12000000
no my quartz is 14,4756Mhz