add hid function to AN75779

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

cross mob
smartliu
Level 1
Level 1
First question asked Welcome!

hello,

I have added the hid function to the AN75779.

I receive data sent from other chips via the serial port of the fx3 and send it to the pc via hid.whenever I send data to the fx3 via the serial port, the video transmitted by the uvc to the pc drops frames;

I use reg mode for my serial port and receive data with CyU3PUartReceiveBytes;When I block out the function CyU3PUartReceiveBytes(count = CyU3PUartReceiveBytes (UartDataBuffer, 5, &status)) and only receive the interrupt command (CY_U3P_UART_EVENT_RX_DATA) from the cpu sending data to hid, the video will not drop frames,.

It seems that the video frame drop is generated by the CyU3PUartReceiveBytes function, how should I solve this problem?

 

CyFxUartLpApplnCallback (
CyU3PUartEvt_t evType,
CyU3PUartError_t evStatus)
{
          if (evType == CY_U3P_UART_EVENT_RX_DATA)
           {

                     count = CyU3PUartReceiveBytes (UartDataBuffer, 5, &status);
                   if(count!=0)
                  {
                       CyFxHidSendReport ();//referenct hid example
                  }
             }
}

 

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

Hello,

The behavior seen is expected. This is because the API CyU3PUartReceiveBytes() will return only after reading the count specified in the API or after the specified timeout is elapsed. The default timeout is 0xFFFFF. As 5 bytes are specified while calling the API, it will return only after reading 5 bytes. During this time, the FX3's CPU cannot commit the video data received from the GPIF II side to the USB host. As you are not seeing frame drop when this API is removed, we can conclude that the reason mentioned above causes the frame drop.

Please try to reduce the timeout by using the API CyU3PUartSetTimeout() and let us know the results. Another solution to avoid this problem is to use UART in DMA mode. Please refer to the example project cyfxuartlpdmamode to understand the implementation of UART in DMA mode. This example project comes along with FX3 SDK and can be found in the following location:
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxuartlpdmamode

Please let us know if you have any queries on this.

Best Regards,
Jayakrishna

View solution in original post

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

Hello,

The behavior seen is expected. This is because the API CyU3PUartReceiveBytes() will return only after reading the count specified in the API or after the specified timeout is elapsed. The default timeout is 0xFFFFF. As 5 bytes are specified while calling the API, it will return only after reading 5 bytes. During this time, the FX3's CPU cannot commit the video data received from the GPIF II side to the USB host. As you are not seeing frame drop when this API is removed, we can conclude that the reason mentioned above causes the frame drop.

Please try to reduce the timeout by using the API CyU3PUartSetTimeout() and let us know the results. Another solution to avoid this problem is to use UART in DMA mode. Please refer to the example project cyfxuartlpdmamode to understand the implementation of UART in DMA mode. This example project comes along with FX3 SDK and can be found in the following location:
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxuartlpdmamode

Please let us know if you have any queries on this.

Best Regards,
Jayakrishna
0 Likes