Can you please let me know which firmware you are using? Is it a custom firmware?
If yes, please share the firmware with the GPIF project.
I use EZ-USB FX3 UVC CAMERA KIT,Please refer to the "AN75779 project.
I can't confirm whether the CY_FX_UVC_GPIF_SWITCH_TIMEOUT will affect the next image data when accidental data loss happen.
try to find the mean of CY_FX_UVC_GPIF_SWITCH_TIMEOUT:
uint16_t fromState, /* The state from which to do the switch to the desired state. */
uint16_t toState, /* The state to which to transition from fromState. */
uint16_t endState, /* The end state for this execution path. */
uint8_t initialAlpha, /* Initial Alpha values to use when switching states. */
uint32_t switchTimeout /* Timeout setting for the switch operation in GPIF clock cycles. */
/* Start the state machine from the designated start state. */
apiRetStatus = CyU3PGpifSMSwitch(CY_FX_UVC_INVALID_GPIF_STATE, START_SCK0,
CY_FX_UVC_INVALID_GPIF_STATE, ALPHA_START_SCK0, CY_FX_UVC_GPIF_SWITCH_TIMEOUT);
if (apiRetStatus != CY_U3P_SUCCESS)
/* Error Handling */
CyU3PDebugPrint (4, "Switching GPIF state machine failed, Error Code = %d\r\n", apiRetStatus);
It seems that timeout only affect the gpif switch. If fail, firmware would not start a video stream?
The issue of next image data incorrect has no direct relation with timeout?
Can you please let me know if you have altered the firmware or GPIF state machine of AN75779.
If the state machine does not go to the start state (START_SCK0 in this case) when the CY_FX_UVC_STREAM_EVENT occurs the streaming will not be started.
The buffers associated with the bulk endpoint is flushed and the channel is reset every time CY_FX_UVC_STREAM_EVENT occurs.
As mentioned in the API guide under CyU3PGpifSMSwitch() function the timeout is only meaningful if a fromState is specified, and the timeout value is specified in terms of GPIF hardware clock cycles.
I haven't change the state machine, and start state is START_SCK0.
Thank you very much! It seems that the issue is not related with the timeout of SPIF. So i will do more test to find the clue.