cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

mappingnuts
New Contributor II

Hello,

 

I'm developing a driver to the IMX477, the same of the Raspberry HQ Camera. I have developed a small passive adapter board to route the MIPI lanes of the Denebola kit to a Arducam Module (pretty much a raspberry HQ Camera).

 

I have configured the sensor, and I've created a new configuration for the sensor. The sensor receives the configuration through CCI and starts the stream base on the configured, which was confirmed by probing the MIPI lanes. The configuration follows

 

mappingnuts_0-1624211952840.png

mappingnuts_1-1624211972336.png

 

The configuration is accepted by the configuration as valid. 

 

However, when I try to start streaming, I not only do not receive any image, but the application does not generate any log. I have activated SENSOR_DEBUG, PRINT_FRAME_INFO, and RESET_TIMER_ENABLE, but the last messages of debug received from UART are:

 

bRType = 0x81, bRequest = 0x0, wValue = 0x0, wIndex = 0x0, wLength= 0x2
bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22
Writing Configuration Settings:
AplnStrt:SMState = 0x2

 

And it stays like that. I can send UVC requests after that  normally, which means the firmware is not halted. 

 

Any advice on how to debug this? I have no clue what to try. 

 

How can I check that at least some frames , or even bits for that matter, are being received on the GPIF coming from the sensor? 

 

I appreciate all the help you can provide.

 

Best,

Renato

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator

Hello Renato,

Please refer to this KBA for details on the error  MIPI-CSI Protocol and Physical Layer Errors in CX3... - Cypress Developer Community

It seems that as the MIPI Transmitter is of higher version the MIPI errors are observed and this could be the reason for the not getting the video data on CX3 end

Regards,
Rashi

View solution in original post

0 Likes
13 Replies
Rashi_Vatsa
Moderator
Moderator

Hello Renato,

From the description, I understand that you are using the firmware generated using the CX3 configuration Tool as mentioned in this KBA  Steps to Setup up MIPI CSI Camera Solution with CX... - Cypress Developer Community

If  yes, it seems that the video frame data is not received by FX3. To confirm please add the following debug print in the CyCx3UvcAppThread_Entry function and share the UART debug prints

   for (;;)
    {
        eventFlag = 0;
        
        CyU3PDebugPrint(4,"\n\rProd = %d Cons = %d",TxCount,RxCount);

#ifdef PRINT_FRAME_INFO
		if (Printflag == 1)
		{ .....

This will help us to know how many DMA buffers are filled with the video data received.

Regards,
Rashi
0 Likes
mappingnuts
New Contributor II

Hello Rashi

 

Thank you for the response.

 

Yes, I am using the firmware generated by CX3 configuration Tool.

 

I added the debug message 

CyU3PDebugPrint(4,"\n\rProd = %d Cons = %d",TxCount,RxCount);

 

After starting streaming (as well as before, of course), TxCount and RxCount are always zero.

 

What could that mean?

 

BEst,

Renato

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Renato,

It seems that the video data is not received from  the MIPI Receiver Block. Please confirm if the MIPI Transmitter is configured with the same settings as CX3 MIPI receiver.

 for (;;)
    {
        eventFlag = 0;
        
        CyU3PDebugPrint(4,"\n\rProd = %d Cons = %d",TxCount,RxCount);
        
        CyU3PMipicsiGetErrors( CyTrue, &errCnts);

        CyU3PDebugPrint(4,"\n\r%d %d %d %d %d %d %d %d %d",errCnts.crcErrCnt,errCnts.ctlErrCnt, errCnts.eidErrCnt, errCnts.frmErrCnt, errCnts.mdlErrCnt, errCnts.recSyncErrCnt, errCnts.recrErrCnt, errCnts.unrSyncErrCnt, errCnts.unrcErrCnt );

 Please add the following prints to check if there are any MIPI errors.

Also, confirm if MIPI transmitter is compliant to MIPI CSI-2  (Version 1.01, Revision 0.04 – 2nd April 2009)

Regards,
Rashi
0 Likes
mappingnuts
New Contributor II

Hello Rashi,

 

I've changed the configuration of the firmware to test if I get any improvement. But still, all these parameters are 0 during stream.

 

Prod = 0 Cons = 0

|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt

|0 |0 |0 |0 |0 |0 |0 |0 |0

 

In another firmware I have, not the one created by the configuration tool, the values are these:

 

frmErrCnt: 0
crcErrCnt: 0
mdlErrCnt: 255
ctlErrCnt: 0
eidErrCnt: 0
recrErrCnt: 0
unrcErrCnt: 255
recSyncErrCnt: 255
unrSyncErrCnt: 0

 

The sensor datasheet mentions MIPI Alliance Standard for Camera Serial Interface 2
(CSI-2) version 1.2 and MIPI Alliance Specification for D-PHY version 1.2. Do you think the CSI-2 version being 1.2 would be a problem?

 

Best regards,

Renato.

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Renato,

Please refer to this KBA for details on the error  MIPI-CSI Protocol and Physical Layer Errors in CX3... - Cypress Developer Community

It seems that as the MIPI Transmitter is of higher version the MIPI errors are observed and this could be the reason for the not getting the video data on CX3 end

Regards,
Rashi

View solution in original post

0 Likes
mappingnuts
New Contributor II

Dear Rashi,

 

I've changed to an IMX sensor that is compliant with the MIPI v1.01. 

 

I have achieved better results, but I can't tell if it is due to the MIPI version. The problem with IMX477 could still be configuration.

 

Concerning the new IMX sensor: However, with this new sensor I'm facing another issue. This is the log I'm getting:


Prod = 41 Cons = 41 Prtl_Sz = 28516 Frm_Cnt = 3602 Frm_Sz = 1537972 B
Prod = 0 Cons = 0
|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt
|0 |0 |0 |0 |0 |0 |0 |0 |0
Prod = 22 Cons = 22
|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt
|0 |0 |0 |0 |0 |0 |0 |0 |0
Prod = 41 Cons = 41 Prtl_Sz = 28516 Frm_Cnt = 3603 Frm_Sz = 1537972 B
Prod = 0 Cons = 0
|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt
|0 |0 |0 |0 |0 |0 |0 |0 |0
Prod = 9 Cons = 9
|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt
|0 |0 |0 |0 |0 |0 |0 |0 |0
Prod = 41 Cons = 41 Prtl_Sz = 30432 Frm_Cnt = 3604 Frm_Sz = 1539888 B
Prod = 0 Cons = 0
|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt
|0 |0 |0 |0 |0 |0 |0 |0 |0
Prod = 0 Cons = 0
|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt
|0 |0 |0 |0 |0 |0 |0 |0 |0
Prod = 35 Cons = 35
|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt
|0 |0 |0 |0 |0 |0 |0 |0 |0
Prod = 41 Cons = 41 Prtl_Sz = 28520 Frm_Cnt = 3605 Frm_Sz = 1537976 B
Prod = 0 Cons = 0
|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt
|0 |0 |0 |0 |0 |0 |0 |0 |0
Prod = 21 Cons = 21
|crcErrCnt |ctlErrCnt |eidErrCnt |frmErrCnt |mdlErrCnt |recSyncErrCnt |recrErrCnt |unrSyncErrCnt |unrcErrCnt
|0 |0 |0 |0 |0 |0 |0 |0 |0
Prod = 41 Cons = 41 Prtl_Sz = 30432 Frm_Cnt = 3606 Frm_Sz = 1539888 B
Prod = 0 Cons = 0

As you can see, no MIPI errors! However, the frame size seems wrong to me (it is varying, and doesn't match the resolution). I don't get any images in the host computer also, but I will focus on that once the frame size received is correct. 

 

The resolution of the sensor is 1920x1080, and it sends RAW8 format. What should be the expected Frm_Sz (is it an integer multiple of the number of pixels in the frame, or could it be part of a frame?)? I would image 1920x1080=2073600, is that right?

 

Does the CX3 pass on  the embedded lines, headers, and footers, to the host? Or only actual active pixel values?

 

Can you kindly give your opinion, as that would be extremely helpful!

 

Kind regards,

Renato

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Renato,

The resolution of the sensor is 1920x1080, and it sends RAW8 format. What should be the expected Frm_Sz (is it an integer multiple of the number of pixels in the frame, or could it be part of a frame?)? I would image 1920x1080=2073600, is that right?

>> Yes, you understanding about the frame size is correct. The frame size shoudl be constant.

Please share the CX3 Configuration Tool snippet with the new configuration for me to check.

Does the CX3 pass on  the embedded lines, headers, and footers, to the host? Or only actual active pixel values?

>> If the embedded data type is0x12, then CX3 supports streaming of embedded data  Solved: CX3 can get MIPI embedded data ? - Cypress Developer Community   Can you try disabling the embedded data from the sensor?

Also, confirm if the sensor is configured with the same settings as CX3 MIPI receiver. Please let me know if sensor uses continuous clock mode or gated clock mode.

Regards,
Rashi
0 Likes
mappingnuts
New Contributor II

Hello Rashi,

 

I have adjusted the pllFbd parameter to get a faster Output Clock, and now I'm getting all bytes of the frame, and no MIPI error.

 

The frame includes embedded line, and apparently of type 0x12. I tried to remove it from the sensor config, but no success. I don't want these lines to reach the host computer.

 

Is there a way to make CX3 ignore the embedded lines and pass on only the pixels to the host? In my case, the first two lines of the frame are actually embedded line.

 

Kind regards,

Renato.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Renato,

Glad to hear that with the streaming is successful with MIPI transmitter compatible to  MIPI CSI-2  (Version 1.01, Revision 0.04 – 2nd April 2009)

Is there a way to make CX3 ignore the embedded lines and pass on only the pixels to the host?

>> We do not have filter on CX3 MIPI block to remove the embedded lines. Please let me know the DMA buffer size and the embedded line size in your application. I will check if it is possible to remove the lines in the DMA buffer.

Also, you can use a FPGA between MIPI Transmitter and CX3, to remove the embedded lines and send it to CX3

Regards,
Rashi
0 Likes
mappingnuts
New Contributor II

Hello Rashi, 

 

The embedded line size is 2 lines of image resolution. In my case the image is 1920 by 1080 RAW8, the embedded data is 1920 by 2, placed before the pixels. So the total number of bytes that the sensor sends is 1920x1082. 

 

The DMA is initiallizes as follows in my application:

 

#define CX3_UVC_DATA_BUF_SIZE (0x8FD0)
#define CX3_UVC_PROD_HEADER (12) /* UVC DMA Buffer Header Size */
#define CX3_UVC_PROD_FOOTER (4) /* UVC DMA Buffer Footer Size */

/* UVC Buffer size - Will map to bulk Transaction size */
#define CX3_UVC_STREAM_BUF_SIZE (CX3_UVC_DATA_BUF_SIZE + CX3_UVC_PROD_HEADER + CX3_UVC_PROD_FOOTER)

/* UVC Buffer count */
#define CX3_UVC_STREAM_BUF_COUNT (3)
 
#define CX3_UVC_SOCKET_COUNT (2)
 
#define CX3_EP_VIDEO_CONS_SOCKET (CY_U3P_UIB_SOCKET_CONS_3) /* Consumer socket 1 */
 
#define CX3_PRODUCER_PPORT_SOCKET_0 (CY_U3P_PIB_SOCKET_0) /* P-port Socket 0 is producer */
#define CX3_PRODUCER_PPORT_SOCKET_1 (CY_U3P_PIB_SOCKET_1) /* P-port Socket 0 is producer */
 

/* Create a DMA Manual OUT channel for streaming data */
/* Video streaming Channel is not active till a stream request is received */
dmaCfg.size = CX3_UVC_STREAM_BUF_SIZE;
dmaCfg.count = CX3_UVC_STREAM_BUF_COUNT;
dmaCfg.validSckCount = CX3_UVC_SOCKET_COUNT;

dmaCfg.prodSckId[0] = CX3_PRODUCER_PPORT_SOCKET_0;
dmaCfg.prodSckId[1] = CX3_PRODUCER_PPORT_SOCKET_1;

dmaCfg.consSckId[0] = CX3_EP_VIDEO_CONS_SOCKET;
dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;
dmaCfg.cb = CyCx3UvcAppDmaCallback;
dmaCfg.prodHeader = CX3_UVC_PROD_HEADER;
dmaCfg.prodFooter = CX3_UVC_PROD_FOOTER;
dmaCfg.consHeader = 0;
dmaCfg.prodAvailCount = 0;

status = CyU3PDmaMultiChannelCreate (&glChHandleUVCStream,
CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE , &dmaCfg);

 

Thank you for the support. 

 

Best,

Renato

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Renato,

We recommend to use  FPGA between MIPI Transmitter and CX3, to remove the embedded lines and send it to CX3

Regards,
Rashi
0 Likes
mappingnuts
New Contributor II

Hi Rashi,

 

Can you help with a question about continuous clock that you raised in this response?

 

I understand that by continuous clock you mean that the clock keeps in HS mode during Frame Blaking, is that it?

 

And in the case of a continuous clock, should I do something further than initiating the project using the wizard?

 

I appreciate your very helpful feedback,

 

Renato

 

0 Likes