Here’s the issue I’m having.
I receive data from a device to my lpc2378 chip and then re-echo it back to my pc to verify the data that I’ve received is correct.
The data that I receive is “112233” which to me is 3 bytes of data. Unfortunately it only seems to get “112” which is 3 chars to me.
What I’m trying to do is fairly clear here but for what ever reason it only seems to grab 3 chars at a time when it should be 6 chars.
I’m using interrupts and a custom function for grabbing the data from the buffer.
int uart0GetByte(void)
{
#ifdef UART0_RX_INT_MODE
	  unsigned cpsr;
	  int ch;
	  if (uart0_rx_insert_idx == uart0_rx_extract_idx) // check if character is available
		  return -1;
	  cpsr = disableIRQ();                  // disable global interrupts
	  restoreIRQ(cpsr);                     // restore global interrupts
	  ch = uart0_rx_buffer[uart0_rx_extract_idx++]; // get character, bump pointer
	  uart0_rx_extract_idx %= UART0_RX_BUFFER_SIZE; // limit the pointer
	  return ch;
	#else
	  if (U0LSR & ULSR_RDR)                 // check if character is available
		  ch = U0RBR;
	    return ch;                       // return character
	  return -1;
	#endif
}
int* uart0Read(void)
{
	static int rx_data[255];
	int byte;
	int rx_size = 0;
	// Get Rest of Bytes
	do {
		if ((byte = uart0GetByte()) >=0) {
			rx_data[rx_size++] = byte;
		}
	} while (rx_size != 3);
	return rx_data;
}
const int *uart0Putb(const int *string)
{
  register int ch;
  while ((ch = *string) && (uart0Putch(ch) >= 0))
    string++;
  return string;
}
void uart0ISR(void)
{
  uint8_t iid;
  // perform proper ISR entry so thumb-interwork works properly
  ISR_ENTRY();
  // loop until not more interrupt sources
  while (((iid = U0IIR) & UIIR_NO_INT) == 0)
    {
    // identify & process the highest priority interrupt
    switch (iid & UIIR_ID_MASK)
      {
      case UIIR_RLS_INT:                // Receive Line Status
        U0LSR;                          // read LSR to clear
        break;
#ifdef UART0_RX_INT_MODE
      case UIIR_CTI_INT:                // Character Timeout Indicator
      case UIIR_RDA_INT:                // Receive Data Available
      do
          {
          uint16_t temp;
          // calc next insert index & store character
          temp = (uart0_rx_insert_idx + 1) % UART0_RX_BUFFER_SIZE;
          uart0_rx_buffer[uart0_rx_insert_idx] = U0RBR;
          // check for more room in queue
          if (temp != uart0_rx_extract_idx)
            uart0_rx_insert_idx = temp; // update insert index
          }
        while (U0LSR & ULSR_RDR);
        break;
#endif
#ifdef UART0_TX_INT_MODE
      case UIIR_THRE_INT:               // Transmit Holding Register Empty
        while (U0LSR & ULSR_THRE)
          {
          // check if more data to send
          if (uart0_tx_insert_idx != uart0_tx_extract_idx)
            {
            U0THR = uart0_tx_buffer[uart0_tx_extract_idx++];
            uart0_tx_extract_idx %= UART0_TX_BUFFER_SIZE;
            }
          else
            {
            // no
            uart0_tx_running = 0;       // clear running flag
            break;
            }
          }
        break;
#endif // UART0_TX_INT_MODE
      default:                          // Unknown
        U0LSR;
        U0RBR;
        break;
      }
    }
  VICVectAddr = 0x00000000;             // clear this interrupt from the VIC
  ISR_EXIT();                           // recover registers and return
}
#endif // defined(UART0_TX_INT_MODE) || defined(UART0_RX_INT_MODE)
#endif // UART0_SUPPORT
Any reason why the above code returns chars and not bytes and what would be the solution to this ?