I tried values from 0~0x7f(in an interval of 8), none of them worked.
But I also observed something interesting, if I set the delay less than 0x10, based on the uart output, I can see the system runs dmacallback a couple times then freeze(all periodic uart prints don't appear anymore), doesn't react to anything.
1. values in CX3 config tool are ok. nothing to flag.
2. changing values of second parameter of CyU3PMipicsiSetPhyTimeDelay gets H_sync and V_sync stable. Not sure if correct/normal [see attached screenshots].
3. as Hanyi specified we are getting :
DMA callback type=16
DMA callback type=8
not sure what next....
Have you gotten any update?
The waveforms on PCLK/H_sync/V_sync looks correct. Could you please clarify where you get these DMA callback errors(I don't have your code so the log doesn't make sense for me)?
Could you see any USB data package in BUS HOUND?
no updates.... not sure what else to try.
We don't have access to an usb 3.0 analyser, I used wireshark to capture the usb packet. You can see one blk in transactions, then no usb activity from then on.
On the cypress chip side, I print the dma type everytime CyCx3UvcAppDmaCallback gets called. Like this:
CyU3PDebugPrint (4, "\n\rDMA callback type =%d",type);
I think type 8 means GPIF data in, type 16 is USB out. From the code:
CY_U3P_DMA_CB_PROD_EVENT = (1 << 3), /**< Buffer received from producer. This event is generated when
a buffer is generated by the producer socket when a transfer
is queued with SetXfer. */
CY_U3P_DMA_CB_CONS_EVENT = (1 << 4), /**< Buffer consumed by the consumer. This event is generated when
a buffer is sent out by the consumer socket when a transfer
is queued with SetXfer. */
CyCx3UvcAppDmaCallback would execute several times, then stops, together with other periodic print, and if you close the camera app on pc, there's no reaction from the chip(no usb event print in CyCx3UvcApplnUSBSetupCB). I assume the firmware hangs.
1. Please try to invoke API CyU3PGpifGetSMState to check it SM runs correctly. Print these status in main thread of a new thread to know that.
2. Try to check the data package on USB BUS. This could be checked with software tool(BUS HOUND/USBlyzer) or hardaware tool(LeCory or Eilisys USB analyzer).
Please DO NOT call any UART print function in CyCx3UvcAppDmaCallback since it will block the very high speed data transfer. CyCx3UvcAppDmaCallback should return ASAP.
If you want get some UART print output, please
1. Set some global variables to indicate the DMA status. These values will be changed in DmaCallback function. Print them in main thread or another thread if you want.
2. Try to use Event for communications between two or more threads. You may refer to CyU3PEventGet/Set functions.
You could refer to the example project, Cx3UvcOv5640 in SDK path, to know the detailed information.
#define PRINT_FRAME_INFO /* Uncomment the following line to provide verbose debug logging. */ /* #define CX3_DEBUG_ENABLED (1) */ /* Uncomment the following line to run the mipi error thread */ /* #define CX3_ERROR_THREAD_ENABLE (1) */
Thank you, we've made it work. The problem is exactly the uart print in CyCx3UvcAppDmaCallback.
What I don't understand is why it would freeze the whole system, maybe a deadlock between two threads that handles hardware?
You could see video stream from host application, e-Cam for example. Is that right?
Yes, I verified using e-Cam.