1 Reply Latest reply on Feb 18, 2018 9:33 AM by user_242978793

    PSoC 5 and UART communication

    petr.marsalek_1611436

      I have problem with UART communication.

       

      I use CY8CKIT-059 PSoC® 5LP

      UART block v2.5 (Mode: Full UART, RX Buffer size: 10, Name: RFID_UART, rx_interrupt connect to cy_isr (RFID_UART_isr))

       

      Program

      Init UART:

       

          RFID_UART_Start();

          RFID_UART_ClearRxBuffer();

          RFID_UART_ClearTxBuffer();

          RFID_UART_isr_StartEx(RFID_UART_int);

       

      Callback interrupt:

       

           CY_ISR(RFID_UART_int)

           {

         

               do

               {

                   /* Read receiver status register */

                   rxStatus = RFID_UART_RXSTATUS_REG;

                   rxSizeBuffer = RFID_UART_GetRxBufferSize();

       

       

                   if((rxStatus & (RFID_UART_RX_STS_BREAK | RFID_UART_RX_STS_PAR_ERROR |RFID_UART_RX_STS_STOP_ERROR | RFID_UART_RX_STS_OVERRUN | UART_RX_STS_SOFT_BUFF_OVER )) != 0u)

                   {

                       /* ERROR handling. */

                       errorStatus |= rxStatus & ( RFID_UART_RX_STS_BREAK | RFID_UART_RX_STS_PAR_ERROR | RFID_UART_RX_STS_STOP_ERROR | RFID_UART_RX_STS_OVERRUN | UART_RX_STS_SOFT_BUFF_OVER );

                   }

             

                   if((rxStatus & RFID_UART_RX_STS_FIFO_NOTEMPTY) != 0u)

                   {

                       /* Read data from the RX data register */

                       rxData = RFID_UART_RXDATA_REG;

                 

                       if(errorStatus == 0u && counter < 30u)

                       {

                           bufferUART[counter++] = rxData;

                       }

                   }

               }while((rxStatus & RFID_UART_RX_STS_FIFO_NOTEMPTY) != 0u);

      }

      -------------------------------------------------------------------------------------------------------------------

       

      First receive byte:     rxStatus = 0xA0     -   (1010 0000)         UART_RX_STS_FIFO_NOTEMPTY - OK

                                                                                                      UART_RX_STS_SOFT_BUFF_OVER - WHY? rxSizeBuffer = 0!

                                                                                                      If set, indicates the RX buffer was overrun.

       

      UART_RX_STS_SOFT_BUFF_OVER flag is always aktive. I send 1 byte to PSoC from external device.

       

      Thank you for answer!