Simple SCB UART RX Interrupt

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
TeMa_1467596
Level 5
Level 5
5 sign-ins 5 likes given First like received

I have a project running on a CYBLE-222014-01 module with SCB_1 set up for use as UART and I'm sending serial data via an FTDI USB chip to my PC using TeraTerm as the terminal.  I've been sending all kinds of data out to the PC with no issues but I wanted to have my PRoC module read and react to serial data coming to it from the PC terminal.

   

I selected the Internal Interrupt radio button under advanced and then saw there was a file called SCB_1_SCB_IRQ.c with a section marked

   

    /*  Place your Interrupt code here. */
    /* `#START SCB_1_SCB_IRQ_Interrupt` */

   

So I added my code of

   

        SCB_1_IRQtriggered = 1;

   

to set my own flag and then picked up that flag in the main.c loop and, if it's set I wanted to send out the character just received...

   

       if (SCB_1_IRQtriggered == 1) {
            tempTed = SCB_1_UartGetByte();
            SCB_1_UartPutChar(tempTed);
            SCB_1_UartPutCRLF(0x20);
            SCB_1_IRQtriggered = 0;
        }
 

   

But, my code runs until I press a key in TeraTerm to send to the PRoC module and then the program locks/gets stuck in a doom loop - I think it's getting stuck in the IRQ Interrupt - I'm unable to run in debug mode due to the lack of pins.

   

Maybe I need to clear the interrupt that caused the IRQ but I can't find a function that does that.

   

One oddity is that, in the SCB Advanced tab, I selected the box for the interrupt source "RX FIFO not empty" but every time I come back to the dialog box after I make that selection, the box is unchecked???

   

Any advice on how to approach this task is much appreciated.

   

Ted

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
0 Likes
3 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Check out this PSoC4 SCB UART example
http://www.cypress.com/comment/389231#comment-389231

0 Likes
TeMa_1467596
Level 5
Level 5
5 sign-ins 5 likes given First like received

Thanks, I adapted the code in that project to get running ISR-based SCB UART taking simple commands from my terminal - just what I was trying to do.

   

Can someone explain why, when I specify the CY_ISR() for the new Rx_Int, I still get Rx_Int.c and Rx_Int.h files generated but they don't appear to do anything?

0 Likes
Anonymous
Not applicable

If you use Rx_Int_StartEx(), then you are passing the address to the new CY_ISR() function you defined for the code to call when it interrupts, instead of running the generic CY_ISR() that you are expecting. The files are generated for the component, as the component still has software internal to itself that runs/uses the class files, but the CY_ISR() function is being replaced by your StartEx() call.

0 Likes