UART0 - does not work while UART1 does

Started by Giuseppe Marullo December 20, 2008
Hi,
I need someone to be mercy and send me a compiled gcc example of
a program to send test chars on uart0 and uar1 for a
LPC2138@24MHz.

I cannot think anything wrong with what I do and that
basically works for uart1.

Uart0 is connected thru an FPGA, Uart1 is directly connected to a serial port.
The fpga is programmed to just forward the signals between the LPC2138 and a serial port. Other than the FPGA "disturbing" the uart0, I cannot find where the problem is.
I did basic testing on the involved GPIOs and they are still fine.

Giuseppe

int main (int argc, char** argv) {
IODIR0 = 0x80000000;
uart0_init(9600);
uart1_init(9600);
MAMCR = 2;
unsigned char i = 0;
while (1) {
IOSET0 = 0x80000000;
uart0_transmit('a');
uart1_transmit('a');
uart1_transmit('b');
uart1_transmit('c');
uart1_transmit('d');
IOCLR0 = 0x80000000;
uart1_transmit('e');
uart1_transmit('f');
uart1_transmit('g');
uart0_transmit('a');
}
return 0;
}

void uart0_init ( unsigned int baud ) {
//set Line Control Register (8 bit, 1 stop bit, no parity, enable DLAB)
U0LCR_bit.WLS = 0x3; //8 bit
U0LCR_bit.SBS = 0x0; //1 stop bit
U0LCR_bit.PE = 0x0; //no parity
U0LCR_bit.DLAB = 0x1; //enable DLAB
//U0LCR = 0x83;

unsigned int divisor = peripheral_clock_frequency() / (16 * baud);

U0DLL = divisor & 0xFF;
U0DLM = (divisor >> 8) & 0xFF;
U0LCR &= ~0x80;

PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
}
void uart1_init ( unsigned int baud ) {
//set Line Control Register (8 bit, 1 stop bit, no parity, enable DLAB)
U1LCR_bit.WLS = 0x3; //8 bit
U1LCR_bit.SBS = 0x0; //1 stop bit
U1LCR_bit.PE = 0x0; //no parity
U1LCR_bit.DLAB = 0x1; //enable DLAB
//U0LCR = 0x83;

unsigned int divisor = peripheral_clock_frequency() / (16 * baud);

U1DLL = divisor & 0xFF;
U1DLM = (divisor >> 8) & 0xFF;
U1LCR &= ~0x80;

// PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
PINSEL0 = PINSEL0 & ~0xFFF0FFFF | 0x00050000;
}


An Engineer's Guide to the LPC2100 Series

You may want to look at LPC2148 demo code at http://jcwren.com/arm
If I recall correctly, the only real difference between the two is the
LPC2138 doesn't have USB, so the UART examples should serve for you.

--jc

On Sat, Dec 20, 2008 at 8:32 AM, Giuseppe Marullo wrote:

> Hi,
> I need someone to be mercy and send me a compiled gcc example of
> a program to send test chars on uart0 and uar1 for a
> LPC2138@24MHz.
>
> I cannot think anything wrong with what I do and that
> basically works for uart1.
>
> Uart0 is connected thru an FPGA, Uart1 is directly connected to a serial
> port.
> The fpga is programmed to just forward the signals between the LPC2138 and
> a serial port. Other than the FPGA "disturbing" the uart0, I cannot find
> where the problem is.
> I did basic testing on the involved GPIOs and they are still fine.
>
> Giuseppe
>
> int main (int argc, char** argv) {
> IODIR0 = 0x80000000;
> uart0_init(9600);
> uart1_init(9600);
> MAMCR = 2;
> unsigned char i = 0;
> while (1) {
> IOSET0 = 0x80000000;
> uart0_transmit('a');
> uart1_transmit('a');
> uart1_transmit('b');
> uart1_transmit('c');
> uart1_transmit('d');
> IOCLR0 = 0x80000000;
> uart1_transmit('e');
> uart1_transmit('f');
> uart1_transmit('g');
> uart0_transmit('a');
> }
> return 0;
> }
>
> void uart0_init ( unsigned int baud ) {
> //set Line Control Register (8 bit, 1 stop bit, no parity, enable DLAB)
> U0LCR_bit.WLS = 0x3; //8 bit
> U0LCR_bit.SBS = 0x0; //1 stop bit
> U0LCR_bit.PE = 0x0; //no parity
> U0LCR_bit.DLAB = 0x1; //enable DLAB
> //U0LCR = 0x83;
>
> unsigned int divisor = peripheral_clock_frequency() / (16 * baud);
>
> U0DLL = divisor & 0xFF;
> U0DLM = (divisor >> 8) & 0xFF;
> U0LCR &= ~0x80;
>
> PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
> }
> void uart1_init ( unsigned int baud ) {
> //set Line Control Register (8 bit, 1 stop bit, no parity, enable DLAB)
> U1LCR_bit.WLS = 0x3; //8 bit
> U1LCR_bit.SBS = 0x0; //1 stop bit
> U1LCR_bit.PE = 0x0; //no parity
> U1LCR_bit.DLAB = 0x1; //enable DLAB
> //U0LCR = 0x83;
>
> unsigned int divisor = peripheral_clock_frequency() / (16 * baud);
>
> U1DLL = divisor & 0xFF;
> U1DLM = (divisor >> 8) & 0xFF;
> U1LCR &= ~0x80;
>
> // PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
> PINSEL0 = PINSEL0 & ~0xFFF0FFFF | 0x00050000;
> }
>
>
>
>
>

Sorry I didn't have my code handy, uart0 works, is uart1 that is driving
me mad.

I will try to take a look, maybe I will find the error, in the meantime
a binary is still highly wanted, please Santa...

Giuseppe

J.C. Wren wrote:
> You may want to look at LPC2148 demo code at http://jcwren.com/arm
> If I recall correctly, the only real difference between the two is the
> LPC2138 doesn't have USB, so the UART examples should serve for you.
>
> --jc
>
> On Sat, Dec 20, 2008 at 8:32 AM, Giuseppe Marullo wrote:
>
>
>> Hi,
>> I need someone to be mercy and send me a compiled gcc example of
>> a program to send test chars on uart0 and uar1 for a
>> LPC2138@24MHz.
>>
>> I cannot think anything wrong with what I do and that
>> basically works for uart1.
>>
>> Uart0 is connected thru an FPGA, Uart1 is directly connected to a serial
>> port.
>> The fpga is programmed to just forward the signals between the LPC2138 and
>> a serial port. Other than the FPGA "disturbing" the uart0, I cannot find
>> where the problem is.
>> I did basic testing on the involved GPIOs and they are still fine.
>>
>> Giuseppe
>>
>> int main (int argc, char** argv) {
>> IODIR0 = 0x80000000;
>> uart0_init(9600);
>> uart1_init(9600);
>> MAMCR = 2;
>> unsigned char i = 0;
>> while (1) {
>> IOSET0 = 0x80000000;
>> uart0_transmit('a');
>> uart1_transmit('a');
>> uart1_transmit('b');
>> uart1_transmit('c');
>> uart1_transmit('d');
>> IOCLR0 = 0x80000000;
>> uart1_transmit('e');
>> uart1_transmit('f');
>> uart1_transmit('g');
>> uart0_transmit('a');
>> }
>> return 0;
>> }
>>
>> void uart0_init ( unsigned int baud ) {
>> //set Line Control Register (8 bit, 1 stop bit, no parity, enable DLAB)
>> U0LCR_bit.WLS = 0x3; //8 bit
>> U0LCR_bit.SBS = 0x0; //1 stop bit
>> U0LCR_bit.PE = 0x0; //no parity
>> U0LCR_bit.DLAB = 0x1; //enable DLAB
>> //U0LCR = 0x83;
>>
>> unsigned int divisor = peripheral_clock_frequency() / (16 * baud);
>>
>> U0DLL = divisor & 0xFF;
>> U0DLM = (divisor >> 8) & 0xFF;
>> U0LCR &= ~0x80;
>>
>> PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
>> }
>> void uart1_init ( unsigned int baud ) {
>> //set Line Control Register (8 bit, 1 stop bit, no parity, enable DLAB)
>> U1LCR_bit.WLS = 0x3; //8 bit
>> U1LCR_bit.SBS = 0x0; //1 stop bit
>> U1LCR_bit.PE = 0x0; //no parity
>> U1LCR_bit.DLAB = 0x1; //enable DLAB
>> //U0LCR = 0x83;
>>
>> unsigned int divisor = peripheral_clock_frequency() / (16 * baud);
>>
>> U1DLL = divisor & 0xFF;
>> U1DLM = (divisor >> 8) & 0xFF;
>> U1LCR &= ~0x80;
>>
>> // PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
>> PINSEL0 = PINSEL0 & ~0xFFF0FFFF | 0x00050000;
>> }
>>
>>
>>
>>
>>
>>
>
>
Hello Giuseppe,

> Sorry I didn't have my code handy

what do you mean by this ? Is it different to the code below in the
email ???

I think you just need to download jc's code and compare it with your
code, if something is missing. For this you don't need a hex file.
What is the advantage of a hexfile ? Do you suspect that your
hardware or wiring of COM-Port cables is not working ?

Regards,

Martin

--- In l..., Giuseppe Marullo wrote:
>
> Sorry I didn't have my code handy, uart0 works, is uart1 that is
driving
> me mad.
>
> I will try to take a look, maybe I will find the error, in the
meantime
> a binary is still highly wanted, please Santa...
>
> Giuseppe
>
> J.C. Wren wrote:
> > You may want to look at LPC2148 demo code at http://jcwren.com/arm
> > If I recall correctly, the only real difference between the two
is the
> > LPC2138 doesn't have USB, so the UART examples should serve for
you.
> >
> > --jc
> >
> > On Sat, Dec 20, 2008 at 8:32 AM, Giuseppe Marullo
wrote:
> >
> >
> >> Hi,
> >> I need someone to be mercy and send me a compiled gcc example of
> >> a program to send test chars on uart0 and uar1 for a
> >> LPC2138@24MHz.
> >>
> >> I cannot think anything wrong with what I do and that
> >> basically works for uart1.
> >>
> >> Uart0 is connected thru an FPGA, Uart1 is directly connected to
a serial
> >> port.
> >> The fpga is programmed to just forward the signals between the
LPC2138 and
> >> a serial port. Other than the FPGA "disturbing" the uart0, I
cannot find
> >> where the problem is.
> >> I did basic testing on the involved GPIOs and they are still
fine.
> >>
> >> Giuseppe
> >>
> >> int main (int argc, char** argv) {
> >> IODIR0 = 0x80000000;
> >> uart0_init(9600);
> >> uart1_init(9600);
> >> MAMCR = 2;
> >> unsigned char i = 0;
> >> while (1) {
> >> IOSET0 = 0x80000000;
> >> uart0_transmit('a');
> >> uart1_transmit('a');
> >> uart1_transmit('b');
> >> uart1_transmit('c');
> >> uart1_transmit('d');
> >> IOCLR0 = 0x80000000;
> >> uart1_transmit('e');
> >> uart1_transmit('f');
> >> uart1_transmit('g');
> >> uart0_transmit('a');
> >> }
> >> return 0;
> >> }
> >>
> >> void uart0_init ( unsigned int baud ) {
> >> //set Line Control Register (8 bit, 1 stop bit, no parity,
enable DLAB)
> >> U0LCR_bit.WLS = 0x3; //8 bit
> >> U0LCR_bit.SBS = 0x0; //1 stop bit
> >> U0LCR_bit.PE = 0x0; //no parity
> >> U0LCR_bit.DLAB = 0x1; //enable DLAB
> >> //U0LCR = 0x83;
> >>
> >> unsigned int divisor = peripheral_clock_frequency() / (16 *
baud);
> >>
> >> U0DLL = divisor & 0xFF;
> >> U0DLM = (divisor >> 8) & 0xFF;
> >> U0LCR &= ~0x80;
> >>
> >> PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
> >> }
> >> void uart1_init ( unsigned int baud ) {
> >> //set Line Control Register (8 bit, 1 stop bit, no parity,
enable DLAB)
> >> U1LCR_bit.WLS = 0x3; //8 bit
> >> U1LCR_bit.SBS = 0x0; //1 stop bit
> >> U1LCR_bit.PE = 0x0; //no parity
> >> U1LCR_bit.DLAB = 0x1; //enable DLAB
> >> //U0LCR = 0x83;
> >>
> >> unsigned int divisor = peripheral_clock_frequency() / (16 *
baud);
> >>
> >> U1DLL = divisor & 0xFF;
> >> U1DLM = (divisor >> 8) & 0xFF;
> >> U1LCR &= ~0x80;
> >>
> >> // PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
> >> PINSEL0 = PINSEL0 & ~0xFFF0FFFF | 0x00050000;
> >> }
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >
> >
> >
> >
Additional note:

What you have not posted is the source of

uart0_transmit('a');
uart1_transmit('a');

Are you just moving the character to send FIFO or are you looking /
waiting that the previous character was sent out ?

Perhaps you should make big loops (e.g. 0.5 seconds) between each
transmit call ?

Regards,

Martin

--- In l..., "capiman26061973"
wrote:
>
> Hello Giuseppe,
>
> > Sorry I didn't have my code handy
>
> what do you mean by this ? Is it different to the code below in the
> email ???
>
> I think you just need to download jc's code and compare it with
your
> code, if something is missing. For this you don't need a hex file.
> What is the advantage of a hexfile ? Do you suspect that your
> hardware or wiring of COM-Port cables is not working ?
>
> Regards,
>
> Martin
>
> --- In l..., Giuseppe Marullo wrote:
> >
> > Sorry I didn't have my code handy, uart0 works, is uart1 that is
> driving
> > me mad.
> >
> > I will try to take a look, maybe I will find the error, in the
> meantime
> > a binary is still highly wanted, please Santa...
> >
> > Giuseppe
> >
> > J.C. Wren wrote:
> > > You may want to look at LPC2148 demo code at
http://jcwren.com/arm
> > > If I recall correctly, the only real difference between the two
> is the
> > > LPC2138 doesn't have USB, so the UART examples should serve for
> you.
> > >
> > > --jc
> > >
> > > On Sat, Dec 20, 2008 at 8:32 AM, Giuseppe Marullo
> wrote:
> > >
> > >
> > >> Hi,
> > >> I need someone to be mercy and send me a compiled gcc example
of
> > >> a program to send test chars on uart0 and uar1 for a
> > >> LPC2138@24MHz.
> > >>
> > >> I cannot think anything wrong with what I do and that
> > >> basically works for uart1.
> > >>
> > >> Uart0 is connected thru an FPGA, Uart1 is directly connected
to
> a serial
> > >> port.
> > >> The fpga is programmed to just forward the signals between the
> LPC2138 and
> > >> a serial port. Other than the FPGA "disturbing" the uart0, I
> cannot find
> > >> where the problem is.
> > >> I did basic testing on the involved GPIOs and they are still
> fine.
> > >>
> > >> Giuseppe
> > >>
> > >> int main (int argc, char** argv) {
> > >> IODIR0 = 0x80000000;
> > >> uart0_init(9600);
> > >> uart1_init(9600);
> > >> MAMCR = 2;
> > >> unsigned char i = 0;
> > >> while (1) {
> > >> IOSET0 = 0x80000000;
> > >> uart0_transmit('a');
> > >> uart1_transmit('a');
> > >> uart1_transmit('b');
> > >> uart1_transmit('c');
> > >> uart1_transmit('d');
> > >> IOCLR0 = 0x80000000;
> > >> uart1_transmit('e');
> > >> uart1_transmit('f');
> > >> uart1_transmit('g');
> > >> uart0_transmit('a');
> > >> }
> > >> return 0;
> > >> }
> > >>
> > >> void uart0_init ( unsigned int baud ) {
> > >> //set Line Control Register (8 bit, 1 stop bit, no parity,
> enable DLAB)
> > >> U0LCR_bit.WLS = 0x3; //8 bit
> > >> U0LCR_bit.SBS = 0x0; //1 stop bit
> > >> U0LCR_bit.PE = 0x0; //no parity
> > >> U0LCR_bit.DLAB = 0x1; //enable DLAB
> > >> //U0LCR = 0x83;
> > >>
> > >> unsigned int divisor = peripheral_clock_frequency() / (16 *
> baud);
> > >>
> > >> U0DLL = divisor & 0xFF;
> > >> U0DLM = (divisor >> 8) & 0xFF;
> > >> U0LCR &= ~0x80;
> > >>
> > >> PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
> > >> }
> > >> void uart1_init ( unsigned int baud ) {
> > >> //set Line Control Register (8 bit, 1 stop bit, no parity,
> enable DLAB)
> > >> U1LCR_bit.WLS = 0x3; //8 bit
> > >> U1LCR_bit.SBS = 0x0; //1 stop bit
> > >> U1LCR_bit.PE = 0x0; //no parity
> > >> U1LCR_bit.DLAB = 0x1; //enable DLAB
> > >> //U0LCR = 0x83;
> > >>
> > >> unsigned int divisor = peripheral_clock_frequency() / (16 *
> baud);
> > >>
> > >> U1DLL = divisor & 0xFF;
> > >> U1DLM = (divisor >> 8) & 0xFF;
> > >> U1LCR &= ~0x80;
> > >>
> > >> // PINSEL0 = (PINSEL0 & ~0xF) | 0x5;
> > >> PINSEL0 = PINSEL0 & ~0xFFF0FFFF | 0x00050000;
> > >> }
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
Martin,
thanks for your answer.

>what do you mean by this ? Is it different to the code below in the
>email ???
It is not different, just I mistakenly swapped the uart where I have problems in the call for help (I changed the subject).

>Are you just moving the character to send FIFO or are you looking /
>waiting that the previous character was sent out ?
Really I don't know for sure, I just wanted a simple method to test uart1 is working.
AFAIK the test inside the function should assure that, but since it works for the uart0 it should work for uart1.

I started wanting to use printf, but soon learned this this would be a long journey. So I decided to test the basic operation of the uarts.

This is the code I am using:

void uart0_transmit(unsigned char ch0) {
//when U0LSR_bit.THRE is 0 - U0THR contains valid data.
// while (U0LSR_bit.THRE == 0);
while (!(U0LSR & (1<<5)));
U0THR = ch0;
}
void uart1_transmit(unsigned char ch0) {
//when U1LSR_bit.THRE is 0 - U1THR contains valid data.
// while (U1LSR_bit.THRE == 0);
while (!(U1LSR & (1<<5)));
U1THR = ch0;
};

I just "created" the uart1_transmit from the uart0_transmit,
I copied all the stuff from a uart0 example.

The only difference is in the init part, where the PINSEL0 bits are different.

>code, if something is missing. For this you don't need a hex file.
>What is the advantage of a hexfile ? Do you suspect that your
>hardware or wiring of COM-Port cables is not working ?
At first yes, then I tested the pins as GPIO and they worked but
the connection with the fpga is "fixed", see page 15 of this pdf (Xylo-LM column):

http://www.knjn.com/docs/KNJN%20FX2%20ARM%20boards.pdf

The LPC2138 clock is fixed at 24MHz (provided by the FX2 Cypress chip). That's the reason I need an example suited for that speed.

I have programmed the fpga to connect the TX pin of the LPC2138 to the receiving pin of the serial port on the pc, and the transmitting port of the pc to
the RX pin of the LPC2138.

Using a known working program for uart1 I could immediately tell if something is wrong with the lpc or I need something different to use the uart1.

Giuseppe Marullo

Hello Giuseppe,

i think i have found the error. Problem is in following line:

PINSEL0 = PINSEL0 & ~0xFFF0FFFF | 0x00050000;

You need the following:

PINSEL0 = (PINSEL0 & 0xFFF0FFFF) | 0x00050000;

Not the brackets (just for better reading), but the "~".

Or you use:

PINSEL0 = (PINSEL0 & ~0x000F0000) | 0x00050000;

I prefer to do it in two times two steps:

PINSEL0 &= ~(0x3 << 16); // Reset bits, P0.8 now GPIO
PINSEL0 |= (0x1 << 16); // Set P0.8 to TXD UART1
PINSEL0 &= ~(0x3 << 18); // Reset bits, P0.9 now GPIO
PINSEL0 |= (0x1 << 18); // Set P0.9 to RXD UART1

Regards,

Martin

--- In l..., Giuseppe Marullo wrote:
>
> Martin,
> thanks for your answer.
>
> >what do you mean by this ? Is it different to the code below in
the
> >email ???
> It is not different, just I mistakenly swapped the uart where I
have problems in the call for help (I changed the subject).
>
> >Are you just moving the character to send FIFO or are you
looking /
> >waiting that the previous character was sent out ?
> Really I don't know for sure, I just wanted a simple method to test
uart1 is working.
> AFAIK the test inside the function should assure that, but since it
works for the uart0 it should work for uart1.
>
> I started wanting to use printf, but soon learned this this would
be a long journey. So I decided to test the basic operation of the
uarts.
>
> This is the code I am using:
>
> void uart0_transmit(unsigned char ch0) {
> //when U0LSR_bit.THRE is 0 - U0THR contains valid data.
> // while (U0LSR_bit.THRE == 0);
> while (!(U0LSR & (1<<5)));
> U0THR = ch0;
> }
> void uart1_transmit(unsigned char ch0) {
> //when U1LSR_bit.THRE is 0 - U1THR contains valid data.
> // while (U1LSR_bit.THRE == 0);
> while (!(U1LSR & (1<<5)));
> U1THR = ch0;
> };
>
> I just "created" the uart1_transmit from the uart0_transmit,
> I copied all the stuff from a uart0 example.
>
> The only difference is in the init part, where the PINSEL0 bits are
different.
>
> >code, if something is missing. For this you don't need a hex file.
> >What is the advantage of a hexfile ? Do you suspect that your
> >hardware or wiring of COM-Port cables is not working ?
> At first yes, then I tested the pins as GPIO and they worked but
> the connection with the fpga is "fixed", see page 15 of this pdf
(Xylo-LM column):
>
> http://www.knjn.com/docs/KNJN%20FX2%20ARM%20boards.pdf
>
> The LPC2138 clock is fixed at 24MHz (provided by the FX2 Cypress
chip). That's the reason I need an example suited for that speed.
>
> I have programmed the fpga to connect the TX pin of the LPC2138 to
the receiving pin of the serial port on the pc, and the transmitting
port of the pc to
> the RX pin of the LPC2138.
>
> Using a known working program for uart1 I could immediately tell if
something is wrong with the lpc or I need something different to use
the uart1.
>
> Giuseppe Marullo
>

Martin,

>i think i have found the error. Problem is in following line:

I did already tried this but I repeated the test just in case and it did
not work.

I run this program to test gpio functionality again, and the fpga
receives the toggles on the TXD pin:

int main (int argc, char** argv) {
PINSEL0 = 0x00000000;
IODIR0 = 0x80000100;
// uart0_init(300);
// uart1_init(300);
MAMCR = 2;
unsigned char i = 0;
while (1) {
IOSET0 = 0x80000100;
// uart0_transmit('a');
delay();
IOCLR0 = 0x80000100;
// uart1_transmit('a');
delay();
}
return 0;
}
Is there anything else to try? I don't think the uart part is broken if
I am able to toggle the pin (checked also with a multimeter and the FPGA
unconfigured so all pins are inputs).

May a wrong logical level on the RXD1 pin block the transmission?

Giuseppe

Well,
it turned out it was a way wrong definition on the UART1 registers.
I was searching for hints while I discovered some warnings about
redefinition of some registers. I never managed to learn C,
so it have should be an error from me, I was ingnoring such warnings. I
noticed that the warnings were not "simmetrical" they were not the same
number about the u0... and u1... definitions, and they should have been,
since I simply doubled the definitions.
To cut a long story short, now it works, this trick allowed me to
pinpoint the error (0xE000CXXX --> 0xE0001XXX instead of 0xE0010XXX) on
the redefinitions of the file lpc2138.h
The usual lpc21xx.h got right definitions, so this caused the
"asimmetry" of the warnings.

Thanks to Martin and all the others that tried to figure out what it
was. Now I can do really big damages with a single board that has an ARM
and a Spartan 3E that hopefully will start talk properly.

Giuseppe Marullo

PS: it was VERY stupid error, I even own a HP-16...no excuse :)