USB superspeed peripherals Forum Discussions
Hello,
I have a CYUSB3KIT-003. I need to integrate a NOR flash from which I can take firmware to RAM, and then a part of the memory of the NOR flash should act as a Mass Storage device.
What approach should I follow?
Waiting for Reply
John
Show LessLooking at some of the routines provided, in the USBSetupCB vendor custom command processing business, some routines have a call to CyU3PUsbAckSetup followed by a call to CyU3PUsbSendEP0Data or CyU3PUsbGetEP0Data after the CyU3PUsbSendEP0Data or CyU3PUsbGetEP0Data call, and some do not. Do I need to call this or not?
In the following routines, there is a call to the
basic_examples/cyfxbulklpautoenum/cyfxbulklpautoenum.c
/* Callback to handle the USB setup requests. */
CyBool_t
CyFxBulkLpApplnUSBSetupCB (
uint32_t setupdat0, /* SETUP Data 0 */
uint32_t setupdat1 /* SETUP Data 1 */
)
{
CyBool_t isHandled = CyTrue;
CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
uint8_t bRequest, bReqType;
uint8_t bType, bTarget;
uint16_t wValue, wIndex, wLength;
/* Decode the fields from the setup request. */
bReqType = (setupdat0 & CY_U3P_USB_REQUEST_TYPE_MASK);
bType = (bReqType & CY_U3P_USB_TYPE_MASK);
bTarget = (bReqType & CY_U3P_USB_TARGET_MASK);
bRequest = ((setupdat0 & CY_U3P_USB_REQUEST_MASK) >> CY_U3P_USB_REQUEST_POS);
wValue = ((setupdat0 & CY_U3P_USB_VALUE_MASK) >> CY_U3P_USB_VALUE_POS);
wIndex = ((setupdat1 & CY_U3P_USB_INDEX_MASK) >> CY_U3P_USB_INDEX_POS);
wLength = ((setupdat1 & CY_U3P_USB_LENGTH_MASK) >> CY_U3P_USB_LENGTH_POS);
/* The only supported vendor command is to reset the FX3 device. */
if (bType == CY_U3P_USB_VENDOR_RQT)
{
if ((bRequest == 0xE0) && (wLength == 0))
{
glResetDevice = CyTrue;
CyU3PUsbAckSetup ();
return CyTrue;
}
return CyFalse;
}
/* Identify and handle setup request. */
switch (bRequest)
{
/* This is a get status request. The response depends on the target.
* If this is for the device, then we need to return the status
* of the device. If this is for the endpoint, then return the stall
* status of the endpoint. */
case CY_U3P_USB_SC_GET_STATUS:
CyU3PMemSet (glEp0Buffer, 0, sizeof(glEp0Buffer));
if (bTarget == CY_U3P_USB_TARGET_DEVICE)
{
glEp0Buffer[0] = glUsbDeviceStat;
status = CyU3PUsbSendEP0Data (wLength, glEp0Buffer);
}
else if (bTarget == CY_U3P_USB_TARGET_INTF)
{
/* Just send zeros. */
status = CyU3PUsbSendEP0Data (wLength, glEp0Buffer);
}
else if (bTarget == CY_U3P_USB_TARGET_ENDPT)
{
CyBool_t isStall;
status = CyU3PUsbGetEpCfg (wIndex, NULL, &isStall);
if (status == CY_U3P_SUCCESS)
{
glEp0Buffer[0] = isStall;
status = CyU3PUsbSendEP0Data (wLength, glEp0Buffer);
}
}
else
{
isHandled = CyFalse;
}
break;
/* This feature behaves differently depending upon the target.
* If the target is device then, this request is for remote-wakeup,
* test mode, U1_ENABLE and U2_ENABLE. If this is for the endpoint
* then this is for clearing the endpoint stall. */
case CY_U3P_USB_SC_CLEAR_FEATURE:
isHandled = CyFxUsbHandleClearFeature (bTarget, wValue, wIndex);
break;
/* This feature behaves differently depending upon the target.
* If the target is device then, this request is for remote-wakeup,
* test mode, U1_ENABLE and U2_ENABLE. If this is for the endpoint
* then this is for clearing the endpoint stall. */
case CY_U3P_USB_SC_SET_FEATURE:
isHandled = CyFxUsbHandleSetFeature (bTarget, wValue, wIndex);
break;
/* Return the requested descriptor. */
case CY_U3P_USB_SC_GET_DESCRIPTOR:
status = CyFxUsbSendDescriptor (wValue, wIndex, wLength);
break;
case CY_U3P_USB_SC_SET_DESCRIPTOR:
/* ACK the request and do nothing. */
break;
/* Return the current selected configuration. */
case CY_U3P_USB_SC_GET_CONFIGURATION:
glEp0Buffer[0] = glUsbConfiguration;
status = CyU3PUsbSendEP0Data (wLength, glEp0Buffer);
break;
/* Store the value for future use and start the application. */
case CY_U3P_USB_SC_SET_CONFIGURATION:
if (wValue == 1)
{
/* Disable the low power entry to optimize USB throughput */
CyU3PUsbLPMDisable();
/* If the application is already active, then disable
* it before re-enabling it. */
glUsbConfiguration = wValue;
if (glIsApplnActive)
{
CyFxBulkLpApplnStop ();
}
/* Start the loop back function. */
CyFxBulkLpApplnStart ();
}
else
{
if (wValue == 0)
{
/* Stop the loop back function. */
glUsbConfiguration = wValue;
if (glIsApplnActive)
{
CyFxBulkLpApplnStop ();
}
}
else
{
/* Invalid configuration value. Fail the request. */
CyU3PUsbStall (0, CyTrue, CyFalse);
}
}
break;
/* Return the current selected interface. */
case CY_U3P_USB_SC_GET_INTERFACE:
glEp0Buffer[0] = glUsbInterface;
status = CyU3PUsbSendEP0Data (wLength, glEp0Buffer);
break;
/* Store the selected interface value. */
case CY_U3P_USB_SC_SET_INTERFACE:
glUsbInterface = wValue;
break;
case CY_U3P_USB_SC_SET_SEL:
{
if ((CyU3PUsbGetSpeed () == CY_U3P_SUPER_SPEED) && (wValue == 0) && (wIndex == 0) && (wLength == 6))
{
status = CyU3PUsbGetEP0Data (32, glSelBuffer, 0);
}
else
{
isHandled = CyFalse;
}
}
break;
case CY_U3P_USB_SC_SET_ISOC_DELAY:
{
if ((CyU3PUsbGetSpeed () != CY_U3P_SUPER_SPEED) || (wIndex != 0) || (wLength != 0))
isHandled = CyFalse;
}
break;
default:
isHandled = CyFalse;
break;
}
/* If there has been an error, stall EP0 to fail the transaction. */
if ((isHandled != CyTrue) || (status != CY_U3P_SUCCESS))
{
/* This is an unhandled setup command. Stall the EP. */
CyU3PUsbStall (0, CyTrue, CyFalse);
}
else
{
CyU3PUsbAckSetup ();
}
return CyTrue;
}
In the following routines, there is no
serialif_examples/cyfxusbi2cregmode/cyfxusbi2cregmode.c
CyBool_t
CyFxUSBSetupCB (
uint32_t setupdat0,
uint32_t setupdat1)
{
/* Fast enumeration is used. Only requests addressed to the interface, class,
* vendor and unknown control requests are received by this function. */
uint8_t i2cAddr;
uint8_t bRequest, bReqType;
uint8_t bType, bTarget;
uint16_t wValue, wIndex, wLength;
CyBool_t isHandled = CyFalse;
CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
/* Decode the fields from the setup request. */
bReqType = (setupdat0 & CY_U3P_USB_REQUEST_TYPE_MASK);
bType = (bReqType & CY_U3P_USB_TYPE_MASK);
bTarget = (bReqType & CY_U3P_USB_TARGET_MASK);
bRequest = ((setupdat0 & CY_U3P_USB_REQUEST_MASK) >> CY_U3P_USB_REQUEST_POS);
wValue = ((setupdat0 & CY_U3P_USB_VALUE_MASK) >> CY_U3P_USB_VALUE_POS);
wIndex = ((setupdat1 & CY_U3P_USB_INDEX_MASK) >> CY_U3P_USB_INDEX_POS);
wLength = ((setupdat1 & CY_U3P_USB_LENGTH_MASK) >> CY_U3P_USB_LENGTH_POS);
if (bType == CY_U3P_USB_STANDARD_RQT)
{
/* Handle SET_FEATURE(FUNCTION_SUSPEND) and CLEAR_FEATURE(FUNCTION_SUSPEND)
* requests here. It should be allowed to pass if the device is in configured
* state and failed otherwise. */
if ((bTarget == CY_U3P_USB_TARGET_INTF) && ((bRequest == CY_U3P_USB_SC_SET_FEATURE)
|| (bRequest == CY_U3P_USB_SC_CLEAR_FEATURE)) && (wValue == 0))
{
if (glIsApplnActive)
CyU3PUsbAckSetup ();
else
CyU3PUsbStall (0, CyTrue, CyFalse);
isHandled = CyTrue;
}
}
/* Handle supported vendor requests. */
if (bType == CY_U3P_USB_VENDOR_RQT)
{
isHandled = CyTrue;
switch (bRequest)
{
case CY_FX_RQT_ID_CHECK:
CyU3PUsbSendEP0Data (8, (uint8_t *)glFirmwareID);
break;
case CY_FX_RQT_I2C_EEPROM_WRITE:
i2cAddr = 0xA0 | ((wValue & 0x0007) << 1);
status = CyU3PUsbGetEP0Data(wLength, glEp0Buffer, NULL);
if (status == CY_U3P_SUCCESS)
{
CyFxUsbI2cTransfer (wIndex, i2cAddr, wLength,
glEp0Buffer, CyFalse);
}
break;
case CY_FX_RQT_I2C_EEPROM_READ:
i2cAddr = 0xA0 | ((wValue & 0x0007) << 1);
CyU3PMemSet (glEp0Buffer, 0, sizeof (glEp0Buffer));
status = CyFxUsbI2cTransfer (wIndex, i2cAddr, wLength,
glEp0Buffer, CyTrue);
if (status == CY_U3P_SUCCESS)
{
status = CyU3PUsbSendEP0Data(wLength, 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;
}
smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/%E8%B6%85%E9%AB%98%E9%80%9FUSB%E5%A4%96%E8%AE%BE/CYUSB3014-%E6%8E%A7%E5%88%B6%E4%BC%A0%E8%BE%93-CyU3PUsbSendEP0Data%E6%88%96CyU3PUsbGetEP0Data%E8%B0%83%E7%94%A8%E5%90%8E%E6%98%AF%E5%90%A6%E8%A6%81%E8%B7%9F%E7%9D%80%E8%B0%83%E7%94%A8-CyU3PUsbAckSetup/td-p/702881
Show LessWe are building a frame grabber using the CX3 microcontroller and MAX96712 deserializer from Maxim and DS90UB960 deserializer from TI (one PCB with two CX3).
I managed to get image on the TI side and now I'm trying to get image on the Maxim side from a IMX623 imager and is not working as smoothly. On MAX96712 I don't have the option for gated clock so I had to modify the CyCx3UvcAppImageSensorSetVideoResolution function using this thread.
This is the output on the UART and I don't have an image, also no MIPI errors if I use CyU3PMipicsiGetErrors():
PartialBufSize should be the same value every time I assume, do you know what could cause this output?
I observed that if I change multiplier of Unit Clk and fifo delay PartialBufSize becomes more or less stable, maybe the issue is with my MIPI interface Configuration.
For THS-Prepare and THS-Zero I let the values by default, also H-Blanking and V-Blanking I set them as on the working imager, are these project specific and can you help me figure out how should I configure them?
If you need more info about the project please ask.
Show Less
We are using the FX3 to pass USB Bulk Endpoint data to an FPGA via a 32-bit bus using the GPIF. In order to keep the throughput as fast as possible, we would like to just set up an AUTO DMA channel. However, we don't have control over the length of data in each USB message that comes over the endpoint. When the data over USB is not 32-bit aligned, obviously there would be padding bytes on the GPIF. Is there any way to convey that information via the DMA engine to the GPIF state machine that the length of data was for example only 1023 bytes? Then we could either insert a state sending the actual length, or toggle GPIOs or something to let the FPGA know what the true length of the data was.
Right now our only solution seems to be to use a Manual DMA channel to insert a length word into the stream or toggle a GPIO, or force a protocol change which has the USB host embed a length in the data and handle the padding in both directions. Using a Manual channel likely would kill out throughput though, interrupting the processor for each message, since we probably would be seeing smaller messages than the 16K required to absorb the 40us latency of the interrupt.
Thanks in advance for any suggestions!
Show LessI am sending 16bit YUV422 parallel video(1280x1024 SXGA) from FPGA to CY3014. I am able to see usb video using 27 MHz(15 fps), 54 MHz(30 fps), 81 MHz(45 fps) but failed at 108MHz(60 fps). Between different FPS tests, i just change the PCLK.
The config file for descriptor is attached below.
What i suspect is Vertical Blank duration. As it is mentioned in AN75779 It should be greater than 200 us.
For 60 FPS test my vertical blank takes 42 horizontal lines(each line 1688 PCLK) and it is equal to 1688*44*(1/108 MHz) = 656 us.
What can be the problem? Can you assist me for the solution?
Show LessI know, I must be asking for too much,
But is there any way to get a source code of FX3 GPIF II designer?
It's an extremely powerful tool but not being developed/updated that much, so I was thinking to tweak/improve it myself.
Or does Infineon have any interest and willing to invest a time into improving it, in case if I send some feature requests/reports?
Thanks
Show LessI implemented property control codes for brightness, contrast, gamma, etc. in CX3, but after changing each item in AMCAP and pressing OK to close AMCAP, when I look at the property values in AMCAP again, the settings are not updated.I am attaching the code (gamma) below and it would be helpful if you could tell me how to solve this problem.
***********************************************************************************************
CyU3PReturnStatus_t HandlegammaControlReq(uint8_t bRequest) //
{
CyU3PReturnStatus_t status=CY_U3P_SUCCESS;
uint16_t readCount;
static uint16_t gammaVal;
switch(bRequest)
{
case CX3_USB_UVC_GET_LEN_REQ: // Length of gammaVal data = 2 byte.
glGammaEp0Buffer[0] = 2;
CyU3PUsbSendEP0Data (2, (uint8_t *)glGammaEp0Buffer);
break;
case CX3_USB_UVC_GET_CUR_REQ: // Current gammaVal value.
CyU3PUsbSendEP0Data (2, (uint8_t *)glGammaEp0Buffer);
break;
case CX3_USB_UVC_GET_MIN_REQ: // Minimum gammaVal = 26.
glGammaEp0Buffer[0] = 26;
CyU3PUsbSendEP0Data (2, (uint8_t *)glGammaEp0Buffer);
break;
case CX3_USB_UVC_GET_MAX_REQ: // Maximum gammaVal = 70.
glGammaEp0Buffer[0] = 70;
CyU3PUsbSendEP0Data (2, (uint8_t *)glGammaEp0Buffer);
break;
case CX3_USB_UVC_GET_RES_REQ: // Resolution = 1.
glGammaEp0Buffer[0] = 1;
CyU3PUsbSendEP0Data (2, (uint8_t *)glGammaEp0Buffer);
break;
case CX3_USB_UVC_GET_INFO_REQ: // Both GET and SET requests are supported, auto modes not supported
glGammaEp0Buffer[0] = 3;
CyU3PUsbSendEP0Data (2, (uint8_t *)glGammaEp0Buffer);
break;
case CX3_USB_UVC_GET_DEF_REQ: // Default gammaVal value = 0.
glGammaEp0Buffer[0] = 40;
CyU3PUsbSendEP0Data (2, (uint8_t *)glGammaEp0Buffer);
break;
case CX3_USB_UVC_SET_CUR_REQ: // Update gammaVal value.
status = CyU3PUsbGetEP0Data (CX3_UVC_MAX_PROBE_SETTING_ALIGNED, glGammaEp0Buffer, &readCount);
if (status == CY_U3P_SUCCESS)
{
// Update the gamma value only if the value is within the range
gammaVal = glGammaEp0Buffer[0]; //original
I2C_SensorWrite(0x700A,2,glGammaEp0Buffer);
glGammaEp0Buffer[0] = gammaVal;
}
break;
default:
CyU3PUsbStall (0, CyTrue, CyFalse);
break;
}
return status;
}
***********************************************************************************************
Show LessHi!
I'm trying to build a USB-UVC camera using the CYUSB3065-BZXC ICS.
I created a project template from Cypress EZ USB Suite using CX3 Configuration Tool v2.0 (SDK 1_3_5).
I have added some camera profiles for USB2.0 and USB3.0 modes (see img1, cx3config.zip) and am adding I2C registers for my sensor (IMX477).
Project compiles successfully, but the device only lists as USB 2.10 (see img2).
I am attaching the USB descriptors (see cycx3_uvcdscr.zip) and the PCB schematic (see CX3_MIPI.pdf)
Can you help me please?