cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Anonymous
Not applicable

One simple SCB UART test under pSoc4 was created. 

   

TX works well with UART_1_UartPutString() or UART_1_UartPutChar().

   

However when I try to receive some Bytes (sent from PC) using RX Interrupt, there is problem.

   

1. Some Bytes are firstly sent to PC. --> OK

   

2. One Byte (e.g.0x06) is then sent back to module. At the first time when the TX_interrupt is called, this Byte 0x06 can be correctly received. After that this TX_interrupt is continuously called again and again, the received data is always 0xFFFFFFFF. What does this mean?

0 Likes
Reply
1 Solution
Honored Contributor II
        Check out this PSoC4 SCB UART example http://www.cypress.com/comment/389231#comment-389231   

View solution in original post

0 Likes
Reply
4 Replies
Honored Contributor II

If you are using an interrupt why do you have a wait of  100000? Also increase heap to 0x200. I updated your code to the latest Psoc Creator 4.0 SP 1.  The interrupt code you wrote in the CY_ISR(isr_uart_1_Interrupt) throws errors. best practice is not to put your interrupt code in this area and have it in the main.c.

0 Likes
Reply
Anonymous
Not applicable

hi, bobgoar, firstly thanks for your quick answer!

   

I have made some changes in order to test RX function only (in fact there is very few code in this test project.):

   

1. delete unnecessary send function.

   

2. set larger heap to 0x200.

   

3. test UART_1_UartGetByte() in both main() and ISR.

   

The problem can not be solved. Either the loop in main() or ISR has the same problem: UART_1_UartGetByte() returns 0xFFFFFFFF when there is no data sent from pc. (If one or more bytes are sent from pc, both of them can receive these bytes.)

   

However the influences of these two methods are different, the main program is totally BLOCKED if the method is ISR and it is continuously being miscalled. The question should be: why the uart interrupt is always being triggered even though no more data is valid on the uart line.

   

I have configured the UART1 interrupt triggered by External - RX Fifo not empty. Is that correct?

0 Likes
Reply
Honored Contributor II
        Check out this PSoC4 SCB UART example http://www.cypress.com/comment/389231#comment-389231   

View solution in original post

0 Likes
Reply
Anonymous
Not applicable

Thanks, odissey1! This example is very helpful for me.

0 Likes
Reply