USB superspeed peripherals Forum Discussions
Hi infineon team,
we have a code that perfectly works on EZ-USB 1.3.1 version. now we try to build it using EZ-USB 1.3.4 version.
we faced memory related issues but we solved it and build was successful device enumerated as camera and HID as well . device is working fine.
the problem is when the HOST application is sending HID request to the device through the HID endpoint, the device didnt recogonise the request using HID callback function.
i have confirmed the request has been sent from the host application using protocol analyzer. But the request the was not detected by CX3 through HID call back function.
kindly help me to solve why CX3 is not receiving Request related to HID.
Note:
1) The HID call back was register successfully.we confirmed using CyU3PReturnStatus_t API.
2) Application is sending HID request.we confirmed using protocol analyzer.
3) The same code is working fine when build on 1.3.1 version.so i dont think there is logical mistake in code (like handling Callback functions).
Hi all,
I get CY_U3P_USB_EVENT_EP_UNDERRUN when getting data from two channels (audio, and video). It happens in two scenarios.
1. If two channels are active for a long time
2. if while both are active one is being stopped.
Seems like this is corrupting data and causes devices to stop responding.
I have checked the below threads for solution but the ones mentioned did not work for me.
1. In this thread I don't understand the usage of the "CyU3PUsbResetEndpointMemories()" to recover the corrupted state. Also found another API call "CyU3PUsbEnableEPPrefetch()" in FX3 1.3.4 version , which should fix the issue but I am not able to properly use it. Where should those guys be called?
2. In this thread the solution is pointing to the spec of GPIF but not exactly mentioned how to fix the GPIF state machine mirroring problem.
Please suggest how to overcome this issue.
Thanks in advance.
Show LessHi, I am already using ARM GCC and -O3, but I need my image to get even smaller to fit on EEPROM. My max file size is 118,528 bytes, and I'm slightly over that.
Is there anything I can strip out of the libraries? Please advise.
Hi all,
I have an Ascella developement kit with the CX3 chip. (https://www.e-consystems.com/Cypress-CX3-THine-ISP-13MP-RDK.asp)
I've successfully run firmware using the Cypress EZ USB Suite and UART for debugging.
Now I'm trying to get the JTAG debugger running. I did everything acording to the guide in the EZ USB suite.
However, it is not able to find a debugging device. I assume it has something to do with the drivers installed.
Could you tell me which exact drivers I need to install in order to get it running?
In the attachements I have screenshots from the currently installed drivers, my debug config and the error message.
Thanks for your help,
M.
Hello,
I would like to build an application where I have one USB->CPU and two CPU->peripheral dma channels. When a buffer from USB is received i have to decide to which of the two CPU->peripheral dma channels the buffer need to be forwarded. I started from the FX3 cyfxbulklpmaninout example and it works. But in the example the incoming buffer is copied to the outgoing. To improve the performance I would like to directly send the incoming buffer to one of the outgoing channels. I cant figure out which API I have to use to send the received buffer to a second channel.
BR
Show LessI have implemented a GPIE state machine including 18 states. Two of them trigger an interrupt. In the callback "CyFxApplnGPIFEventCB " I want to distinguish these two states using the "currentSmState" parameter. I expected numbers between 0 and 17, but I got 139. How do I have to interpret this number?
Show Less
Hi,
I have FX3 device with the "USBIsoSourceSink" exmeple,
I can see in Lecroy trace that i have delay of ~130ns between Data packets in burst mode in "IN End Point"
But the USB 3.2 Spec is Max 100 ns delay
I Attached the trace and also take screen shut,
Is there a way to decrees the delay between data packet in the FX3 device code?
Thanks,
EliW.
Show Less
Hi,
I am new to the community
i have an objective of bringing the Analog Camera video feed to USB via FX3 chip solutions
for conversion of analog video to parallel format i have decided to use ic like ADV7282A series which takes PAL /NTSC video and converts it to parallel video with sync and clk outputs
Post this i would like to use a infinenon solution to grab the data and create a video class node on linux , so that i can be universally used for any kind of linux based SBC as a PAL frame grabber based on USB ouput
Kindly suggest.
Show Less
I followed the steps mentioned in AN65974 to define STREAM_IN_OUT in cyfxslfifosync.h, but I didn't see the code about if def STREAM_IN_OUT in the main cpp source code, and I can't find the image file SF_streamIN.img and slavefifo2b_fpga_top.bit in SDK which is mentioned in page.48 of AN65974. Where can I find them?
Thanks a lot.
Show LessHello,
I'm trying to set up an endpoint, but when I write to the endpoint, I can't read the data from my app or the control center. I'm hoping if I post the code in question, some kind soul can help me figure out what I'm doing wrong.
I've included the function that configures the endpoints and the function that writes log messages to the host machine.
The endpoint in question is 10, and it's an IN endpoint, meaning it goes from the FX3 to the host. It's the last one listed in the descriptor, which means in my list of endpoints it's also the last one. When it isn't clear what value something is, I'll look it up in the debugger and put its value in a comment so you can follow along.
int8_t configureEndpoints()
{
// Wait until descriptor is parsed in another thread
CyU3PMutexGet (&descriptorMutex, CYU3P_WAIT_FOREVER);
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
CyU3PEpConfig_t epCfg;
CyU3PDmaChannelConfig_t dmaCfg;
CyU3PDmaType_t dmaType;
struct ConfigurationDescriptor *config = _getCurrentConfig();
for (uint8_t interfaceIndex = config->firstInterface;
interfaceIndex < config->firstInterface + config->numInterfaces;
++interfaceIndex){
struct InterfaceDescriptor *interface = gInterfaceDesc + interfaceIndex;
// for each interface in a configuration
for (uint8_t endpointIndex = interface->firstEndpoint;
endpointIndex < interface->firstEndpoint + interface->numEndpoints; ++endpointIndex){
struct EndpointDescriptor *endpoint = gEndpointDesc + endpointIndex;
// for each endpoint in an interface
// Configure the corresponding endpoint
CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg));
epCfg.enable = CyTrue;
epCfg.epType = endpoint->type;// CY_U3P_USB_EP_INTR
epCfg.burstLen = 1;
epCfg.streams = 0;
epCfg.pcktSize = endpoint->packetSize; // 528
apiRetStatus = CyU3PSetEpConfig(endpoint->address, &epCfg); // 0x8a
switch(apiRetStatus){
case CY_U3P_ERROR_NOT_STARTED:
errorLoop();
break;
case CY_U3P_ERROR_NULL_POINTER:
// Should never happen
errorLoop();
break;
case CY_U3P_ERROR_BAD_ARGUMENT:
// We got a bad endpoint number from the descriptor
return USB_INVALID_ADDRESS;
case CY_U3P_ERROR_INVALID_CONFIGURATION:
// bursts of more than 1 are only supported on certain endpoints
// We're hardcoding this to false for now anyway, so this should never happen
errorLoop();
break;
}
// Set up the DMA buffer for the endpoint
uint8_t epLeadsToHost = endpoint->address & IN_Endpoint; // 0x80, but used as a boolean
uint8_t addressNum = endpoint->address & ~IN_Endpoint; // 10
dmaCfg.size = endpoint->packetSize; // 528
dmaCfg.count = DMA_CHANNEL_SIZE / endpoint->packetSize; // 16
if (epLeadsToHost && addressNum == 10){
// Debug endpoint
dmaCfg.notification = 0;
dmaCfg.prodSckId = CY_U3P_CPU_SOCKET_PROD;
dmaCfg.consSckId = CY_U3P_UIB_SOCKET_CONS_0 + addressNum;
dmaType = CY_U3P_DMA_TYPE_MANUAL_OUT;
}
else if (epLeadsToHost) {
// Data goes from the device to the host
// This block isn't used for the endpoint we're talking about
}
else {
//Data goes from the host to the device
// This block isn't used for the endpoint we're talking about either
}
dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
dmaCfg.cb = CyFxDmaCallback; // Not used for this endpoint, but shouldn't be called because it has no notifications
dmaCfg.prodHeader = 0;
dmaCfg.prodFooter = 0;
dmaCfg.consHeader = 0;
dmaCfg.prodAvailCount = 0;
apiRetStatus = CyU3PDmaChannelCreate(&endpoint->dmaHandle, dmaType, &dmaCfg);
switch (apiRetStatus){
case CY_U3P_ERROR_BAD_ARGUMENT:
case CY_U3P_ERROR_NULL_POINTER:
// Shouldn't happen
errorLoop();
break;
case CY_U3P_ERROR_MEMORY_ERROR:
// Could not allocate buffers
errorLoop();
}
if (addressNum == 10){
debugChannel = &endpoint->dmaHandle;
}
// the 0 tells the DMA not to limit the transfers.
apiRetStatus = CyU3PDmaChannelSetXfer(&endpoint->dmaHandle, 0);
switch (apiRetStatus){
case CY_U3P_ERROR_NULL_POINTER:
case CY_U3P_ERROR_NOT_CONFIGURED:
case CY_U3P_ERROR_NOT_SUPPORTED:
// we passed a null pointer, which shouldn't happen
// our configuration was wrong, which shouldn't happen
// no buffer was allocated, which shouldn't happen
errorLoop();
}
if (!epLeadsToHost){
// Configure endpoint watermarks
endpoint->dmaThreadNum = USB_ADDRESS_TO_PIB(addressNum) % 4;
apiRetStatus = CyU3PGpifSocketConfigure(
endpoint->dmaThreadNum,
CY_U3P_PIB_SOCKET_0 + USB_ADDRESS_TO_PIB(addressNum),
0, // buffer contains data if watermark is higher than 0
CyTrue,
0);
if (apiRetStatus != CY_U3P_SUCCESS){
errorLoop();
}
}
// Flush the endpoint
CyU3PUsbFlushEp(endpoint->address);
//Configure the GPIF-II socket
}
}
CyU3PMutexPut (&descriptorMutex);
endpointsAreEnabled = CyTrue;
if (config->isHighSpeed){ // true
// The configuration must be high speed. Sending an interrupt without
// the ready pin asserted indicates that the enumeration was successful,
// but at the wrong speed
setReady(CyTrue);
}
else {
setReady(CyFalse);
}
// report when it's finished starting up
extern uint32_t interruptSentTicks;
interruptSentTicks = CyU3PGetTime();
interrupt8051(); // Does some GPIO stuff to ping another microcontroller
breaksAllowed = CyTrue; // First message has been received from host. Who cares if we time out our connection.
return 0;
}
// We have 16 bytes to work with because the smallest DMA buffer size increments are 16 bytes
#define DEBUG_HEADER_SIZE 15
#define DEBUG_FOOTER_SIZE 1
CyU3PDmaChannel *debugChannel;
void debugLog(int length, unsigned char *data, char endpoint){
#ifdef DEBUG_ENDPOINT10 // is defined
CyU3PReturnStatus_t error;
CyU3PDmaBuffer_t buffer;
// Get a buffer to pass in data
error = CyU3PDmaChannelGetBuffer (
debugChannel, /**< Handle to the DMA channel on which to wait. */
&buffer, /**< Output parameter that will be filled with data about the
buffer that was obtained. */
CYU3P_NO_WAIT /**< Duration to wait before returning a timeout status. */
);
if (error == CY_U3P_ERROR_TIMEOUT || error == CY_U3P_ERROR_MUTEX_FAILURE){ // Usually gets stuck here, failing to get the Mutex
return;
}
else if (error != CY_U3P_SUCCESS){
errorLoop();
}
// Copy data over
int transferLength = length; // should be 8 in this example
char wasClipped = 0;
if (length > buffer.size - (DEBUG_HEADER_SIZE + DEBUG_FOOTER_SIZE)){ // header is 15, footer is 1, buffer size is 528
// Shouldn't happen if my buffer sizes are right, but who knows? Better to be safe
transferLength = buffer.size - (DEBUG_HEADER_SIZE + DEBUG_FOOTER_SIZE);
wasClipped = 1;
}
// An easy pattern to recognize so we know we have the byte order right
buffer.buffer[0] = 0xDE;
buffer.buffer[1] = 0xAD;
buffer.buffer[2] = 0xBE;
buffer.buffer[3] = 0xEF;
// The endpoint this data is associated with, or 0xff is it's a generic log message
buffer.buffer[4] = endpoint; // 0 in this example
// 1 if the message has been clipped. 0 if it has not
buffer.buffer[5] = wasClipped;
// Reserved for more details later
buffer.buffer[6] = 0;
buffer.buffer[7] = 0;
buffer.buffer[8] = 0;
buffer.buffer[9] = 0;
buffer.buffer[10] = 0;
buffer.buffer[11] = 0;
buffer.buffer[12] = 0;
buffer.buffer[13] = 0;
buffer.buffer[14] = 0;
// the rest of the data
memcpy(buffer.buffer + DEBUG_HEADER_SIZE, data, transferLength);
buffer.count = transferLength + DEBUG_HEADER_SIZE + DEBUG_FOOTER_SIZE;
// checksum
unsigned char checksum = 0;
for (int i = 0; i < transferLength + DEBUG_HEADER_SIZE; ++i){
checksum += buffer.buffer[i];
}
buffer.buffer[transferLength + DEBUG_HEADER_SIZE] = checksum;
error = CyU3PDmaChannelCommitBuffer (
debugChannel, /**< Handle to the DMA channel to be modified. */
buffer.count, /**< Size of data in the buffer being committed. The buffer
address is implicit and is fetched from the active descriptor
for the channel. */
0 /**< Current status (end of transfer bit) of the buffer being
committed. The occupied bit will automatically be set by
the API. */
);
if (error != CY_U3P_SUCCESS){
errorLoop();
}
#endif
}
As I said in the comment, at the moment it's failing to get the mutex for some reason I don't understand, but earlier today it was getting farther than that and still nothing went through to the host machine. If you can help me understand what I'm doing wrong, or point out some other things I should check, I'd greatly appreciate it.
Show Less