[GPIF2] IN_DATA - Register question

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
HuYa_4249091
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Hi, I knew that the GPIF2: IN_DATA - Register corresponds to CyU3PGpifReadDataWords().

IN_DATA - Register state.JPG

I’m more familiar with GPIF2: IN_DATA - Socket which links to DMA channel to receive data. After the data is full, it triggers callback function in FW.

It seems that the GPIF2: IN_DATA - Register don’t use the callback mechanism. Developer should call CyU3PGpifReadDataWords() in the FW manually.

Besides, I’ve studied the GPIF_EXAMPLE1.zip in third reply.

According to the GPIF_EXAMPLE1.zip - Slave Device, it seems that the FW calls CyU3PGpifReadDataWords() every second, which is ASYNC with state machine’s IN_DATA - Register.

Q1: If CyU3PGpifReadDataWords() is called earlier than GPIF2: IN_DATA – Register, CyU3PGpifReadDataWords() will return CY_U3P_ERROR_FAILURE or else?

Q2: If GPIF2: IN_DATA – Register is executed earlier than CyU3PGpifReadDataWords(), GPIF2: IN_DATA – Register  state will wait CyU3PGpifReadDataWords() before GPIF goes to next state?

Q3: what’s the different between the GPIF2: IN_DATA – Register and GPIF2: IN_DATA – Socket? Is the former slow?

Any help will be highly appreciated!

0 Likes
1 Solution
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please refer to the API guide for the detailed documentation of the API CyU3PGpifReadDataWords(). As mentioned in the API guide, this function is  used to read a specified number of data words into a buffer, one word at a time.

Now, for your questions, please find my comments below:

1. As mentioned in the API Guide, a A timeout period can be specified, and if any of the data words is not available within the specified period from the previous one, the operation will return with a timeout error.

2. As there is no synchronization mechanism, the state machine should move to the next state irrespective of the completion of CyU3PGpifReadDataWords().

3. Yes, the former is slow and is only recommended if the size of the data to be transferred is very less. For faster and larger DMA transfers, we recommend the use of DMA mode.

Best Regards,
Jayakrishna

View solution in original post

3 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please refer to the API guide for the detailed documentation of the API CyU3PGpifReadDataWords(). As mentioned in the API guide, this function is  used to read a specified number of data words into a buffer, one word at a time.

Now, for your questions, please find my comments below:

1. As mentioned in the API Guide, a A timeout period can be specified, and if any of the data words is not available within the specified period from the previous one, the operation will return with a timeout error.

2. As there is no synchronization mechanism, the state machine should move to the next state irrespective of the completion of CyU3PGpifReadDataWords().

3. Yes, the former is slow and is only recommended if the size of the data to be transferred is very less. For faster and larger DMA transfers, we recommend the use of DMA mode.

Best Regards,
Jayakrishna
HuYa_4249091
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Dear Jayakrishna:

Thanks for your reply!

As mentioned in the API guide, this function is  used to read a specified number of data words into a buffer, one word at a time.

I've studied the API guide for this function. I'm confused with "one word at a time". If I set the  numWords  = 2 in CyU3PGpifReadDataWords() to read 2 words, first word will be read by first IN_DATA. The second word will be read after the GPIF2 runs into next IN_DATA state(ex: by state setting "Repeat actions until next transition"). Is it right?

1. As mentioned in the API Guide, a A timeout period can be specified, and if any of the data words is not available within the specified period from the previous one, the operation will return with a timeout error.

2. As there is no synchronization mechanism, the state machine should move to the next state irrespective of the completion of CyU3PGpifReadDataWords().


So, if I don't want to lose any received data. I should call CyU3PGpifReadDataWords() with a bigger timeout value first, and then let the GPIF2 into IN_DATA - Register state to read data. Is it right?

Thank you!

0 Likes
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please find my comments for your questions below:

1. I've studied the API guide for this function. I'm confused with "one word at a time". If I set the  numWords  = 2 in CyU3PGpifReadDataWords() to read 2 words, first word will be read by first IN_DATA. The second word will be read after the GPIF2 runs into next IN_DATA state(ex: by state setting "Repeat actions until next transition"). Is it right?

>> Yes, your understanding is correct.

2. So, if I don't want to lose any received data. I should call CyU3PGpifReadDataWords() with a bigger timeout value first, and then let the GPIF2 into IN_DATA - Register state to read data. Is it right?

>> Yes, this should be fine. The timeout is the maximum time that the API will wait to read one data word. If any of the data words is not available within the specified period from the previous one, the operation will return with a timeout error. I believe that the larger timeout is set to read the first data word properly. This should be fine.

Best Regards,
Jayakrishna