UART1 on LPC2138

Started by thos_fernando August 27, 2009
Hello,

I have a problem that UART1 on LPC2138 is dropping characters.I am communicating with a GPRS modem to send data to a server using AT commands.I am using RTS ,by writing to the U1MCR resgister,switching it OFF in the ISR if 30 characters queue up and ON in the Getch routine when 2 characters remain to be read.This is not AUTO RTS,since LPC2138 does not support it,only LPC2138/01 does.

The problem happens only when the MODEM is sending acknowledgement data (about 230bytes) to the ARM,after the payload data has been sent to the modem by the ARM.All other data from the modem ( "OK",etc etc upto maximum 40 bytes ) are read properly.

I am able to confirm that the modem is sending the acknowledgement data completely by sniffing the Tx pin of the modem serial port on to the PC serial port using a terminal program.Its the ARM which is dropping the characters.Sometimes, I am able to get all the full packet,usually a partial part of the data from somewhere in middle and rarely no data.

To confirm the ARM hardware,I communicated it with a PC.I have written a test prog,which receives a text file of about 1kB on the modem(UART1) port and sends it out on UART0 port.This works fine,and I can see the RTS LED blinking.So I assume there is nothing wrong with my ARM hardware , and the UART routines.
The difference between my test prog (communication with PC )and the final prog(communication with modem ), is that in the final prog I have an external interrupt,then transmission of data on UART1 prior to receiving the data.Otherwise everything is the same(except the PC hardware of course).
If someone had the patience to read the above,any suggestion what I could try out ?

Cheers
Thomas

An Engineer's Guide to the LPC2100 Series

What do you do in interrupt routine? Do you change any settings of UART1?
May CPU spend too much time in interrupt so that buffer overrun may occur?



From: l... [mailto:l...] On Behalf Of
thos_fernando
Sent: 28 Astos 2009 Cuma 00:06
To: l...
Subject: [lpc2000] UART1 on LPC2138





Hello,

I have a problem that UART1 on LPC2138 is dropping characters.I am
communicating with a GPRS modem to send data to a server using AT commands.I
am using RTS ,by writing to the U1MCR resgister,switching it OFF in the ISR
if 30 characters queue up and ON in the Getch routine when 2 characters
remain to be read.This is not AUTO RTS,since LPC2138 does not support
it,only LPC2138/01 does.

The problem happens only when the MODEM is sending acknowledgement data
(about 230bytes) to the ARM,after the payload data has been sent to the
modem by the ARM.All other data from the modem ( "OK",etc etc upto maximum
40 bytes ) are read properly.

I am able to confirm that the modem is sending the acknowledgement data
completely by sniffing the Tx pin of the modem serial port on to the PC
serial port using a terminal program.Its the ARM which is dropping the
characters.Sometimes, I am able to get all the full packet,usually a partial
part of the data from somewhere in middle and rarely no data.

To confirm the ARM hardware,I communicated it with a PC.I have written a
test prog,which receives a text file of about 1kB on the modem(UART1) port
and sends it out on UART0 port.This works fine,and I can see the RTS LED
blinking.So I assume there is nothing wrong with my ARM hardware , and the
UART routines.
The difference between my test prog (communication with PC )and the final
prog(communication with modem ), is that in the final prog I have an
external interrupt,then transmission of data on UART1 prior to receiving the
data.Otherwise everything is the same(except the PC hardware of course).
If someone had the patience to read the above,any suggestion what I could
try out ?

Cheers
Thomas



Hi,

Actually it could be a hardware issue.The modem hardware seems to be latching the ARM's RTS pin low sometimes.When I unplug the modem in this condition the RTS goes up again automatically.
Has anyone seen any Modem emulation software I could run on a PC,to communicate with the ARM,and verify my assumption.

Thanks.
--- In l..., "Deniz Can Cigsar" wrote:
>
> What do you do in interrupt routine? Do you change any settings of UART1?
> May CPU spend too much time in interrupt so that buffer overrun may occur?
>
>
>
> From: l... [mailto:l...] On Behalf Of
> thos_fernando
> Sent: 28 Astos 2009 Cuma 00:06
> To: l...
> Subject: [lpc2000] UART1 on LPC2138

> Cheers
> Thomas
>
>
>
>
>
>
>