Content originally posted in LPCWare by brattchess on Sun Jan 25 06:32:43 MST 2015
Hello,
I changed it:
LPC_UART->IER = IER_RBR | IER_THRE | IER_RLS;/* Enable UART interrupt */
void UART_IRQHandler(void){
uint8_t Dummy = Dummy;
uint8_t IIRValue = LPC_UART->IIR;
uint8_t RBRValue = LPC_UART->RBR;
LPC_UART->FCR &= ~0x31;
LPC_UART->FCR |= 0x01;
_changeValueDebug(DEBUG_PORT,DEBUG_BIT);
IIRValue >>= 1;/* skip pending bit in IIR */
IIRValue &= 0x07;/* check bit 1~3, interrupt identification */
if (IIRValue == IIR_RLS){/* Receive Line Status */
uint8_t LSRValue = LPC_UART->LSR;
/* Receive Line Status */
if (LSRValue & (LSR_OE | LSR_PE | LSR_FE | LSR_RXFE | LSR_BI)){
/* There are errors or break interrupt */
/* Read LSR will clear the interrupt */
UARTStatus = LSRValue;
Dummy = LPC_UART->RBR;/* Dummy read on RX to clear interrupt, then bail out */
return;
}
if (LSRValue & LSR_RDR)/* Receive Data Ready */
{
/* If no error on RLS, normal ready, save into the data buffer. */
/* Note: read RBR will clear the interrupt */
comm_buffer_in_LULA_BUS[comm_buffer_in_idx_LULA_BUS] = RBRValue;
comm_buffer_in_idx_LULA_BUS++;
}
}else if(IIRValue == IIR_RDA){/* Receive Data Available */
//comm_buffer_in_LULA_BUS[comm_buffer_in_idx_LULA_BUS] = LPC_UART->RBR;
comm_buffer_in_LULA_BUS[comm_buffer_in_idx_LULA_BUS] = RBRValue;
comm_buffer_in_idx_LULA_BUS++;
if( comm_buffer_in_idx_LULA_BUS >= 3 /*&&
comm_buffer_in_LULA_BUS[comm_buffer_in_idx_LULA_BUS-2]== 0x0D &&
comm_buffer_in_LULA_BUS[comm_buffer_in_idx_LULA_BUS-1]== 0x0A*/ ){
_changeValueDebug(LED_PORT,LED_BIT);
//_changeValueDebug(DEBUG_PORT,DEBUG_BIT);
}
if( comm_buffer_in_idx_LULA_BUS >= NUM_BYTES_BUFFER_IN_LULA_BUS ){
comm_buffer_in_idx_LULA_BUS = 0;
}
/*if( comm_buffer_in_idx_LULA_BUS >= NUM_BYTES_BUFFER_LULA_BUS ){
comm_buffer_in_idx_LULA_BUS = 0;
_changeValueDebug(DEBUG_PORT,DEBUG_BIT);
}*/
}else if(IIRValue == IIR_CTI){/* Character timeout indicator */
//_changeValueDebug();
}else if (IIRValue == IIR_THRE){/* THRE, transmit holding register empty */
if( comm_buffer_out_idx_LULA_BUS >= comm_buffer_out_len_LULA_BUS ){ // if the frame is sent
}else{ SEND_BYTE_LULA_BUS; }
}
//_changeValueDebug(DEBUG_PORT,DEBUG_BIT);
return;
}
I have not any interrupt by IIR_RLS.