This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I have a question about the UART interrupt.
I got the interrupt factor by the following procedure.
(1) Acquire the value of the UARTMIS register
(2) Set to UARTICR and clear the interrupt flag
(3) Acquire the value of the UARTRSR register
(4) Set 0 in the UARTECR register and clear it.
It was 0x000080 (FEMIS) when acquired by the UARTMIS register in the UART interrupt processing.
When I got the value of the UARTRSR register, I got 0x00000000.
From (1), the cause of the interrupt was FEMIS, so I thought that FEMIS (0x00000001) would be set in the UARTRSR register.
Is there something wrong with the procedure?
Thanks,
Koki
Hi Koki,
Have you already run the UART example code on your broad and find all the functions works fine?
https://dev.ti.com/tirex/explore/node?node=ADlQUxtK5.llsv2QiWufHA__J4.hfJy__LATEST
Best regards,
Cash Hao
Hi, Cash
Yes, I would like to know if the procedure for getting the Receive Status of the UARTRSR register is correct above.
Thanks,
Koki
Hi Koki,
This procedure looks good for me. However, I still recommend you to run the example code first to avoid unpredicted issues.
Best regards,
Cash Hao
Hi, Cash Hao
This sample (uart_echo) seems to be the process of sending the received single character, and I don't think it is possible to confirm the UART error (framing error).
Is there any good way to verify the behavior of the framing error?
Thanks,
Koki
Hi,
If you observe any UART error, you should get the error code in the UARTECR register. You could confirm the framing error by the check the bit 0 of the UARTECR.
Best regards,
Cash Hao
Hi,
Yes, I understand what you are saying.
However, from the sample code it seems that I can't get a "framing error".
Because the code doesn't cause framing errors.
Is there any good way to verify the behavior of the framing error?
Thanks,
Koki
Hi Koki,
Okay, you are now trying to get a framing error. Am I understanding this correctly?
Best regards,
Cash Hao
Hi Koki,
Based on the definition of the framing error.
"A UART will detect a framing error when it does not see a "stop" bit at the expected "stop" bit time. As the "start" bit is used to identify the beginning of an incoming character, its timing is a reference for the remaining bits. If the data line is not in the expected state (high) when the "stop" bit is expected (according to the number of data and parity bits for which the UART is set), the UART will signal a framing error. A "break" condition on the line is also signaled as a framing error."
If you want to generate a framing error, you need to send the data without a stop bit.
Best regards,
Cash Hao
Hi,
I got the value of UARTRSR before clearing UARTICR.
But the situation was the same, the value of UARTRSR was 0x00000000.
(The value of the UARTMIS register is 0x00000280)
The following is the source code of the part that is confirmed by interrupt.
void Uart_InterruptPeripheral(void) { uint32 ui32IntStatus; // interrupt status uint8 ui8IntFlags = 0x00U; // interrupt flag uint32 ui32UartError = 0x00000000U; // get UART Error uint8 ui8UartError = 0x00U; // UART Error // Get interrupt factors (UARTMIS register) ui32IntStatus = UARTIntStatus(UART2_BASE, UART_REGISTER_UARTMIS); // UART error interrupt judgment if (((ui32IntStatus & (uint32)UART_RIS_OERIS) == (uint32)UART_RIS_OERIS) || // UART Overrun Error Raw Interrupt Status ((ui32IntStatus & (uint32)UART_RIS_BERIS) == (uint32)UART_RIS_BERIS) || // UART Break Error Raw Interrupt Status ((ui32IntStatus & (uint32)UART_RIS_PERIS) == (uint32)UART_RIS_PERIS) || // UART Parity Error Raw Interrupt Status ((ui32IntStatus & (uint32)UART_RIS_FERIS) == (uint32)UART_RIS_FERIS)) // UART Framing Error Raw Interrupt Status { // UART error interrupt flag ON ui8RetIntFlags |= 0x01; } else { // Do Nothing } // Clear interrupt factors UARTIntClear(UART2_BASE, ui32IntStatus); // UART error interrupt if ((ui8IntFlags & 0x01) == 0x01) { // Get UART Error ui32UartError = UARTRxErrorGet(UART2_BASE); // UART Overrun Error judgement if ((ui32UartError & (uint32)UART_RXERROR_OVERRUN) == (uint32)UART_RXERROR_OVERRUN) { // UART Overrun Error setting ui8UartError |= 0x01U; } else { // Do Nothing } // UART Break Error judgement if ((ui32UartError & (uint32)UART_RXERROR_BREAK) == (uint32)UART_RXERROR_BREAK) { // UART Break Error setting ui8UartError |= 0x02U; } else { // Do Nothing } // UART Parity Error judgement if ((ui32UartError & (uint32)UART_RXERROR_PARITY) == (uint32)UART_RXERROR_PARITY) { // UART Parity Error setting ui8UartError |= 0x04U; } else { // Do Nothing } // UART Framing Error judgement if ((ui32UartError & (uint32)UART_RXERROR_FRAMING) == (uint32)UART_RXERROR_FRAMING) { // UART Framing Error setting ui8UartError |= 0x08U; } else { // Do Nothing } // UART Error clear UARTRxErrorClear(UART2_BASE); } }