Forums

[lpc2104] uart0 doesn't emit 0x00 byte(s) :-O

Started by Pawel Sikora October 7, 2004
Hi,

I don't know what is wrong with uart0 (or my code).

testcase:

int rs232_txAvailable()
{
return ((U0LSR & bit(5)) != 0);
}

000000a0 <rs232_txAvailable>:
a0: e59f300c ldr r3, [pc, #12] ; b4
<.text+0xb4>
a4: e5930000 ldr r0, [r3]
a8: e1a002a0 mov r0, r0, lsr #5
ac: e2000001 and r0, r0, #1 ; 0x1
b0: e1a0f00e mov pc, lr
b4: 00000000 andeq r0, r0, r0

int rs232_txByte(const unsigned byte)
{
U0THR = byte;
return 1;
}

000000b8 <rs232_txByte>:
b8: e59f3008 ldr r3, [pc, #8] ; c8
<.text+0xc8>
bc: e5830000 str r0, [r3]
c0: e3a00001 mov r0, #1 ; 0x1
c4: e1a0f00e mov pc, lr
c8: 00000000 andeq r0, r0, r0

while (!rs232_txAvailable());
rs232_txByte(0x01);
while (!rs232_txAvailable());
rs232_txByte(0x02);
while (!rs232_txAvailable());
rs232_txByte(0x00);
while (!rs232_txAvailable());
rs232_txByte(0x03);

The PC-terms (and port monitor) receiving only:
0x01,0x02,0x03.
Where is the 0x00?

_______________________________




An Engineer's Guide to the LPC2100 Series


im not near anything that can specifically help, but can you check
that your PC side is not suppressing the NULL byte?
(I know VB has an option in the MSCOMM control to suppress the NULL.)

also, is the LPC configured to pad 0's (I cant remember if there is
some config option for that)...

anyway, just a thought....
pete --- In , Pawel Sikora <rzulfik@y...> wrote:
> Hi,
>
> I don't know what is wrong with uart0 (or my code).
>
> testcase:
>
> int rs232_txAvailable()
> {
> return ((U0LSR & bit(5)) != 0);
> }
>
> 000000a0 <rs232_txAvailable>:
> a0: e59f300c ldr r3, [pc, #12] ; b4
> <.text+0xb4>
> a4: e5930000 ldr r0, [r3]
> a8: e1a002a0 mov r0, r0, lsr #5
> ac: e2000001 and r0, r0, #1 ; 0x1
> b0: e1a0f00e mov pc, lr
> b4: 00000000 andeq r0, r0, r0
>
> int rs232_txByte(const unsigned byte)
> {
> U0THR = byte;
> return 1;
> }
>
> 000000b8 <rs232_txByte>:
> b8: e59f3008 ldr r3, [pc, #8] ; c8
> <.text+0xc8>
> bc: e5830000 str r0, [r3]
> c0: e3a00001 mov r0, #1 ; 0x1
> c4: e1a0f00e mov pc, lr
> c8: 00000000 andeq r0, r0, r0
>
> while (!rs232_txAvailable());
> rs232_txByte(0x01);
> while (!rs232_txAvailable());
> rs232_txByte(0x02);
> while (!rs232_txAvailable());
> rs232_txByte(0x00);
> while (!rs232_txAvailable());
> rs232_txByte(0x03);
>
> The PC-terms (and port monitor) receiving only:
> 0x01,0x02,0x03.
> Where is the 0x00? >
>
> _______________________________
>