- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I'm using the CX3 chip to stream data from my custom sensor via USB 3.0.
Sometimes my sensor stops sending data at that point i need to restart the streaming.
I was making use of the "CX3_DMA_RESET_EVENT" which will be triggered by a timer when a frame is not received in time.
But during testing i found out that this is not working always. The timer is not always triggered when the streaming stops.
Could you please help me out here.
Regards
Ajay
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please try Stop, Modify and Start the timer in Producer_Event for a Partial DMA buffer (i.e. End of Frame) and check.
Sample Snippet:
/* Add Headers*/
if (dmaBuffer.count < CX3_APP_DATA_BUF_SIZE)
{
CyCx3AppAddHeader ((dmaBuffer.buffer - CX3_APP_PROD_HEADER), CX3_APP_HEADER_EOF);
#ifdef RESET_TIMER_ENABLE
/* We got another end of frame packet. Restart the timer here. */
CyU3PTimerStop (&Cx3ResetTimer);
CyU3PTimerModify (&Cx3ResetTimer, TIMER_PERIOD, 0);
CyU3PTimerStart (&Cx3ResetTimer);
#endif
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Regards
Ajay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use this API CyU3PGetTime
Please avoid DebugPrints in Call back functions. Remove them, if you are using any.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please share the uvc.c file to check how you are handling the timer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please try Stop, Modify and Start the timer in Producer_Event for a Partial DMA buffer (i.e. End of Frame) and check.
Sample Snippet:
/* Add Headers*/
if (dmaBuffer.count < CX3_APP_DATA_BUF_SIZE)
{
CyCx3AppAddHeader ((dmaBuffer.buffer - CX3_APP_PROD_HEADER), CX3_APP_HEADER_EOF);
#ifdef RESET_TIMER_ENABLE
/* We got another end of frame packet. Restart the timer here. */
CyU3PTimerStop (&Cx3ResetTimer);
CyU3PTimerModify (&Cx3ResetTimer, TIMER_PERIOD, 0);
CyU3PTimerStart (&Cx3ResetTimer);
#endif
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Regards
Ajay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Congratulations.