Please print the timer value continously in main thread and check whether TimerCb is calling after time out.
You may put a flag in TimerCb and print it in the main thread when the flag is set.
Please refer the Ov5640 example firmware and implement the same mechanism.
Is there an API to get the timer value?
I checked the callback function and it is not getting invoked.
I'm using the firmware based on the OV5640 example.
The callback is working sometimes and i'm able to restart streaming, but not always.
Use this API CyU3PGetTime
Please avoid DebugPrints in Call back functions. Remove them, if you are using any.
I'm not using debug prints in the callback functions, Thanks for the info.
The CyU3PGetTime API only returns the elapsed timer ticks since startup. That number keeps on increasing. I'm printing that value and checking whether callback was invoked.
Even after the time out period the callback is not getting invoked.
Please share the uvc.c file to check how you are handling the timer.
1 of 1 people found this helpful
Please try Stop, Modify and Start the timer in Producer_Event for a Partial DMA buffer (i.e. End of Frame) and check.
/* Add Headers*/
if (dmaBuffer.count < CX3_APP_DATA_BUF_SIZE)
CyCx3AppAddHeader ((dmaBuffer.buffer - CX3_APP_PROD_HEADER), CX3_APP_HEADER_EOF);
/* We got another end of frame packet. Restart the timer here. */
CyU3PTimerModify (&Cx3ResetTimer, TIMER_PERIOD, 0);
Thanks for helping me.
I have solved my issue.
The solution you have suggested will also work, but i have done it a little differently.
The existing timer that initiates a DMA reset was used to check if a frame transfer was completed in time , else a callback would be invoked.
My condition was sometimes the sensor stream stream stops after frame end and not in between. This way the timer would never be invoked.
What i did was to create another timer so that this problem is addressed. I started the timer when a frame has completed transferring and stopped it when next frame has started. Thus i could know whether there was a huge time gap between successive frames and trigger a DMA reset if needed.