You are here

Setting up ISR for use with UART Rx interrupt | Cypress Semiconductor

Setting up ISR for use with UART Rx interrupt

Summary: 2 Replies, Latest post by ANKS on 07 Nov 2016 03:39 AM PST
Verified Answers: 1
Last post
Log in to post new comments.
KTrenholm_1955226's picture
User
1 post

EDIT: I figured it out, I should have been calling U1RX_ISR_Start() to properly enable the interrupt rather than calling U1RX_ISR_Enable() alone.

 

Hi all,

I'm getting started for the first time with using a PSoC 5 (CY8C5668AXI-LP010) and I've got a question about setting up a UART Receive interrupt.

I have the UART present and functional (I.E. UART1_PutString works, so the module is operating) but I'm having a tough time getting the interrupt upon receiving a byte to work correctly.

I currently have the UART module placed and wired.  the rx_interrupt signal is wired to an interrupt named U1RX_ISR. This interrupt is of type "Derived".  The UART is configured to interrupt on byte received.  The buffer sizes for both RX and TX are 4 bytes.  In the code, I am enabling U1RX interrupt via the U1RX_ISR_Enable() function.  What I am now finding is that sending a character to the UART from my PC is resulting in the code ending up in the IntDefaultHandler.  I presume it's some sort of issue with my U1RX_ISR not linking up properly?  but in that case, how would I go about configuring this interrupt?  Would it be better practice to increase the buffer size and use the internal interrupt?

In the code, I am first calling

 CyGlobalIntEnable

then

U1RX_ISR_Enable()

and finally

UART1_Start();

This is my first time working with a PSoC, so I'm still unfamiliar with best practices and exactly how to configure interrupts properly.

Thanks in advance for the help.

user_342122993's picture
User
579 posts

KTrenholm,

attached is example project of using UART for receiving ASCII strings/commands. It also shows basic interaction with UART_RX interrupt.

ANKS's picture
Cypress Employee
88 posts

You can also use the following code example -

https://github.com/kmmankad/UART-on-PSoC3

Please respond if that helps or not.

Log in to post new comments.