cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

MaMi_1205306
Honored Contributor

Hi,

We use the UART component of PSoC5LP.

The UART component has "UARTRX-On Byte Received" enabled.
Interrupt is generated by receiving byte data,
The following processing is performed in the interrupt.

/* UART Rx interrupt routine */

while ((UART_1_ReadRxStatus() & UART_1_RX_STS_FIFO_NOTEMPTY) !=0) {

uint8 data = UART_1_GetChar();

}

In this process, data cannot be obtained normally by the _GetChar() API.

However, it can be received normally if modified as follows.

/* UART Rx interrupt routine */

while ((UART_1_ReadRxStatus() & UART_1_RX_STS_FIFO_NOTEMPTY) !=0) {

uint8 data = UART_1_GetReadRxData(); // Change API

}

In this case,
What is the difference between Get_Char function and ReadRxData function?

I confirm for the contents of each API,
The GetChar function checks the status flag, and the ReadRxData function does not check the status flag.

I think the difference is only checking the status flag.
Does this difference affect the behavior?

Regards,

0 Likes
1 Solution
Len_CONSULTRON
Honored Contributor II

MaMi,

The issue you are seeing is that GetChar() is primarily designed to be used in a Rx polling strategy.

If you want to use GetChar() try getting rid of your API call to ReadRxStatus().  Since GetChar() reads the RxStatus register, at a minimum it is redundant to your ReadRxStatus() call.

Len

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

View solution in original post

0 Likes
2 Replies
Len_CONSULTRON
Honored Contributor II

MaMi,

The issue you are seeing is that GetChar() is primarily designed to be used in a Rx polling strategy.

If you want to use GetChar() try getting rid of your API call to ReadRxStatus().  Since GetChar() reads the RxStatus register, at a minimum it is redundant to your ReadRxStatus() call.

Len

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

View solution in original post

0 Likes
MaMi_1205306
Honored Contributor

Len-san,

Thank you for your reply.

We understaoo that redundancy is a problem.

We take care not to use CetChar() and ReadRxData() of API the same way.

Regards,

0 Likes