SCB UART interrupt works in the old project, but does not work in others even if the whole program is same

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

cross mob
alli_264371
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked
For the test, I wrote a program that waits for one byte from RX and, after receiving it, sends a string to TX.
Several years ago I used the same interrupt and if I take that old project(DMX_Button), then everything works.
But I need to add UART to another project, and even if I open a new virgin project and copy the modules and the main.c file into it, the interrupt does not work.
What the difference, what wrong in the new project?


I cannot confirm email and add messages due to a bug on your site, the email section is not active
0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I read your project.

First of all, I was surprised that it was working before!

As the MCU is CY8C4245AXI-483,

I tested it with my CY8CKIT-042.

Since I soldered KitProg's UART with P0[4] and P0[5],

I connected an external USB-Serial converter to P4[0] and P4[1].

You may be able to jumper P4[0] and P4[1] to KitProg's P12[7], P12[6].

Anyway, with the modification below, I could get interrupts.

001-TeraTerm-log.JPG

I modified your project as below.

==============

#include <project.h>

volatile char Worbuff[128]={0};

unsigned char RXBytcount;

CY_ISR_PROTO (RXinterrupt);

CY_ISR (RXinterrupt)   

{

    Worbuff[RXBytcount]=UART_RX_FIFO_RD_REG;

    RXBytcount=1;

    UART_SpiUartClearRxBuffer();

    UART_ClearRxInterruptSource(UART_INTR_RX_NOT_EMPTY);

    RXINT_ClearPending();

    RXINT_Disable() ; // Stop interrupts till it will be released again

}

int main(void)

{

    uint8 temp,temp1;

    char num[6]={0};

   

    unsigned int Prevpoint,tempint;

    unsigned char temp4,shiftcount[1];

    unsigned long temp3;

  

    UART_Start();

//    UART_Init(); //  (1)

//    UART_Enable(); // (1)

    RXINT_StartEx(RXinterrupt);

    CyGlobalIntEnable; /* Enable global interrupts. */

    RXBytcount=0;

   

    while(1)

    {

       // CyDelay(5);

        if(RXBytcount)

        {  

//            RXINT_Stop(); // (2)

            UART_UartPutString("12345");

            //UART_UartPutChar(Worbuff[0]);

            UART_UartPutChar(0x0D);

//            UART_SpiUartClearRxBuffer(); //  (3)

//            UART_ClearRxInterruptSource(UART_INTR_RX_NOT_EMPTY); // (3)

//            RXINT_ClearPending(); // (3)

            RXBytcount=0;

//            RXINT_Start(); // (4)

            RXINT_Enable() ;

        }

    }

}

==============

(1) This is done in UART_Start()

(2) This should be done in ISR and this should be RXINT_Disable()

(3) We don't need this

(4) This should be RXINT_Enable()

It would be nice if you can also refer to my sample of UART usage.

Re: tty_utils a utility sample for CLI type program

moto

View solution in original post

4 Replies