2 Replies Latest reply on Jun 20, 2020 10:16 PM by FaBa_506136

    uart rx_fifo_not_empty not fire after power off/on CY8C4126AXI-S433

    FaBa_506136

      Hi everyone.

      i have a problem with the uart of the micro CY8C4126AXI-S433.

      Immediately after the chip is programmed, the uart works correctly.

      But if I turn the microart off and on again, the Uart does not receive, the rx_fifo_not_empty interrupt is not activated.

       

      This is my initialization:

      Uart_Start ();

      uart_rx_isr_StartEx (uart_rx_isr);

       

      this is isr

       

      CY_ISR (uart_rx_isr)

      {

          

      Uart_ClearRxInterruptSource (Uart_INTR_RX_NOT_EMPTY); // clear interrupt

             

          // check UART Rx Buffer size

          if (0! = Uart_GET_RX_FIFO_ENTRIES)

          {

           / * Get the character from terminal * /

           RxBuffer [RxCounter ++] = (char8) Uart_RX_FIFO_RD_REG;

          }

      }

        • 1. Re: uart rx_fifo_not_empty not fire after power off/on CY8C4126AXI-S433
          MoTa_728816

          Hi,

           

          I tried with a TSoC board, which has CY8C4146LQI-S433.

          As this device is the closest one I have.

           

          As far as I tested, the interrupt was working after power cycle.

          But one issue I encountered was when the power got cycled,

          KitProg and PC's COM port were not quite ready

          before PSoC started writing something onto the UART.

           

          So I needed to add

               CyDelay(1000) ;

          after

               UART_Start() ;

          and before the first output.

           

          Schematic

          000-schematic.JPG

          Pins

          001-pins.JPG

           

          main.c

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

          #include "project.h"

          #include "stdio.h"

           

          #define RX_BUF_LEN 128

          volatile int RxCounter = 0 ;

          char RxBuffer[RX_BUF_LEN] ;

           

          #define STR_LEN 64

          char str[STR_LEN+1] ;

           

          CY_ISR(uart_rx_isr)

          {

              UART_ClearRxInterruptSource(UART_INTR_RX_NOT_EMPTY) ;

             

              if (0 != UART_GET_RX_FIFO_ENTRIES) {

                  /* Get character from terminal */

                  RxBuffer[RxCounter++] = (char)UART_RX_FIFO_RD_REG ;

              }

          }

           

          void splash(char *title)

          {

              UART_UartPutString("\x1b[2J\x1b[;H") ;

              UART_UartPutString(title) ;

              snprintf(str, STR_LEN, " (%s %s)\n\r",__DATE__, __TIME__) ;

              UART_UartPutString(str) ;

          }

           

          int main(void)

          {

              uint8_t c ;

             

              CyGlobalIntEnable; /* Enable global interrupts. */

             

              uart_rx_isr_ClearPending() ;

              uart_rx_isr_StartEx(uart_rx_isr) ;

             

              UART_Start() ;

             

              CyDelay(1000) ;

             

              splash("UART Rx Int Test") ;

           

              for(;;)

              {

                  if (RxCounter > 0) {

                      c = RxBuffer[--RxCounter] ;

                      switch(c) {

                      case 0:

                      case 0xFF:

                          break ;

                      case '\r':

                      case '\n':

                          UART_UartPutString("\r\n") ;

                          break ;

                      default:

                          UART_UartPutChar(c) ;

                          break ;

                      }

                  }  

              }

          }

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

           

          Attached is my project with CY8C4146LQI-S433.

          To test with your device please

          (1) Use "Device Selector..." to change the device to "CY8C4126AXI-S433"

          (2) Change pins to match with your hardware.

           

          moto

          • 2. Re: uart rx_fifo_not_empty not fire after power off/on CY8C4126AXI-S433
            FaBa_506136

            Hi Motoo,

            Thanks very much for your help. I solved the problem

            Fausto