- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
since response transfer is additionally needed from the existing firmware example
when Control OUT (CY_FX_RQT_I2C_EEPROM_WRITE) transfer using write() function of "CCyControlEndpoint"
among CyAPI library interface classes at PC application software occurs,
following code as shown below have been added.
glEp0Buffer[0] = status;
status = CyU3PUsbSendEP0Data(1, glEp0Buffer);
However, timeout error (65) occured in CyU3PUsbSendEP0Data.
I would like to know if there is some way to get this problem solved.
/* Callback to handle the USB setup requests. */
CyBool_t
CyFxUSBSetupCB (
uint32_t setupdat0,
uint32_t setupdat1
)
{
uint8_t attr, rqt, i2cAddr = 0;
uint16_t value, index, length;
CyBool_t isHandled = CyTrue;
CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
/* Parse the control request parameters. */
attr = (uint8_t) (setupdat0 & 0x000000FF);
rqt = (uint8_t)((setupdat0 & 0x0000FF00) >> 8);
value = (uint16_t) (setupdat0 >> 16);
index = (uint16_t) (setupdat1 & 0x0000FFFF);
length = (uint16_t) (setupdat1 >> 16);
/* Fast enumeration is used. Only vendor is handled here. */
if ((attr & CY_U3P_USB_TYPE_MASK) != CY_U3P_USB_VENDOR_RQT)
{
return CyFalse;
}
switch (rqt)
{
case CY_FX_RQT_I2C_EEPROM_WRITE:
i2cAddr = 0xA0 | ((value & 0x0007) << 1);
status = CyU3PUsbGetEP0Data(length, glEp0Buffer, NULL);
if (status == CY_U3P_SUCCESS)
{
CyFxFlashProgI2cTransfer (index, i2cAddr, length,
glEp0Buffer, CyFalse);
}
glEp0Buffer[0] = status;
status = CyU3PUsbSendEP0Data(1, glEp0Buffer);
break;
default:
/* This is unknown request. */
isHandled = CyFalse;
break;
}
/* If there was any error, return not handled so that the library will
* stall the request. Alternatively EP0 can be stalled here and return
* CyTrue. */
if (status != CY_U3P_SUCCESS)
{
isHandled = CyFalse;
}
return isHandled;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Write() of CCyControlEndpoint is for OUT transfer and CyU3PUsbSendEP0Data() is used to respond to IN packet. Looks you're confusing the direction of transfers.
Regards,
Anand