Forums

LPC23xx : Re-config of UART1 is not working

Started by nourson54 April 14, 2008
Hi,

I made a SDCard bootloader that works well .
But if I activate the UART1 in the bootloader to print some debug
informations AND my application firmware use the UART1, the firmware
is blocking ...

After some debug , it seems the second configuration of the UART1
(firt is when used in the bootloader) doesn't work. In fact the baud
registers are 0 and the LPC blocks when transmitting a character( the
THRE bit of U1LSR is never set);

I I don't activate the UART1 in the bootloader , the application UART1
code is working normally ! Oo

Does someone had some similar problem with UART on lpc23xx ??

Thanks in advance

PS:
The code used to setup in the application firmware is :

PCONP|=(1<<4);
PINSEL0 &= ~0xC0000000;
PINSEL0 |= 0x40000000; /* Enable TxD1 pin */
PINSEL1 &= ~0x00000003;
PINSEL1 |= 0x00000001; /* Enable RxD1 pin */
U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit*/
U1DLL = 3; /* for 12MHz PCLK Clock */
U1FDR = 0x67; /* Fractional Divider */
U1LCR = 0x03; /* DLAB = 0 */

An Engineer's Guide to the LPC2100 Series

I don't have the same (???) problem as you described.
But serial progamming via RS-232 on my current LCP2378 board is a
total lost.
There are problems with the ISP programming for certain revisions B
of LCP23xx and LCP24xx.

Whenever the MCU enters the ISP routine, the Tx line is hang (at
certain voltage level), this line can only be released by reset or
the download program terminated it querries.

Check out this Notification Number: 200803010I on NXP website

You might be on the right track to disable UARTS in the boot loader,
so that your serial port is working. I'll try that.
Best Regards

--- In l..., "nourson54" wrote:
>
> Hi,
>
> I made a SDCard bootloader that works well .
> But if I activate the UART1 in the bootloader to print some debug
> informations AND my application firmware use the UART1, the
firmware
> is blocking ...
>
> After some debug , it seems the second configuration of the UART1
> (firt is when used in the bootloader) doesn't work. In fact the
baud
> registers are 0 and the LPC blocks when transmitting a character(
the
> THRE bit of U1LSR is never set);
>
> I I don't activate the UART1 in the bootloader , the application
UART1
> code is working normally ! Oo
>
> Does someone had some similar problem with UART on lpc23xx ??
>
> Thanks in advance
>
> PS:
> The code used to setup in the application firmware is :
>
> PCONP|=(1<<4);
> PINSEL0 &= ~0xC0000000;
> PINSEL0 |= 0x40000000; /* Enable TxD1 pin */
> PINSEL1 &= ~0x00000003;
> PINSEL1 |= 0x00000001; /* Enable RxD1 pin */
> U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit*/
> U1DLL = 3; /* for 12MHz PCLK Clock */
> U1FDR = 0x67; /* Fractional Divider */
> U1LCR = 0x03; /* DLAB = 0 */
>

Thanks for the tip , I'll take a look at the document.... if I find it !!
If I use the number you provided ? I cannot find it in the nxp search
engine.
Do you have a direct link please ?
Kind regards.
--- In l..., "hobbitsuit" wrote:
>
> I don't have the same (???) problem as you described.
> But serial progamming via RS-232 on my current LCP2378 board is a
> total lost.
> There are problems with the ISP programming for certain revisions B
> of LCP23xx and LCP24xx.
>
> Whenever the MCU enters the ISP routine, the Tx line is hang (at
> certain voltage level), this line can only be released by reset or
> the download program terminated it querries.
>
> Check out this Notification Number: 200803010I on NXP website
>
> You might be on the right track to disable UARTS in the boot loader,
> so that your serial port is working. I'll try that.
> Best Regards
>
> --- In l..., "nourson54" wrote:
> >
> > Hi,
> >
> > I made a SDCard bootloader that works well .
> > But if I activate the UART1 in the bootloader to print some debug
> > informations AND my application firmware use the UART1, the
> firmware
> > is blocking ...
> >
> > After some debug , it seems the second configuration of the UART1
> > (firt is when used in the bootloader) doesn't work. In fact the
> baud
> > registers are 0 and the LPC blocks when transmitting a character(
> the
> > THRE bit of U1LSR is never set);
> >
> > I I don't activate the UART1 in the bootloader , the application
> UART1
> > code is working normally ! Oo
> >
> > Does someone had some similar problem with UART on lpc23xx ??
> >
> > Thanks in advance
> >
> >
> >
> > PS:
> > The code used to setup in the application firmware is :
> >
> > PCONP|=(1<<4);
> > PINSEL0 &= ~0xC0000000;
> > PINSEL0 |= 0x40000000; /* Enable TxD1 pin */
> > PINSEL1 &= ~0x00000003;
> > PINSEL1 |= 0x00000001; /* Enable RxD1 pin */
> > U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit*/
> > U1DLL = 3; /* for 12MHz PCLK Clock */
> > U1FDR = 0x67; /* Fractional Divider */
> > U1LCR = 0x03; /* DLAB = 0 */
>
> Does someone had some similar problem with UART on lpc23xx ??

Hi

In the uTasker project for the LPC23XX it is possible to change the
UART configuration on-the-fly which is effectively what you are doing.
I don't know of any issues involved with this.

I didn't see where you are configuring FIFO operation, for example
FIFO_ENABLE bit in the IIR_FCR register should beb set for proper UART
operation.

Here's the config code from the project - perhaps you can see
something (I have stripped it to UART0 for clarity woth 19200 BAUD):
extern void fnConfigSCI(QUEUE_HANDLE Channel, TTYTABLE *pars)
{
LPC23XX_UART_CONTROL *uart_reg = fnSelectChannel(Channel);
unsigned short usDivider;

PCONP |= PCUART0; // power up the UART
PINSEL0 |= (PINSEL0_P0_2_TXD0 | PINSEL0_P0_3_RXD0); // TXD0 and
RXD0 on P0.2 and P0.3
uart_reg->IIR_FCR = FIFO_ENABLE; // set the FIFO enable bit in the
FCR register. This bit must be set for proper UART operation
uart_reg->IIR_FCR = (FIFO_ENABLE | RX_FIFO_RESET | TX_FIFO_RESET |
RX_TRIGGER_1_CHAR); // ensure FIFOs reset when starting
uart_reg->LCR = DLAB; // set access to divisor latch registers
usDivider = ((UART_CLOCK/16 + 19200/2)/19200);
uart_reg->RBR_THR_DLL = (unsigned char)usDivider; // program speed
to divisor latch registers
uart_reg->DLM_IER = (unsigned char)(usDivider >> 8);
if (pars->usConfig & (RS232_ODD_PARITY | RS232_EVEN_PARITY)) {
if (pars->usConfig & RS232_ODD_PARITY) {
uart_reg->LCR = (UART_PARITY_ENABLE | UART_PARITY_ODD);
// program odd parity
}
else {
uart_reg->LCR = (UART_PARITY_ENABLE | UART_PARITY_EVEN);
// program even parity
}
}
else {
uart_reg->LCR = UART_PARITY_DISABLED; // no parity
}
if (pars->usConfig & TWO_STOPS) {
uart_reg->LCR |= UART_2_STOP_BITS; // set 2 stop bits rather
than 1 stop bit
}
if (pars->usConfig & CHAR_7) {
uart_reg->LCR |= UART_7_BIT_CHAR;// set 7 bit characters
}
else {
uart_reg->LCR |= UART_8_BIT_CHAR; // set 8 bit characters
}
}
Regards

Mark

http://www.uTasker.com

> (I have stripped it to UART0 for clarity woth 19200 BAUD):

Oops - I see you want UART1 - here is the change:
PCONP |= PCUART1; // power up the UART
PINSEL0 |= (PINSEL0_P0_8_TXD1 | PINSEL0_P0_9_RXD1);
// TXD1 and RXD1 on P0.8 and P0.9

Regards

Mark

http://www.uTasker.com

Hi,
My apologized, I can not find it myself either. I thought that would
be on the NXP site.

I've got this documnet "CPCN200803010I-LPC23-24 IRC issue.pdf" via
my distributor.

I don't know the complication of sharing it. I'm sorry.

It's best that you ask NXP tech support/ distributor in your country.

Best Regards.
--- In l..., "nourson54" wrote:
>
> Thanks for the tip , I'll take a look at the document.... if I
find it !!
> If I use the number you provided ? I cannot find it in the nxp
search
> engine.
> Do you have a direct link please ?
> Kind regards.
> --- In l..., "hobbitsuit" wrote:
> >
> > I don't have the same (???) problem as you described.
> > But serial progamming via RS-232 on my current LCP2378 board is
a
> > total lost.
> > There are problems with the ISP programming for certain
revisions B
> > of LCP23xx and LCP24xx.
> >
> > Whenever the MCU enters the ISP routine, the Tx line is hang (at
> > certain voltage level), this line can only be released by reset
or
> > the download program terminated it querries.
> >
> > Check out this Notification Number: 200803010I on NXP website
> >
> > You might be on the right track to disable UARTS in the boot
loader,
> > so that your serial port is working. I'll try that.
> >
> >
> > Best Regards
> >
> > --- In l..., "nourson54" wrote:
> > >
> > > Hi,
> > >
> > > I made a SDCard bootloader that works well .
> > > But if I activate the UART1 in the bootloader to print some
debug
> > > informations AND my application firmware use the UART1, the
> > firmware
> > > is blocking ...
> > >
> > > After some debug , it seems the second configuration of the
UART1
> > > (firt is when used in the bootloader) doesn't work. In fact
the
> > baud
> > > registers are 0 and the LPC blocks when transmitting a
character(
> > the
> > > THRE bit of U1LSR is never set);
> > >
> > > I I don't activate the UART1 in the bootloader , the
application
> > UART1
> > > code is working normally ! Oo
> > >
> > > Does someone had some similar problem with UART on lpc23xx ??
> > >
> > > Thanks in advance
> > >
> > >
> > >
> > > PS:
> > > The code used to setup in the application firmware is :
> > >
> > > PCONP|=(1<<4);
> > > PINSEL0 &= ~0xC0000000;
> > > PINSEL0 |= 0x40000000; /* Enable TxD1
pin */
> > > PINSEL1 &= ~0x00000003;
> > > PINSEL1 |= 0x00000001; /* Enable RxD1
pin */
> > > U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop
bit*/
> > > U1DLL = 3; /* for 12MHz PCLK
Clock */
> > > U1FDR = 0x67; /* Fractional Divider
*/
> > > U1LCR = 0x03; /* DLAB = 0 */
> > >
>