Bug Report : UART Ring Buffer : Interrupt Handler : LPCOpen v2.19 : LPC824

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Bug Report : UART Ring Buffer : Interrupt Handler : LPCOpen v2.19 : LPC824

2,896件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alexgoldstone on Fri Mar 04 10:29:20 MST 2016
The Chip_UART_SendRB function correctly disables the TXRDY interrupt when you are filling the transmit buffer.

Chip_UART_IRQRBHandler only checks the TXRDY status and does not first check if the interrupt is enabled.

This means that if you get an RX Interrupt while you are filling the FIFO then Chip_UART_IRQRBHandler incorrectly calls Chip_UART_TXIntHandlerRB causing the buffer pointers to overflow.

The Chip_UART_IRQRBHandler should be changed from:

/* UART receive/transmit interrupt handler for ring buffers */
void Chip_UART_IRQRBHandler(LPC_USART_T *pUART, RINGBUFF_T *pRXRB, RINGBUFF_T *pTXRB)
{
/* Handle transmit interrupt if enabled */
if ((Chip_UART_GetStatus(pUART) & UART_STAT_TXRDY) != 0) {
Chip_UART_TXIntHandlerRB(pUART, pTXRB);

/* Disable transmit interrupt if the ring buffer is empty */
if (RingBuffer_IsEmpty(pTXRB)) {
Chip_UART_IntDisable(pUART, UART_INTEN_TXRDY);
}
}

/* Handle receive interrupt */
Chip_UART_RXIntHandlerRB(pUART, pRXRB);
}


to:

/* UART receive/transmit interrupt handler for ring buffers */
void Chip_UART_IRQRBHandler(LPC_USART_T *pUART, RINGBUFF_T *pRXRB, RINGBUFF_T *pTXRB)
{
/* Handle transmit interrupt if enabled */
[color=#f00]if ((Chip_UART_GetIntsEnabled(pUART) & UART_INTEN_TXRDY) != 0) {[/color]
if ((Chip_UART_GetStatus(pUART) & UART_STAT_TXRDY) != 0) {
Chip_UART_TXIntHandlerRB(pUART, pTXRB);

/* Disable transmit interrupt if the ring buffer is empty */
if (RingBuffer_IsEmpty(pTXRB)) {
Chip_UART_IntDisable(pUART, UART_INTEN_TXRDY);
}
}
[color=#f00]}[/color]

/* Handle receive interrupt */
Chip_UART_RXIntHandlerRB(pUART, pRXRB);
}
ラベル(1)
2 返答(返信)

2,028件の閲覧回数
Proteus
Contributor I

Thanks for posting this alexgoldstone...  I had been unknowingly plagued by this bug but didn't manage to catch it happening till I found your thread...

0 件の賞賛
返信

2,028件の閲覧回数
lpcware
NXP Employee
NXP Employee
bump