- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone
I'm trying to understand the UART SCB with interrupts.
I'm using SCB instead of UDB because all my UDB resources are used for other purposes in my design and I only have PSoC 4200 for testing.
It is not clear to me why interrupt is firing twice, even if i send only one byte there is always a second interrupt that always give me a byte with value 0x00.
Also if I send three consecutive bytes, the first three byte received are OK and there is always a last byte with value 0x00(Zero).
Trying with debugger I can see the said behavior setting a watch point in the buffer array and a break point on the ISR.
Is there a way to get rid of this "false" interrupt?
The Data Sheet is not clear for me 😞
Any advice will be very welcome.
Regards
Luis
Solved! Go to Solution.
- Labels:
-
PSoC 4 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @LuNo_297436 , can you try to first remove the byte from the RX FIFO and then clear the interrupt? Let me know if you still face issues. Also, since you are checking for RX FIFO not empty, it is better to check the no. of entries in the RX FIFO using UART_SpiUartGetRxBufferSize(), and remove the data from FIFO until this reads zero. After it reads 0, it is safe to clear the RX FIFO not empty interrupt. This will prevent the ISR from firing again.
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @LuNo_297436 , can you try to first remove the byte from the RX FIFO and then clear the interrupt? Let me know if you still face issues. Also, since you are checking for RX FIFO not empty, it is better to check the no. of entries in the RX FIFO using UART_SpiUartGetRxBufferSize(), and remove the data from FIFO until this reads zero. After it reads 0, it is safe to clear the RX FIFO not empty interrupt. This will prevent the ISR from firing again.
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi BragadeeshV, thanks for your reply.
I think I understand what you say so let me try.
EDIT: In the mean time I would like to know,
why there is always an "unexpected" byte whit 0x00 value at the end?
And also, I'm receiving bytes not char so an 0x00 is a valid value for mi App and is not clear to me how to differentiate at ISR stage?
Regards,
Luis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Confirmed, removing the byte first from the FIFO and everything works perfect!!
First I made some tests using UART_SpiUartGetRxBufferSize(), this made me understand a little bit more.
Many thanks Bragadeesh