2 Replies Latest reply on Jun 11, 2020 11:35 PM by MiRe_1607246

    UART RX fifo not empty - flag is not set

    MiRe_1607246

      Hello,

       

      I have problem.

       

      I have project (my board), where is GSM module connected to uP from PSoC 5LP family. The communication is solved between PSOC uP and GSM module by AT command over UART. The problem is in reading RX status reg. I need wait in loop to some response from GSM:

       

      GSM_ClearRxBuffer();

              while( (GSM_ReadRxStatus() & GSM_RX_STS_FIFO_NOTEMPTY  ) != GSM_RX_STS_FIFO_NOTEMPTY)

              { 

                  CyDelay(1);

                  tmpCitacVypni ++;

                  if(tmpCitacVypni == 7000)

                  {

                      tmpNum = -1;

                      //GSM_PutArray((uint8_t *)ESCAPE,1u);

                      tmpCitacVypni = GSM_ReadRxStatus() & GSM_RX_STS_FIFO_NOTEMPTY  ;

                      break;

                  }

              }

                 

              //CyDelay(ATDELAY);

              // jeste mu dame cas na odpoved

              tmpCitacVypni = GSM_ReadRxStatus() & GSM_RX_STS_FIFO_NOTEMPTY  ;

              for (ii = 0; ii < RX_BUFF_LENGTH ; ii++ )

              {

                  rxBuff [ii] = GSM_ReadRxData();

              }

       

      The problem is the flag is not set in:

              while( (GSM_ReadRxStatus() & GSM_RX_STS_FIFO_NOTEMPTY  ) != GSM_RX_STS_FIFO_NOTEMPTY)

       

      .... the same is on next line

              tmpCitacVypni = GSM_ReadRxStatus() & GSM_RX_STS_FIFO_NOTEMPTY  ;

      ..... flag is not set but the new data is available to read in :

              for (ii = 0; ii < RX_BUFF_LENGTH ; ii++ )

              {

                  rxBuff [ii] = GSM_ReadRxData();

              }

       

       

      Do you know where is problem? How can I solve it?

       

      the problem is in ATprikazy.c file in int8_t GSM_PrijataSMSVycti(uint8_t idxSMS) function.

        • 1. Re: UART RX fifo not empty - flag is not set
          LePo_1062026

          MiRe,

           

          I believe the problem is that you configured your GSM UART for 160 Rx bytes.  Therefore the Rx interrupt is enabled.

          The Rx ISR will automatically move (read) the incoming Rx data from the FIFO to the 160 byte Rx data buffer.

          When this occurs, the Rx status register will automatically clear the GSM_RX_STS_FIFO_NOTEMPTY bit flag (due to the read of the Rx data in the Rx ISR).  Therefore you reading the GSM_ReadRxStatus() for the GSM_RX_STS_FIFO_NOTEMPTY bit is not necessary and should never be set at the application level.

           

          Here is a snip of the UART_ReadRxStatus() API call.  Note the section in the RED outline.

          You can modify the Rx ISR to signal the application that data is available.  This is the proper way, in the case where the ISR is reading the Rx data.

           

          Len

          1 of 1 people found this helpful
          • 2. Re: UART RX fifo not empty - flag is not set
            MiRe_1607246

            Hello Len,

            Thank you for your advice. I didn't read side Effect. My mistake.

            Regards

            Michal