Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

More UART woes

More UART woes

2005-07-21 by vajper0

Still working on my UART driver for the LPC2138. Now I'm having
problems with lost Tx data from the LPC to a PC. I don't have a clue
about what I'm doing wrong and I haven't found anything on the web
indicating this is a common problem.

The problem is that sometimes one or a few bytes that I write to the
THR don't show up at the PC. If there is data to be transmitted I
write one byte to the THR (first checking the LSR5 to be really shure
there is  room for a byte). Then I write 16 bytes to the THR every
time I get a THR IRQ (also here checking LSR5 to be 100% sure the FIFO
is empty).

Doing the above results in lost data at the other end. This happens
approximately every 20-50kbytes. I've tried this at different speeds,
even as low as 57600bps. The FIFOs are enabled.

Am I missing something?

/PH

Re: [lpc2000] More UART woes

2005-07-22 by Mohan K

Hi all/PH,
I am also facing the same problem. 
When I try to send the 8+Kbytes of data, on the other end am loosing
some bytes. The speed of transmission is 115200kbps. The driver uses a
circular buffer for transmission. Following is the code used to
transfer 8Kbytes of data:

int uart1Putch(int ch)
{
	//#ifdef UART0_TX_INT_MODE
  	uint16_t temp;
	//  unsigned cpsr;
	temp = (uart1_tx_insert_idx + 1) % UART1_TX_BUFFER_SIZE;
	if(temp == uart1_tx_extract_idx)
    	return -1;                          // no room
	  //cpsr = disableIRQ();                  // disable global interrupts
  	U1IER &= ~UIER_ETBEI;                 // disable TX interrupts
  	//restoreIRQ(cpsr);                     // restore global interrupts
	// check if in process of sending data
  	if(uart1_tx_running)
    {
    	// add to queue
     	uart1_tx_buffer[uart1_tx_insert_idx] = (uint8_t)ch;
     	uart1_tx_insert_idx = temp;
    }
  	else
    {
    	// set running flag and write to output register
     	uart1_tx_running = 1;
	 	U1THR = (uint8_t)ch;
    }
	//cpsr = disableIRQ();                  // disable global interrupts
  	U1IER |= UIER_ETBEI;              // enable TX interrupts
  	//restoreIRQ(cpsr);                     // restore global interrupts
	return (uint8_t)ch;
}

Am i missing anything? Please advice me.

Thanks & Regards,
Mohan
Show quoted textHide quoted text
On 7/21/05, vajper0 <ph@...> wrote:
> Still working on my UART driver for the LPC2138. Now I'm having
> problems with lost Tx data from the LPC to a PC. I don't have a clue
> about what I'm doing wrong and I haven't found anything on the web
> indicating this is a common problem.
> 
> The problem is that sometimes one or a few bytes that I write to the
> THR don't show up at the PC. If there is data to be transmitted I
> write one byte to the THR (first checking the LSR5 to be really shure
> there is  room for a byte). Then I write 16 bytes to the THR every
> time I get a THR IRQ (also here checking LSR5 to be 100% sure the FIFO
> is empty).
> 
> Doing the above results in lost data at the other end. This happens
> approximately every 20-50kbytes. I've tried this at different speeds,
> even as low as 57600bps. The FIFOs are enabled.
> 
> Am I missing something?
> 
> /PH
> 
> 
> 
> ________________________________
> YAHOO! GROUPS LINKS 
> 
>  Visit your group "lpc2000" on the web.
>   
>  To unsubscribe from this group, send an email to:
>  lpc2000-unsubscribe@yahoogroups.com
>   
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>  To unsubscribe from this group, send an email to:
>  lpc2000-unsubscribe@...m
>   
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
> ________________________________
>

RE: [lpc2000] More UART woes

2005-07-22 by Tim Wade

Hi

I really wouldn't blame the LPC -- it is very likely that the PC is
loosing the characters...

We had a FAST PC logging data coming from a GPS receiver at 56K, so not
very fast really, but come hell nor high water we could NOT get the PC
to collect all the characters. Eventually we got a HIGH QUALITY
USB<=>RS232 interface and that worked fine... Windows is NOT very real
time at all... In fact it is almost completely useless for any sort of
time constrained operation at all. Just because it is popular does not
mean that it works very well...
Show quoted textHide quoted text
-----Original Message-----
From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com] On Behalf
Of Mohan K
Sent: Friday, 22 July 2005 11:45 AM
To: lpc2000@yahoogroups.com
Cc: ph@...
Subject: Re: [lpc2000] More UART woes

Hi all/PH,
I am also facing the same problem. 
When I try to send the 8+Kbytes of data, on the other end am loosing
some bytes. The speed of transmission is 115200kbps. The driver uses a
circular buffer for transmission. Following is the code used to transfer
8Kbytes of data:

int uart1Putch(int ch)
{
	//#ifdef UART0_TX_INT_MODE
  	uint16_t temp;
	//  unsigned cpsr;
	temp = (uart1_tx_insert_idx + 1) % UART1_TX_BUFFER_SIZE;
	if(temp == uart1_tx_extract_idx)
    	return -1;                          // no room
	  //cpsr = disableIRQ();                  // disable global
interrupts
  	U1IER &= ~UIER_ETBEI;                 // disable TX interrupts
  	//restoreIRQ(cpsr);                     // restore global
interrupts
	// check if in process of sending data
  	if(uart1_tx_running)
    {
    	// add to queue
     	uart1_tx_buffer[uart1_tx_insert_idx] = (uint8_t)ch;
     	uart1_tx_insert_idx = temp;
    }
  	else
    {
    	// set running flag and write to output register
     	uart1_tx_running = 1;
	 	U1THR = (uint8_t)ch;
    }
	//cpsr = disableIRQ();                  // disable global
interrupts
  	U1IER |= UIER_ETBEI;              // enable TX interrupts
  	//restoreIRQ(cpsr);                     // restore global
interrupts
	return (uint8_t)ch;
}

Am i missing anything? Please advice me.

Thanks & Regards,
Mohan




On 7/21/05, vajper0 <ph@...> wrote:
> Still working on my UART driver for the LPC2138. Now I'm having 
> problems with lost Tx data from the LPC to a PC. I don't have a clue 
> about what I'm doing wrong and I haven't found anything on the web 
> indicating this is a common problem.
> 
> The problem is that sometimes one or a few bytes that I write to the 
> THR don't show up at the PC. If there is data to be transmitted I 
> write one byte to the THR (first checking the LSR5 to be really shure 
> there is  room for a byte). Then I write 16 bytes to the THR every 
> time I get a THR IRQ (also here checking LSR5 to be 100% sure the FIFO

> is empty).
> 
> Doing the above results in lost data at the other end. This happens 
> approximately every 20-50kbytes. I've tried this at different speeds, 
> even as low as 57600bps. The FIFOs are enabled.
> 
> Am I missing something?
> 
> /PH
> 
> 
> 
> ________________________________
> YAHOO! GROUPS LINKS
> 
>  Visit your group "lpc2000" on the web.
>   
>  To unsubscribe from this group, send an email to:
>  lpc2000-unsubscribe@yahoogroups.com
>   
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>  To unsubscribe from this group, send an email to:
>  lpc2000-unsubscribe@yahoogroups.com
>   
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
> ________________________________
>


 
Yahoo! Groups Links



 


--
This email is confidential and intended solely for the use of the individual to whom it is addressed.  
Any views or opinions presented are solely those of the author and do not necessarily represent those of NAUTRONIX LTD.

If you are not the intended recipient, you have received this email in error and use, dissemination, forwarding, printing, or copying of this email is strictly prohibited.  If you have received this email in error please contact the sender.   

Although our computer systems use active virus protection software, and we take various measures to reduce the risk of viruses being transmitted in e-mail messages and attachments sent from this company, we cannot guarantee that such e-mail messages and attachments are free from viruses on receipt.  It is a condition of our using e-mail to correspond with you, that any and all liability on our part arising directly or indirectly out of any virus is excluded.  Please ensure that you run virus checking software on all e-mail messages and attachments before reading them.

Re: More UART woes

2005-07-22 by vajper0

--- In lpc2000@yahoogroups.com, "Tim Wade" <tim.wade@n...> wrote:

> I really wouldn't blame the LPC -- it is very likely that the PC is
> loosing the characters...
> 
> We had a FAST PC logging data coming from a GPS receiver at 56K, so not
> very fast really, but come hell nor high water we could NOT get the PC
> to collect all the characters. Eventually we got a HIGH QUALITY
> USB<=>RS232 interface and that worked fine... Windows is NOT very real
> time at all... In fact it is almost completely useless for any sort of
> time constrained operation at all. Just because it is popular does not
> mean that it works very well...

Exactly what I found out short after my post! Switched to a known good
(and really expensive) UART card and now it seems to work fine :)
Crappy old 16550 UARTs...

/PH

Re: [lpc2000] More UART woes

2005-07-22 by Mohan K

Hi,
I Linux-2.16 PC to collect the data sent by the LPC 2138. The 8KB data
said in the previous mail is splitted in to 128 bytes of chunks and
then transferred from LPC. If the delay is inserted between the
chunks, it is working without any problem. If delay is removed then
the PC is loosing the data.

Thanks & Regards,
Mohan
Show quoted textHide quoted text
On 7/22/05, Tim Wade <tim.wade@....au> wrote:
>  Hi 
>  
>  I really wouldn't blame the LPC -- it is very likely that the PC is 
>  loosing the characters... 
>  
>  We had a FAST PC logging data coming from a GPS receiver at 56K, so not 
>  very fast really, but come hell nor high water we could NOT get the PC 
>  to collect all the characters. Eventually we got a HIGH QUALITY 
>  USB<=>RS232 interface and that worked fine... Windows is NOT very real 
>  time at all... In fact it is almost completely useless for any sort of 
>  time constrained operation at all. Just because it is popular does not 
>  mean that it works very well... 
> 
>  
>  
>  
>  -----Original Message----- 
>  From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com] On Behalf 
>  Of Mohan K 
>  Sent: Friday, 22 July 2005 11:45 AM 
>  To: lpc2000@yahoogroups.com 
>  Cc: ph@... 
>  Subject: Re: [lpc2000] More UART woes 
>  
>  Hi all/PH, 
>  I am also facing the same problem. 
>  When I try to send the 8+Kbytes of data, on the other end am loosing 
>  some bytes. The speed of transmission is 115200kbps. The driver uses a 
>  circular buffer for transmission. Following is the code used to transfer 
>  8Kbytes of data: 
>  
>  int uart1Putch(int ch) 
>  { 
>        //#ifdef UART0_TX_INT_MODE 
>          uint16_t temp; 
>        //  unsigned cpsr; 
>        temp = (uart1_tx_insert_idx + 1) % UART1_TX_BUFFER_SIZE; 
>        if(temp == uart1_tx_extract_idx) 
>            return -1;                          // no room 
>          //cpsr = disableIRQ();                  // disable global 
>  interrupts 
>          U1IER &= ~UIER_ETBEI;                 // disable TX interrupts 
>          //restoreIRQ(cpsr);                     // restore
> global 
>  interrupts 
>        // check if in process of sending data 
>          if(uart1_tx_running) 
>      { 
>            // add to queue 
>             uart1_tx_buffer[uart1_tx_insert_idx] =
> (uint8_t)ch; 
>             uart1_tx_insert_idx = temp; 
>      } 
>          else 
>      { 
>            // set running flag and write to output register 
>             uart1_tx_running = 1; 
>              U1THR = (uint8_t)ch; 
>      } 
>        //cpsr = disableIRQ();                  // disable global 
>  interrupts 
>          U1IER |= UIER_ETBEI;              // enable TX interrupts 
>          //restoreIRQ(cpsr);                     // restore
> global 
>  interrupts 
>        return (uint8_t)ch; 
>  } 
>  
>  Am i missing anything? Please advice me. 
>  
>  Thanks & Regards, 
>  Mohan 
>  
>  
>  
>  
>  On 7/21/05, vajper0 <ph@...> wrote: 
>  > Still working on my UART driver for the LPC2138. Now I'm having 
>  > problems with lost Tx data from the LPC to a PC. I don't have a clue 
>  > about what I'm doing wrong and I haven't found anything on the web 
>  > indicating this is a common problem. 
>  > 
>  > The problem is that sometimes one or a few bytes that I write to the 
>  > THR don't show up at the PC. If there is data to be transmitted I 
>  > write one byte to the THR (first checking the LSR5 to be really shure 
>  > there is  room for a byte). Then I write 16 bytes to the THR every 
>  > time I get a THR IRQ (also here checking LSR5 to be 100% sure the FIFO 
>  
>  > is empty). 
>  > 
>  > Doing the above results in lost data at the other end. This happens 
>  > approximately every 20-50kbytes. I've tried this at different speeds, 
>  > even as low as 57600bps. The FIFOs are enabled. 
>  > 
>  > Am I missing something? 
>  > 
>  > /PH 
>  > 
>  > 
>  > 
>  > ________________________________ 
>  > YAHOO! GROUPS LINKS 
>  > 
>  >  Visit your group "lpc2000" on the web. 
>  >   
>  >  To unsubscribe from this group, send an email to: 
>  >  lpc2000-unsubscribe@yahoogroups.com 
>  >   
>  >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>  >  To unsubscribe from this group, send an email to: 
>  >  lpc2000-unsubscribe@yahoogroups.com 
>  >   
>  >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>  >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>  > ________________________________ 
>  > 
>  
>  
>  
>  Yahoo! Groups Links 
>  
>  
>  
>  
>  
>  
>  -- 
>  This email is confidential and intended solely for the use of the
> individual to whom it is addressed.  
>  Any views or opinions presented are solely those of the author and do not
> necessarily represent those of NAUTRONIX LTD. 
>  
>  If you are not the intended recipient, you have received this email in
> error and use, dissemination, forwarding, printing, or copying of this email
> is strictly prohibited.  If you have received this email in error please
> contact the sender.   
>  
>  Although our computer systems use active virus protection software, and we
> take various measures to reduce the risk of viruses being transmitted in
> e-mail messages and attachments sent from this company, we cannot guarantee
> that such e-mail messages and attachments are free from viruses on receipt. 
> It is a condition of our using e-mail to correspond with you, that any and
> all liability on our part arising directly or indirectly out of any virus is
> excluded.  Please ensure that you run virus checking software on all e-mail
> messages and attachments before reading them. 
>  
>  ________________________________
>  YAHOO! GROUPS LINKS 
>  
>  
>  Visit your group "lpc2000" on the web.
>   
>  To unsubscribe from this group, send an email to:
>  lpc2000-unsubscribe@yahoogroups.com
>   
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>  
>  ________________________________
>

Re: More UART woes

2005-07-24 by Owen Mooney

Dont forget that part of the windows API allows you to extend the size of the uart buffers.
They are 4096 by default I think, but I always stretch them out to about 65K and life gets easier.

For large transfers I will typicaly send about 4k then wait for a single ack character
from the PC. You don't loose much speed and you know that the data gets there.

owen

Subject: 

Hi,
I Linux-2.16 PC to collect the data sent by the LPC 2138. The 8KB data
said in the previous mail is splitted in to 128 bytes of chunks and
then transferred from LPC. If the delay is inserted between the
chunks, it is working without any problem. If delay is removed then
the PC is loosing the data.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.