Yahoo Groups archive

Lpc2000

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

Message

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




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. 
> ________________________________
>

Attachments

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.