Any difference between UART STAT and INTSTAT when reading interrupt flags??

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Any difference between UART STAT and INTSTAT when reading interrupt flags??

1,456 Views
jdupre
Contributor II

The UARTS in the LPC15xx have both a STAT and an INTSTAT register.

Is there any difference in reading a UART's STAT register vs. INTSTAT?

Put another way, if an interrupt flag bit is set in INTSTAT will it always be set in STAT also?

Is there any reason to use INTSTAT instead of STAT in an ISR?  (Understanding that INTSTAT is read only and may include bits that are not interrupt flags.)

Labels (2)
Tags (1)
0 Kudos
Reply
2 Replies

1,028 Views
soledad
NXP Employee
NXP Employee

Hi Joseph,

It is  only for simplify software.

The STAT register primarily provides a complete set of USART status flags for software to read. Flags other than read-only flags may be cleared by writing ones to corresponding bits of STAT. Interrupt status flags that are read-only and cannot be cleared by software, can be masked using the INTENCLR register.

The error flags for received noise, parity error, framing error, and overrun are set immediately upon detection and remain set until cleared by software action in STAT.

Table. USART registerName = STAT addressOffset = 0x008
BitSymbolDescriptionReset valueAccess
0RXRDYReceiver Ready flag. When 1, indicates that data is available to be read from the receiver buffer. Cleared after a read of the RXDAT or RXDATSTAT registers.0RO
1RXIDLEReceiver Idle. When 0, indicates that the receiver is currently in the process of receiving data. When 1, indicates that the receiver is not currently in the process of receiving data.1RO
2TXRDYTransmitter Ready flag. When 1, this bit indicates that data may be written to the transmit buffer. Previous data may still be in the process of being transmitted. Cleared when data is written to TXDAT. Set when the data is moved from the transmit buffer to the transmit shift register.1RO
3TXIDLETransmitter Idle. When 0, indicates that the transmitter is currently in the process of sending data.When 1, indicate that the transmitter is not currently in the process of sending data.1RO
4CTSThis bit reflects the current state of the CTS signal, regardless of the setting of the CTSEN bit in the CFG register. This will be the value of the CTS input pin unless loopback mode is enabled.NARO
5DELTACTSThis bit is set when a change in the state is detected for the CTS flag above. This bit is cleared by software.0W1
6TXDISINT

Transmitter Disabled Interrupt flag. When 1, this bit indicates that the USART transmitter is fully idle after being disabled via the TXDIS in the CFG register (TXDIS = 1).

0RO
7-Reserved. Read value is undefined, only zero should be written.NANA
8OVERRUNINTOverrun Error interrupt flag. This flag is set when a new character is received while the receiver buffer is still in use. If this occurs, the newly received character in the shift register is lost.0W1
9-Reserved. Read value is undefined, only zero should be written.NANA
10RXBRKReceived Break. This bit reflects the current state of the receiver break detection logic. It is set when the Un_RXD pin remains low for 16 bit times. Note that FRAMERRINT will also be set when this condition occurs because the stop bit(s) for the character would be missing. RXBRK is cleared when the Un_RXD pin goes high.0RO
11DELTARXBRKThis bit is set when a change in the state of receiver break detection occurs. Cleared by software.0W1
12STARTThis bit is set when a start is detected on the receiver input. Its purpose is primarily to allow wake-up from Deep-sleep or Power-down mode immediately when a start is detected. Cleared by software.0W1
13FRAMERRINTFraming Error interrupt flag. This flag is set when a character is received with a missing stop bit at the expected location. This could be an indication of a baud rate or configuration mismatch with the transmitting source.0W1
14PARITYERRINTParity Error interrupt flag. This flag is set when a parity error is detected in a received character..0W1
15RXNOISEINTReceived Noise interrupt flag. Three samples of received data are taken in order to determine the value of each received data bit, except in synchronous mode. This acts as a noise filter if one sample disagrees. This flag is set when a received data bit contains one disagreeing sample. This could indicate line noise, a baud rate or character format mismatch, or loss of synchronization during data reception.0W1
31:16-Reserved. Read value is undefined, only zero should be written.NANA
Note: RO = Read-only, W1 = write 1 to clear.

The read-only INTSTAT register provides a view of those interrupt flags that are currently enabled. This can simplify software handling of interrupts.

Table. USART registerName = INTSTAT addressOffset = 0x024
BitSymbolDescriptionReset Value
0RXRDYReceiver Ready flag.0
1-Reserved. Read value is undefined, only zero should be written.NA
2TXRDYTransmitter Ready flag.1
4:3-Reserved. Read value is undefined, only zero should be written.NA
5DELTACTSThis bit is set when a change in the state of the CTS input is detected.0
6TXDISINTTransmitter Disabled Interrupt flag.0
7-Reserved. Read value is undefined, only zero should be written.NA
8OVERRUNINTOverrun Error interrupt flag.0
10:9-Reserved. Read value is undefined, only zero should be written.NA
11DELTARXBRKThis bit is set when a change in the state of receiver break detection occurs.0
12STARTThis bit is set when a start is detected on the receiver input.0
13FRAMERRINTFraming Error interrupt flag.0
14PARITYERRINTParity Error interrupt flag.0
15RXNOISEINTReceived Noise interrupt flag.0
31:16-Reserved. Read value is undefined, only zero should be written.NA

Have a great day,
Sol

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,028 Views
alikarakaş
Contributor I

you say in datasheet :

TXRDYTransmitter Ready flag. When 1, this bit indicates that data may be written to the transmit buffer. Previous data may still be in the process of being transmitted. Cleared when data is written to TXDAT. Set when the data is moved from the transmit buffer to the transmit shift register.

But how can i set in main loop im using this code like this :

while((Chip_UARTN_GetStatus(LPC_USART1) & UARTN_STAT_TXRDY) != 0)
{ LPC_USART1->TXDATA = (uint32_t) 0x10|0x100; }
_delay_ms(10);
while((Chip_UARTN_GetStatus(LPC_USART1) & UARTN_STAT_TXRDY) != 0)
{ LPC_USART1->TXDATA = (uint32_t) 0x01&~0x100; }

 for 9 bit transmission. İf i cant write delay function code is passed

0 Kudos
Reply