- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a project that uses the UART. With the buffer set to 4 bytes it works fine, reading the status and the byte under polling software control (no address bits, interrupts or anything complicated). When I expand the RX buffer beyond the 4 bytes, my software stops "seeing" any data. In other words the RX_STS_FIFO_NOTEMPTY does not appear to be set when data is present at the Rx pin. I am unclear as to what I need to do to be able to read the buffer. I cannot find an example anywhere. The data sheet says "Buffer sizes greater than 4 bytes require the use of interrupts to handle moving the data from the receive FIFO into this buffer. The UART_GetChar() or UART_ReadRXData() functions get data from the correct source without any changes to your top-level firmware". Am I supposed to be writing this interrupt driver? The implication to me is that it is added in the build process, otherwise if I am doing this myself why would I need to specify the size of the buffer for the component.
In short, what do I need to do to get the UART to work with a buffer greater than 4 bytes?
As a secondary question (and perhaps associated), the data sheet also says "When the RX buffer size is greater than 4 bytes, the Internal RX Interrupt ISR is automatically enabled and the RX-On Byte Received interrupt source is selected and disabled for use..." I find this a little confusing. Is the interrupt permanently enabled or disabled? Can you use it in the above interrupt driver?
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When the buffer is increased to morer than 4 bytes the INTERNAL interrupt is automatically enabled. The service-routine will now retrieve any characters and store them in the buffer. So there will never be a statusbit indicating a character to be ready to be seen.
There are two choices:
1st. Write your own interrupt driven buffer-handling (circular buffer) which is a pretty good exercise for learning (smile)
2nd. Poll the buffer for characters stored and retrieve them. There is an API named UART_GetRxBufferSize() which does not return the allocated size of the buffer as one would suggest, but returns the number of characters stored so far. With UART_GetByte() you may retrieve the characters.
Happy coding
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When the buffer is increased to morer than 4 bytes the INTERNAL interrupt is automatically enabled. The service-routine will now retrieve any characters and store them in the buffer. So there will never be a statusbit indicating a character to be ready to be seen.
There are two choices:
1st. Write your own interrupt driven buffer-handling (circular buffer) which is a pretty good exercise for learning (smile)
2nd. Poll the buffer for characters stored and retrieve them. There is an API named UART_GetRxBufferSize() which does not return the allocated size of the buffer as one would suggest, but returns the number of characters stored so far. With UART_GetByte() you may retrieve the characters.
Happy coding
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob
Thanks- does this mean that the error detection on a byte by byte basis is lost? Obviously you would expect there to be no OE/FE as these would be covered by the rxBufferLoopDetect and rxBufferOverflow variables, but what about PE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Within the interrupt handler of the UART is a stub where you may insert your own error-handling, have a look into the file
UART_Int.c near line 75
Bob