cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

New Contributor

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.

0 Likes
Reply
1 Solution
Honored Contributor

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.

pastedImage_0.png

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

Len
Engineering is an Art. The Art of Compromise."

View solution in original post

2 Replies
Honored Contributor

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.

pastedImage_0.png

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

Len
Engineering is an Art. The Art of Compromise."

View solution in original post

New Contributor

Hello Len,

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

Regards

Michal

0 Likes
Reply