- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I have a CX3 project and now I need to do UART debugging, but my hardware does not have the UART wired out. The alternative I found in the community is to add a CDC interface to the UVC project. I have tried to find a way to add it myself on Cypress community, but I failed, I don't know how to add it and what information I need to change in the firmware, can you tell me exactly what to change or just help me to change it to create a CDC interface? Thank you very much!The following file is a project to which I have not added the CDC interface,I would like to add CDC interface on top of that.
Best Regards
Yaqi
Solved! Go to Solution.
- Labels:
-
USB Superspeed Peripherals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Yaqi,
We are glad to hear that you are able to get the debug prints now.
Regarding the modifications, please find the part of code that you have missed in your response below:
1. In cycx3_uvc.c file:
Please add the following lines of code after the line status = CyU3PSetEpConfig(0x81, &endPointConfig);
/* Flush the Endpoint memory */
CyU3PUsbFlushEp(0x81);
status = CyU3PDebugInit (CY_FX_EP_DEBUG_SOCKET, 8);
if (status != CY_U3P_SUCCESS)
{
CyU3PDeviceReset(CyFalse);
//CyFxAppErrorHandler (status);
}
CyU3PThreadSleep (1000);
2. Inside the descriptor file, you missed the interface descriptors for the CDC interface. This comes after Super Speed Endpoint Companion Descriptor in CyCx3USBSSConfigDscr and is given below:
/*CDC Interface*/
/* Interface Association Descriptor */
0x08, /* Descriptor Size */
CX3_INTRFC_ASSN_DESCR, /* Interface Association Descr Type: 11 */
0x02, /* I/f number of first CDC i/f */
0x02, /* Number of CDC i/f */
0x02, /* CDC i/f class code */
0x02, /* Subclass code */
0x01, /* Protocol : Not used */
0x00, /* String desc index for interface */
/* Communication Interface descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */
0x02, /* Interface number */
0x00, /* Alternate setting number */
0x01, /* Number of endpoints */
0x02, /* Interface class : Communication interface */
0x02, /* Interface sub class */
0x01, /* Interface protocol code */
0x00, /* Interface descriptor string index */
/* CDC Class-specific Descriptors */
/* Header functional Descriptor */
0x05, /* Descriptors length(5) */
0x24, /* Descriptor type : CS_Interface */
0x00, /* DescriptorSubType : Header Functional Descriptor */
0x10,0x01, /* bcdCDC : CDC Release Number */
/* Abstract Control Management Functional Descriptor */
0x04, /* Descriptors Length (4) */
0x24, /* bDescriptorType: CS_INTERFACE */
0x02, /* bDescriptorSubType: Abstract Control Model Functional Descriptor */
0x02, /* bmCapabilities: Supports the request combination of Set_Line_Coding,
Set_Control_Line_State, Get_Line_Coding and the notification Serial_State */
/* Union Functional Descriptor */
0x05, /* Descriptors Length (5) */
0x24, /* bDescriptorType: CS_INTERFACE */
0x06, /* bDescriptorSubType: Union Functional Descriptor */
0x02, /* bMasterInterface */
0x03, /* bSlaveInterface */
/* Call Management Functional Descriptor */
0x05, /* Descriptors Length (5) */
0x24, /* bDescriptorType: CS_INTERFACE */
0x01, /* bDescriptorSubType: Call Management Functional Descriptor */
0x00, /* bmCapabilities: Device sends/receives call management information
only over the Communication Class Interface. */
0x03, /* Interface Number of Data Class interface */
/* Endpoint Descriptor(Interrupt) */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
0x81, /* Endpoint address and description */
CY_U3P_USB_EP_INTR, /* Interrupt endpoint type */
0x40,0x00, /* Max packet size = 1024 bytes */
0x02, /* Servicing interval for data transfers */
/* Super speed endpoint companion descriptor for interrupt endpoint */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
0x00, /* Max no. of packets in a Burst : 1 */
0x00, /* Mult.: Max number of packets : 1 */
0x40,0x00, /* Bytes per interval : 1024 */
/* Data Interface Descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */
0x03, /* Interface number */
0x00, /* Alternate setting number */
0x02, /* Number of endpoints */
0x0A, /* Interface class: Data interface */
0x00, /* Interface sub class */
0x00, /* Interface protocol code */
0x00, /* Interface descriptor string index */
/* Endpoint Descriptor(BULK-PRODUCER) */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
0x05, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* BULK endpoint type */
0x00,0x04, /* Max packet size = 1024 bytes */
0x00, /* Servicing interval for data transfers */
/* Super speed endpoint companion descriptor for producer ep */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
0x00, /* Max no. of packets in a burst : 1 */
0x00, /* Mult.: Max number of packets : 1 */
0x00,0x00, /* Bytes per interval : 1024 */
/* Endpoint Descriptor(BULK- CONSUMER) */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
0x85, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* BULK endpoint type */
0x00,0x04, /* Max packet size = 1024 bytes */
0x00, /* Servicing interval for data transfers */
/* Super speed endpoint companion descriptor for consumer ep */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
0x00, /* Max no. of packets in a burst : 1 */
0x00, /* Mult.: Max number of packets : 1 */
0x00,0x00, /* Bytes per interval : 1024 */
3. Also in the cycx3_uvc.h, please add the following line of code:
#define CY_FX_EP_DEBUG_SOCKET CY_U3P_UIB_SOCKET_CONS_5
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Please refer to the following thread which has interactions that mentions how to add CDC interface to obtain debug prints for a CX3 device:
The response posted on Jul 20, 2020 11:14 PM provides the instructions. There is a sample project attached in the same thread which was developed by modifying the SDK example CX3UvcOV5640 by following the same instructions. This project is added along with the interaction on Jul 21, 2020 01:05 AM.
Please have a look at this and let me know if you face any issues.
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I have looked at this project and I know the exact steps to add the CDC interface to UVC are as follows:
I referred back to the modified CX3UvcOV5640 example project and found that only this part of the descriptor had modified parameters.
But how should I change the descriptors in my project?
This is the problem that I am facing now.
Best Regards,
Yaqi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Yaqi,
As per my understanding, in the default project, the descriptors are written to enumerate the device as a UVC device (2 interfaces). But, in order to enumerate the device with UVC and CDC interfaces, the descriptors need to be modified. You can refer to the project shared in the thread and edit the configuration descriptor structure in your project. Please let me know if you have any queries in this.
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jayakrishna
I really don't know how to modify the corresponding descriptor part in order to add the CDC interface.
First of all, the descriptors in this section are the descriptors from the OV5640 sample project that I imported directly:
Here are the descriptors modified in the thread:
And the descriptors in the project I created myself look like this
I am really clueless as to how to modify it. Please help me.
Best Regards,
Yaqi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Yaqi,
Please replace the descriptor file used in your project with the descriptor file attached along with this response. After this, build and program the firmware to the CX3 device and let me know if you are able to see a COM port enumerated on the host.
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jayakrishna,
I have replaced the descriptor file and I was able to see the COM ports enumerated on the host in a flash. Maybe there is something wrong with my cycx3_uvc.c file modification that is causing the camera to not enumerate properly either.
I am following the steps below, and the OV5640 example project to make the changes
Only step 4 I can't modify,I will upload my project, please help me to see, thank you.
Best Regards,
Yaqi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Yaqi,
Please find the attached project which has all the modifications to obtain the debug prints using CDC interface. I have tested this project using Denebola kit and was able to get the prints using the CDC interface. Please test this at your end. Please note that I have commented out the function CyCx3UvcAppImageSensorSetVideoResolution () called inside the function CyCx3UvcAppHandleSetCurReq () for testing.
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jayakrishna,
My problem has not been solved yet.
I pasted your sample project file directly into my project and when I downloaded the release version of the .img file to my hardware, serial COM5 appeared on the PC, but my camera would fail to drive and COM5 disappeared at the same time.
What's going on here?
Best Regards,
Yaqi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Please follow the steps given below:
1. Import the project that I shared directly into EZ USB Suite.
2. Clean the project once.
3. Build the project again.
4. Check the Date and Time modified of the .img file when downloading the firmware into the device. This is to ensure that the latest build is downloaded into the device and not an older version.
I have performed the above steps at my end on Denebola kit and found that it is working properly. Please find a snapshot of the tera term Application showing some debug logs that were captured by running your firmware below:
Also, I have tested both debug and release builds and found that both of them worked properly at my end. Please try the steps that I mentioned in this response and let me know if it helps.
Jayakrishna
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jayakrishna
Thank you very much, I finally got the print results
Although it worked this time, I'd like to know what changes you made to my file because I have to create another project. I compared the sample project you posted before and I found that only these three changes were made, right?
1、cycx3_uvc.c
CyCx3UvcAppInit ()
2、CyCx3UvcAppDebugInit ()
3、cycx3_uvcdscr.c
Best Regards,
Yaqi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Yaqi,
We are glad to hear that you are able to get the debug prints now.
Regarding the modifications, please find the part of code that you have missed in your response below:
1. In cycx3_uvc.c file:
Please add the following lines of code after the line status = CyU3PSetEpConfig(0x81, &endPointConfig);
/* Flush the Endpoint memory */
CyU3PUsbFlushEp(0x81);
status = CyU3PDebugInit (CY_FX_EP_DEBUG_SOCKET, 8);
if (status != CY_U3P_SUCCESS)
{
CyU3PDeviceReset(CyFalse);
//CyFxAppErrorHandler (status);
}
CyU3PThreadSleep (1000);
2. Inside the descriptor file, you missed the interface descriptors for the CDC interface. This comes after Super Speed Endpoint Companion Descriptor in CyCx3USBSSConfigDscr and is given below:
/*CDC Interface*/
/* Interface Association Descriptor */
0x08, /* Descriptor Size */
CX3_INTRFC_ASSN_DESCR, /* Interface Association Descr Type: 11 */
0x02, /* I/f number of first CDC i/f */
0x02, /* Number of CDC i/f */
0x02, /* CDC i/f class code */
0x02, /* Subclass code */
0x01, /* Protocol : Not used */
0x00, /* String desc index for interface */
/* Communication Interface descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */
0x02, /* Interface number */
0x00, /* Alternate setting number */
0x01, /* Number of endpoints */
0x02, /* Interface class : Communication interface */
0x02, /* Interface sub class */
0x01, /* Interface protocol code */
0x00, /* Interface descriptor string index */
/* CDC Class-specific Descriptors */
/* Header functional Descriptor */
0x05, /* Descriptors length(5) */
0x24, /* Descriptor type : CS_Interface */
0x00, /* DescriptorSubType : Header Functional Descriptor */
0x10,0x01, /* bcdCDC : CDC Release Number */
/* Abstract Control Management Functional Descriptor */
0x04, /* Descriptors Length (4) */
0x24, /* bDescriptorType: CS_INTERFACE */
0x02, /* bDescriptorSubType: Abstract Control Model Functional Descriptor */
0x02, /* bmCapabilities: Supports the request combination of Set_Line_Coding,
Set_Control_Line_State, Get_Line_Coding and the notification Serial_State */
/* Union Functional Descriptor */
0x05, /* Descriptors Length (5) */
0x24, /* bDescriptorType: CS_INTERFACE */
0x06, /* bDescriptorSubType: Union Functional Descriptor */
0x02, /* bMasterInterface */
0x03, /* bSlaveInterface */
/* Call Management Functional Descriptor */
0x05, /* Descriptors Length (5) */
0x24, /* bDescriptorType: CS_INTERFACE */
0x01, /* bDescriptorSubType: Call Management Functional Descriptor */
0x00, /* bmCapabilities: Device sends/receives call management information
only over the Communication Class Interface. */
0x03, /* Interface Number of Data Class interface */
/* Endpoint Descriptor(Interrupt) */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
0x81, /* Endpoint address and description */
CY_U3P_USB_EP_INTR, /* Interrupt endpoint type */
0x40,0x00, /* Max packet size = 1024 bytes */
0x02, /* Servicing interval for data transfers */
/* Super speed endpoint companion descriptor for interrupt endpoint */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
0x00, /* Max no. of packets in a Burst : 1 */
0x00, /* Mult.: Max number of packets : 1 */
0x40,0x00, /* Bytes per interval : 1024 */
/* Data Interface Descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */
0x03, /* Interface number */
0x00, /* Alternate setting number */
0x02, /* Number of endpoints */
0x0A, /* Interface class: Data interface */
0x00, /* Interface sub class */
0x00, /* Interface protocol code */
0x00, /* Interface descriptor string index */
/* Endpoint Descriptor(BULK-PRODUCER) */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
0x05, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* BULK endpoint type */
0x00,0x04, /* Max packet size = 1024 bytes */
0x00, /* Servicing interval for data transfers */
/* Super speed endpoint companion descriptor for producer ep */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
0x00, /* Max no. of packets in a burst : 1 */
0x00, /* Mult.: Max number of packets : 1 */
0x00,0x00, /* Bytes per interval : 1024 */
/* Endpoint Descriptor(BULK- CONSUMER) */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
0x85, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* BULK endpoint type */
0x00,0x04, /* Max packet size = 1024 bytes */
0x00, /* Servicing interval for data transfers */
/* Super speed endpoint companion descriptor for consumer ep */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
0x00, /* Max no. of packets in a burst : 1 */
0x00, /* Mult.: Max number of packets : 1 */
0x00,0x00, /* Bytes per interval : 1024 */
3. Also in the cycx3_uvc.h, please add the following line of code:
#define CY_FX_EP_DEBUG_SOCKET CY_U3P_UIB_SOCKET_CONS_5
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jayakrishna
Thank you for being so patient and helping me.
Best Regards,
Yaqi