关于高频率发送hid数据,hid报错问题

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

你好,我用Bus Hound软件(或其他工具测试遇到一样的问题)测试接收cx3 hid数据。当数据量频率不大时(数据包都是一样大小,64个字节),接收数据都正常,可以测试一天一夜。但是当发送的数据频率增大时,cx3这边很容报错:CY_U3P_USB_EVENT_EP_UNDERRUN,此错误的解释是:Indicates that a data underrun error has been detected on one of the USB endpoints. The event data will provide the endpoint number. 当高频率发送hid数据出现此错误后,即使复位hid,也无法恢复正常。复位hid如:

if (glIsHIDApplnActive)
{
CyFxUsbHidApplnStop();
}
CyFxUsbHidApplnStart();

请问如何解决cx3这种高频率发送hid报错问题?

0 点赞
1 解答
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

您可以尝试修改burst length到3, 同时描述符文件中也要修改。在payload是1024的情况下已经是最大的带宽了。如果还不符合您的应用需求可以考虑使用其他的传输方式如bulk transfer

在原帖中查看解决方案

0 点赞
17 回复数
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hi,

 

您可以尝试在USBEventCB中case CY_U3P_USB_EVENT_EP_UNDERRUN 下加入

CyU3PUsbResetEndpointMemories

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

加了没有效果

CyU3PUsbResetEndpointMemories();
if (glIsHIDApplnActive)
{
CyFxUsbHidApplnStop();
}

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

加了没有效果:

CyU3PUsbResetEndpointMemories();
if (glIsHIDApplnActive)
{
CyFxUsbHidApplnStop();
}
CyFxUsbHidApplnStart();

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

由于我们对数据的实时性要求比较高,希望能彻底解决此报错问题。即使发现此报错,再用规避机制处理,那么当前时间的数据也会被丢弃。此数据是另外的模块实时上报过来的,如imu数据,uart rx数据

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

请问你的DMA通道是如何配置的?使用的是interrupt endpoint吗?本身 interrupt transfer数据量是很有限的。

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

请看hid 设置:

/* This function starts the HID application. This is called
* when a SET_CONF event is received from the USB host. The endpoints
* are configured and the DMA pipe is setup in this function. */
void
CyFxUsbHidApplnStart (
void)
{
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
CyU3PDmaChannelConfig_t dmaCfg;
uint16_t size = 512; //0x40
CyU3PEpConfig_t epCfg;

CyU3PUSBSpeed_t usbSpeed = CyU3PUsbGetSpeed();

/* First identify the usb speed. Once that is identified,
* create a DMA channel and start the transfer on this. */

/* Based on the Bus Speed configure the endpoint packet size */

#if 1
switch (usbSpeed)
{
case CY_U3P_FULL_SPEED:
size = 64;
break;

case CY_U3P_HIGH_SPEED:
size = 512;
break;

case CY_U3P_SUPER_SPEED:
size = 1024;
break;

default:
LOG("\r\n what happend helllllllllll Error! Invalid USB speed.\r\n");
//CyFxAppErrorHandler (CY_U3P_ERROR_FAILURE);
break;
}
#endif

 

CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg));
epCfg.enable = CyTrue;
epCfg.epType = CY_U3P_USB_EP_INTR;
epCfg.burstLen = 1;//(usbSpeed == CY_U3P_SUPER_SPEED) ?
// (CY_FX_EP_BURST_LENGTH) : 1;
epCfg.streams = 0;
epCfg.pcktSize = size;

LOG("\r\nCY_FX_EP_BURST_LENGTH = %d\r\n", epCfg.burstLen);

apiRetStatus = CyU3PSetEpConfig (CY_FX_HID_EP_INTR_IN, &epCfg);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("\r\nCyU3PSetEpConfig failed, Error code = %d\r\n", apiRetStatus);
CyFxAppErrorHandler (apiRetStatus);
}

//add another endpoint for receive date

CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg));
epCfg.enable = CyTrue;
epCfg.epType = CY_U3P_USB_EP_INTR;
epCfg.burstLen = 1;
epCfg.streams = 0;
epCfg.pcktSize = size;

apiRetStatus = CyU3PSetEpConfig (CY_FX_HID_EP_INTR_OUT, &epCfg);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("\r\ncreate ououit channel CyU3PSetEpConfig failed, Error code = %d\r\n", apiRetStatus);
CyFxAppErrorHandler (apiRetStatus);
}

/* Flush the Endpoint memory */
CyU3PUsbFlushEp(CY_FX_HID_EP_INTR_IN);
CyU3PUsbFlushEp(CY_FX_HID_EP_INTR_OUT);

LOG("\r\n ENTER CyFxUsbHidApplnStart xxxxxxxxxxxxxxxxxxxxx\r\n");


/* Create a DMA MANUAL_IN channel for the producer socket. */
CyU3PMemSet ((uint8_t *)&dmaCfg, 0, sizeof (dmaCfg));
/* The buffer size will be same as packet size for the
* full speed, high speed and super speed non-burst modes.
* For super speed burst mode of operation, the buffers will be
* 1024 * burst length so that a full burst can be completed.
* This will mean that a buffer will be available only after it
* has been filled or when a short packet is received. */
dmaCfg.size = size;
/* Multiply the buffer size with the multiplier
* for performance improvement. */
dmaCfg.size *= CY_FX_DMA_SIZE_MULTIPLIER;
dmaCfg.count = CY_FX_BULKSRCSINK_DMA_BUF_COUNT;
dmaCfg.prodSckId = CY_FX_EP_PRODUCER_SOCKET;
dmaCfg.consSckId = CY_U3P_CPU_SOCKET_CONS;
dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
dmaCfg.notification = 0;
dmaCfg.cb = 0; //CyFxBulkSrcSinkDmaCallback; //CyFxBulkSrcSinkDmaCallback;
dmaCfg.prodHeader = 0;
dmaCfg.prodFooter = 0;
dmaCfg.consHeader = 0;
dmaCfg.prodAvailCount = 0;

apiRetStatus = CyU3PDmaChannelCreate (&glChHandleBulkSink,
CY_U3P_DMA_TYPE_MANUAL_IN, &dmaCfg);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}

/* Create a DMA MANUAL_OUT channel for the consumer socket. */
dmaCfg.notification = 0;// CY_U3P_DMA_CB_CONS_EVENT; //CY_U3P_DMA_CB_CONS_EVENT;
dmaCfg.prodSckId = CY_U3P_CPU_SOCKET_PROD;
dmaCfg.consSckId = CY_FX_EP_CONSUMER_SOCKET;
apiRetStatus = CyU3PDmaChannelCreate (&glChHandleBulkSrc,
CY_U3P_DMA_TYPE_MANUAL_OUT, &dmaCfg);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}

/* Set DMA Channel transfer size */
apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleBulkSink, CY_FX_BULKSRCSINK_DMA_TX_SIZE);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("CyU3PDmaChannelSetXfer failed, Error code = %d\n", apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}

apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleBulkSrc, CY_FX_BULKSRCSINK_DMA_TX_SIZE);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("CyU3PDmaChannelSetXfer failed, Error code = %d\n", apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}

CyU3PUsbRegisterEpEvtCallback (CyFxBulkSrcSinkApplnEpEvtCB, CYU3P_USBEP_SS_RETRY_EVT, 0x00, 0x01);
//CyFxBulkSrcSinkFillInBuffers ();
/* Update the flag so that the application thread is notified of this. */

 


/* Update the status flag. */
glIsHIDApplnActive = CyTrue;

LOG("\r\nExit CyFxUsbHidApplnStart yyyyyyyyyyyyyyyyyyyy\r\n");
}

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

您可以尝试修改burst length到3, 同时描述符文件中也要修改。在payload是1024的情况下已经是最大的带宽了。如果还不符合您的应用需求可以考虑使用其他的传输方式如bulk transfer

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

描述符文件怎么修改:

const uint8_t CyCx3USB30DeviceDscr[] =
{
0x12, /* Descriptor size */
CY_U3P_USB_DEVICE_DESCR, /* Device descriptor type */
0x10, 0x03, /* USB 3.1 */
0xEF, /* Device class */
0x02, /* Device Sub-class */
0x01, /* Device protocol */
0x09, /* Maxpacket size for EP0 : 2^9 */

//0x83, 0x04, /* Vendor ID */
//0x50, 0x57,

0xB4, 0x04, /* Vendor ID */
0xC3, 0x00, /* Product ID */

0x00, 0x00, /* Device release number */
0x01, /* Manufacture string index */
0x02, /* Product string index */
0x03, /* Serial number string index */
0x01 /* Number of configurations */
};

 

/* Standard Device Descriptor for USB 2 */
const uint8_t CyCx3USB20DeviceDscr[] =
{
0x12, /* Descriptor size */
CY_U3P_USB_DEVICE_DESCR, /* Device descriptor type */
0x10, 0x02, /* USB 2.1 */
0xEF, /* Device class */
0x02, /* Device sub-class */
0x01, /* Device protocol */
0x40, /* Maxpacket size for EP0 : 64 bytes */

0xB4, 0x04, /* Vendor ID */
//0x25, 0x60,
0xC3, 0x00, /* Product ID */


0x00, 0x00, /* Device release number */
0x01, /* Manufacture string index */
0x02, /* Product string index */
0x03, /* Serial number string index */
0x01 /* Number of configurations */
};

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

YiZ_31_0-1611630891652.png

 

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

按你的修改也是一样会报错,我把epCfg.epType = CY_U3P_USB_EP_BULK;改为bulk也一样会报错

0 点赞

从统计来看,如果发送hid数据包每秒达到350次以上就会容易报CY_U3P_USB_EVENT_EP_UNDERRUN错误。

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

你好,能不能提供一个发送hid 数据包(64字节)频率大于500HZ的例子?我看你们例子代码也只有Cypress\EZ-USB FX3 SDK\1.3\firmware\hid_examples这个鼠标数据例子.

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

你修改了payload吗?payload最大可以到1024byte,这里因为是鼠标的例程,所以只用了2byte

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

你说的payload是指这个参数吗?

0x02,0x00, /* Max packet size = 2 bytes */

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

就是这个参数,payload也就是每个数据包的大小,在brust为0的情况下,一个service interval内只能发送一个数据包。

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

修改了还是会报错,请看修改:

$ git diff cycx3_uvcdscr.c
diff --git a/Cx3UvcOV5640_glass_base/cycx3_uvcdscr.c b/Cx3UvcOV5640_glass_base/cycx3_uvcdscr.c
index 03ba73b..6ff959a 100644
--- a/Cx3UvcOV5640_glass_base/cycx3_uvcdscr.c
+++ b/Cx3UvcOV5640_glass_base/cycx3_uvcdscr.c
@@ -630,14 +630,14 @@ const uint8_t CyCx3USBSSConfigDscr[] =
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint Descriptor Type */
CY_FX_HID_EP_INTR_IN, /* Endpoint address and description */
CY_U3P_USB_EP_INTR, /* Bulk End point Type */
- 0x00,0x04,
+ 0x00,0x04,
//0x02,0x00, /* Max packet size = 2 bytes */
0x01, /* Servicing interval is 2 ** (5 - 1) = 16 Intervals = 2 ms. */
//0x05
/* Super Speed Endpoint Companion Descriptor (Mouse) */
0x06, /* Descriptor size */
CY_FX_SS_EP_COMPN_DSCR_TYPE, /* SS Endpoint Companion Descriptor Type */
- 0x00, /* Max no. of packets in a Burst. */
+ 0x03, /* Max no. of packets in a Burst. */
0x00, /* No streaming for Interrupt Endpoints. */
0x00,0x04, /* Number of bytes per interval = 2. */

@@ -646,15 +646,15 @@ const uint8_t CyCx3USBSSConfigDscr[] =
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint Descriptor Type */
0x05, /* Endpoint address and description */
CY_U3P_USB_EP_INTR, /* Bulk End point Type */
- 0x00,0x04, /* Max packet size = 2 bytes */
+ 0x00,0x04, /* Max packet size = 2 bytes */
0x1, /* Servicing interval is 2 ** (5 - 1) = 16 Intervals = 2 ms. */

/* Super Speed Endpoint Companion Descriptor (Mouse) */
0x06, /* Descriptor size */
CY_FX_SS_EP_COMPN_DSCR_TYPE, /* SS Endpoint Companion Descriptor Type */
- 0x00, /* Max no. of packets in a Burst. */
+ 0x03, /* Max no. of packets in a Burst. */
0x00, /* No streaming for Interrupt Endpoints. */
- 0x00,0x04 /* Number of bytes per interval = 2. */
+ 0x00,0x02 /* Number of bytes per interval = 2. */

#endif

@@ -944,8 +944,8 @@ const uint8_t CyCx3USBHSConfigDscr[] =
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint Descriptor Type */
CY_FX_HID_EP_INTR_IN, /* Endpoint address and description */
CY_U3P_USB_EP_INTR, /* Bulk End point Type */
- 0x40,0x00,
- //0x02,0x00, /* Max packet size = 2 bytes */
+ //0x40,0x00,
+ 0x00,0x04, /* Max packet size = 2 bytes */
0x01, /* Servicing interval is 2 ** (5 - 1) = 16 Intervals = 2 ms. */
//0x05

@@ -954,7 +954,7 @@ const uint8_t CyCx3USBHSConfigDscr[] =
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint Descriptor Type */
0x05, /* Endpoint address and description */
CY_U3P_USB_EP_INTR, /* Bulk End point Type */
- 0x40,0x00, /* Max packet size = 2 bytes */
+ 0x00,0x04, /* Max packet size = 2 bytes */
0x01 /* Servicing interval is 2 ** (5 - 1) = 16 Intervals = 2 ms. */

#endif
@@ -2602,8 +2602,8 @@ const uint8_t CyFxUSBFSConfigDscr[] __attribute__ ((aligned (32))) =
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint Descriptor Type */
CY_FX_HID_EP_INTR_IN, /* Endpoint address and description */
CY_U3P_USB_EP_INTR, /* Interrupt Endpoint Type */
- 0x02,0x00, /* Max packet size = 2 bytes */
- 0x02 /* Servicing interval for data transfers : 2 msec */
+ 0x00,0x04, /* Max packet size = 2 bytes */
+ 0x01 /* Servicing interval for data transfers : 2 msec */
};

//#define CUSTOMHID_SIZ_REPORT_DESC 163
@@ -2794,8 +2794,8 @@ const uint8_t CyFxUSBHSConfigDscr[] __attribute__ ((aligned (32))) =
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint Descriptor Type */
CY_FX_HID_EP_INTR_IN, /* Endpoint address and description */
CY_U3P_USB_EP_INTR, /* Interrupt Endpoint Type */
- 0x02,0x00, /* Max packet size = 2 Bytes */
- 0x05 /* Polling interval : 2 ** (5-1) = 16 MicroFrames == 2 msec */
+ 0x00,0x04, /* Max packet size = 2 Bytes */
+ 0x01 /* Polling interval : 2 ** (5-1) = 16 MicroFrames == 2 msec */
};

/* Binary Device Object Store Descriptor */
@@ -2862,15 +2862,15 @@ const uint8_t CyFxUSBSSConfigDscr[] __attribute__ ((aligned (32))) =
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint Descriptor Type */
CY_FX_HID_EP_INTR_IN, /* Endpoint address and description */
CY_U3P_USB_EP_INTR, /* Bulk End point Type */
- 0x02,0x00, /* Max packet size = 2 bytes */
- 0x05, /* Servicing interval is 2 ** (5 - 1) = 16 Intervals = 2 ms. */
+ 0x00,0x04, /* Max packet size = 2 bytes */
+ 0x01, /* Servicing interval is 2 ** (5 - 1) = 16 Intervals = 2 ms. */

/* Super Speed Endpoint Companion Descriptor (Mouse) */
0x06, /* Descriptor size */
// CY_FX_SS_EP_COMPN_DSCR_TYPE, /* SS Endpoint Companion Descriptor Type */
0x00, /* Max no. of packets in a Burst. */
0x00, /* No streaming for Interrupt Endpoints. */
- 0x02,0x00 /* Number of bytes per interval = 2. */
+ 0x00,0x04 /* Number of bytes per interval = 2. */
};

hid初始化函数:

void
CyFxUsbHidApplnStart (
void)
{
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
CyU3PDmaChannelConfig_t dmaCfg;
uint16_t size = 1024;//512; //0x40
CyU3PEpConfig_t epCfg;

CyU3PUSBSpeed_t usbSpeed = CyU3PUsbGetSpeed();

/* First identify the usb speed. Once that is identified,
* create a DMA channel and start the transfer on this. */

/* Based on the Bus Speed configure the endpoint packet size */

#if 1
switch (usbSpeed)
{
case CY_U3P_FULL_SPEED:
size = 64;
break;

case CY_U3P_HIGH_SPEED:
size = 512;
break;

case CY_U3P_SUPER_SPEED:
size = 1024;
break;

default:
LOG("\r\n what happend helllllllllll Error! Invalid USB speed.\r\n");
//CyFxAppErrorHandler (CY_U3P_ERROR_FAILURE);
break;
}
#endif

 

CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg));
epCfg.enable = CyTrue;
epCfg.epType = CY_U3P_USB_EP_BULK;//CY_U3P_USB_EP_INTR;
epCfg.burstLen = 3;//(usbSpeed == CY_U3P_SUPER_SPEED) ?
// (CY_FX_EP_BURST_LENGTH) : 1;
epCfg.streams = 0;
epCfg.pcktSize = size;

LOG("\r\nCY_FX_EP_BURST_LENGTH = %d\r\n", epCfg.burstLen);

apiRetStatus = CyU3PSetEpConfig (CY_FX_HID_EP_INTR_IN, &epCfg);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("CyU3PSetEpConfig failed, Error code = %d", apiRetStatus);
//CyFxAppErrorHandler (apiRetStatus);
}

//add another endpoint for receive date

CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg));
epCfg.enable = CyTrue;
epCfg.epType = CY_U3P_USB_EP_BULK;//CY_U3P_USB_EP_INTR;
epCfg.burstLen = 3;
epCfg.streams = 0;
epCfg.pcktSize = size;

apiRetStatus = CyU3PSetEpConfig (CY_FX_HID_EP_INTR_OUT, &epCfg);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("\r\ncreate ououit channel CyU3PSetEpConfig failed, Error code = %d\r\n", apiRetStatus);
//CyFxAppErrorHandler (apiRetStatus);
}

/* Flush the Endpoint memory */
CyU3PUsbFlushEp(CY_FX_HID_EP_INTR_IN);
CyU3PUsbFlushEp(CY_FX_HID_EP_INTR_OUT);

LOG("\r\n ENTER CyFxUsbHidApplnStart xxxxxxxxxxxxxxxxxxxxx\r\n");


/* Create a DMA MANUAL_IN channel for the producer socket. */
CyU3PMemSet ((uint8_t *)&dmaCfg, 0, sizeof (dmaCfg));
/* The buffer size will be same as packet size for the
* full speed, high speed and super speed non-burst modes.
* For super speed burst mode of operation, the buffers will be
* 1024 * burst length so that a full burst can be completed.
* This will mean that a buffer will be available only after it
* has been filled or when a short packet is received. */
dmaCfg.size = size;
/* Multiply the buffer size with the multiplier
* for performance improvement. */
dmaCfg.size *= CY_FX_DMA_SIZE_MULTIPLIER;
dmaCfg.count = CY_FX_BULKSRCSINK_DMA_BUF_COUNT;
dmaCfg.prodSckId = CY_FX_EP_PRODUCER_SOCKET;
dmaCfg.consSckId = CY_U3P_CPU_SOCKET_CONS;
dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
dmaCfg.notification = 0;
dmaCfg.cb = 0; //CyFxBulkSrcSinkDmaCallback; //CyFxBulkSrcSinkDmaCallback;
dmaCfg.prodHeader = 0;
dmaCfg.prodFooter = 0;
dmaCfg.consHeader = 0;
dmaCfg.prodAvailCount = 0;

apiRetStatus = CyU3PDmaChannelCreate (&glChHandleBulkSink,
CY_U3P_DMA_TYPE_MANUAL_IN, &dmaCfg);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus);
//CyFxAppErrorHandler(apiRetStatus);
}

/* Create a DMA MANUAL_OUT channel for the consumer socket. */
dmaCfg.notification = 0;// CY_U3P_DMA_CB_CONS_EVENT; //CY_U3P_DMA_CB_CONS_EVENT;
dmaCfg.prodSckId = CY_U3P_CPU_SOCKET_PROD;
dmaCfg.consSckId = CY_FX_EP_CONSUMER_SOCKET;
apiRetStatus = CyU3PDmaChannelCreate (&glChHandleBulkSrc,
CY_U3P_DMA_TYPE_MANUAL_OUT, &dmaCfg);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus);
//CyFxAppErrorHandler(apiRetStatus);
}

/* Set DMA Channel transfer size */
apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleBulkSink, CY_FX_BULKSRCSINK_DMA_TX_SIZE);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("CyU3PDmaChannelSetXfer failed, Error code = %d\n", apiRetStatus);
//CyFxAppErrorHandler(apiRetStatus);
}

apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleBulkSrc, CY_FX_BULKSRCSINK_DMA_TX_SIZE);
if (apiRetStatus != CY_U3P_SUCCESS)
{
LOG("CyU3PDmaChannelSetXfer failed, Error code = %d\n", apiRetStatus);
//CyFxAppErrorHandler(apiRetStatus);
}

CyU3PUsbRegisterEpEvtCallback (CyFxBulkSrcSinkApplnEpEvtCB, CYU3P_USBEP_SS_RETRY_EVT, 0x00, 0x01);
//CyFxBulkSrcSinkFillInBuffers ();
/* Update the flag so that the application thread is notified of this. */

 


/* Update the status flag. */
glIsHIDApplnActive = CyTrue;

LOG("\r\nExit CyFxUsbHidApplnStart yyyyyyyyyyyyyyyyyyyy\r\n");
}

0 点赞
liuzhengxiang
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

需要我把cycx3_uvcdscr.c这个文件发你看看吗?

0 点赞