USB superspeed peripherals Forum Discussions
Hello,
I use cyusb3065 and 0v5640 to tranmit image data by DMA. I config stream dma as CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE dma, and commit data buffer in its dma callback. And I want to send leader before payload and send trailer after payload. I creat another CY_U3P_DMA_TYPE_MANUAL_OUT dma channel to send leader and trailer. I sent trailer and leader when stream dma callback get a short packet.But when I debug my code, I can see Leader and trailer dma get buffer and commit buffer successful, but I can't catch leader and trailer in bushound.What's my problem?
And I confuse how dma channel connet with end point? For example, I commit a buffer in stream dma callback, why dma can send the buffer to stream end point?How dma channel match the end point?
my code:
Stream DMA init:
{
/* Create a DMA Manual OUT channel for streaming data */
/* Video streaming Channel is not active till a stream request is received */
stDmaCfg.size = 32768;
stDmaCfg.count = 2;
stDmaCfg.validSckCount = 2;
stDmaCfg.prodSckId[0] = CY_U3P_PIB_SOCKET_0;
stDmaCfg.prodSckId[1] = CY_U3P_PIB_SOCKET_1;
stDmaCfg.consSckId[0] = CY_U3P_UIB_SOCKET_CONS_3;
stDmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
stDmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT | CY_U3P_DMA_CB_SEND_CPLT;
stDmaCfg.cb = CyCx3UvcAppDmaCallback;
stDmaCfg.prodHeader = 0;
stDmaCfg.prodFooter = 0;
stDmaCfg.consHeader = 0;
stDmaCfg.prodAvailCount = 0;
ui32Status = CyU3PDmaMultiChannelCreate (&g_stParameterSetVariable.stDMAHandleStreamIn,
CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE , &stDmaCfg);
if (ui32Status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4, "\n\rAppInit:DmaMultiChannelCreate1 Err = 0x%x", ui32Status);
}
CyU3PThreadSleep(100);
ui32Status = CyU3PDmaMultiChannelReset(&g_stParameterSetVariable.stDMAHandleStreamIn);
if (ui32Status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4,"\n\rAppInit:MultiChannelReset1 Err = 0x%x", ui32Status);
}
}
Stream DMA Callback:CyCx3UvcAppDmaCallback
{
...
if(type ==CY_U3P_DMA_CB_SEND_CPLT )
{
status = CyU3PDmaMultiChannelSetXfer (&g_stParameterSetVariable.stDMAHandleStreamIn, 0, 0);
if (status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4, "\n\rAplnStrt:SetXfer Err = 0x%x", status);
}
CyU3PGpifSMSwitch(CX3_INVALID_GPIF_STATE, CX3_START_SCK0, CX3_INVALID_GPIF_STATE, ALPHA_CX3_START_SCK0, CX3_GPIF_SWITCH_TIMEOUT);
CyU3PMipicsiWakeup();
if (status != CY_U3P_SUCCESS)
{
CyU3PDeviceReset(CyFalse);
CyU3PDebugPrint (4, "\n\rAplnStrt:SetXfer Err = 0x%x", status);
}
CyCx3_ImageSensor_Wakeup();
}
if (type == CY_U3P_DMA_CB_PROD_EVENT)
{
/* This is a produce event notification to the CPU. This notification is
* received upon reception of every buffer. The buffer will not be sent
* out unless it is explicitly committed. The call shall fail if there
* is a bus reset / usb disconnect or if there is any application error. */
status = CyU3PDmaMultiChannelGetBuffer(chHandle, &dmaBuffer, CYU3P_NO_WAIT);
while (status == CY_U3P_SUCCESS)
{
ui32DataCount = ui32DataCount + dmaBuffer.count;
/* Add Headers*/
if (dmaBuffer.count < CX3_UVC_DATA_BUF_SIZE)
{
EOF = CyTrue;
}
status = CyU3PDmaMultiChannelCommitBuffer (chHandle, dmaBuffer.count, 0);
if (status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint(4, "\r\nCommit Error:0x%x\r\n", status);
CyU3PEventSet(&glCx3Event, CX3_DMA_RESET_EVENT, CYU3P_EVENT_OR);
break;
}
status = CyU3PDmaMultiChannelGetBuffer(chHandle, &dmaBuffer, CYU3P_NO_WAIT);
}
}
else if (type == CY_U3P_DMA_CB_CONS_EVENT)
{
if(EOF == CyTrue)
{
EOF = CyFalse;
status = CyU3PMipicsiSleep();
status = CyCx3_ImageSensor_Sleep();
CyU3PBusyWait (1000);
//Fill Trailer
__SetTrailerBuffer(&stTrailer);
//Send Trailer
SendDMAMessage(&stTrailer, sizeof(IMAGE_TRAILER));
//Fill Leader
__SetLeaderBuffer(&stLeader);
//Send Leader
SendDMAMessage(&stLeader, sizeof(IMAGE_LEADER));
}
...
}
Leader Trailer DMA init
{
stEP1OutDmaCfg.size = 1024;
stEP1OutDmaCfg.count = 3;
stEP1OutDmaCfg.prodSckId = CY_U3P_CPU_SOCKET_PROD;
stEP1OutDmaCfg.consSckId = CY_U3P_UIB_SOCKET_CONS_4;
stEP1OutDmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
stEP1OutDmaCfg.notification = 0;
stEP1OutDmaCfg.cb = 0;
stEP1OutDmaCfg.prodHeader = 0;
stEP1OutDmaCfg.prodFooter = 0;
stEP1OutDmaCfg.consHeader = 0;
stEP1OutDmaCfg.prodAvailCount = 0;
ui32Status = CyU3PDmaChannelCreate (&g_stParameterSetVariable.stLeaderTrailer,
CY_U3P_DMA_TYPE_MANUAL_OUT, &stEP1OutDmaCfg);
if (ui32Status != DH_STATUS_SUCCESS)
{
CyU3PDebugPrint (4, "LeaderTrailerDma Error: 0x%x\n\r", ui32Status);
g_testparam = ui32Status;
return ui32Status;
}
else
{
CyU3PDebugPrint(4, "\r\n LeaderTrailerDma success\r\n");
}
// 设置DMA通道传输大小
ui32Status = CyU3PDmaChannelSetXfer (&g_stParameterSetVariable.stLeaderTrailer, 0);
if (ui32Status != DH_STATUS_SUCCESS)
{
return ui32Status;
}
}
Send Leader and Trailer function:
void SendDMAMessage(uint8_t* buffer, uint8_t len)
{
unsigned int ui32Status = 0;
CyU3PDmaBuffer_t buf_p;
CyU3PDmaBuffer_t stOutBuffer;
ui32Status = CyU3PDmaChannelGetBuffer(&g_stParameterSetVariable.stLeaderTrailer, &stOutBuffer, 0);
if (ui32Status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4, "\r\nGetBuffer Fail = %d\n", ui32Status);
}
else
{
CyU3PDebugPrint (4, "\r\nGetBuffer success\r\n");
}
CyU3PMemCopy(stOutBuffer.buffer, buffer, len);
for (i = 0; i < len; i++)
{
CyU3PDebugPrint(4, "0x%x\r\n", stOutBuffer.buffer);
}
ui32Status = CyU3PDmaChannelCommitBuffer(&g_stParameterSetVariable.stLeaderTrailer, len, 0);
if(ui32Status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4, "\r\nSendBuffer Fail = %d\n", ui32Status);
}
else
{
CyU3PDebugPrint (4, "\r\nSendBuffer success\r\n");
}
ui32Status = CyU3PDmaChannelDiscardBuffer (&g_stParameterSetVariable.stLeaderTrailer);
}
Show LessHi,
My application is to receive data from FPGA i.e...,
FPGA --->GPIF -----> FX3 P-Port ----> S0 Port
I am using GpifToUsb firmware which is modified to work for P-Port to S0-Port.
My doubt is how to make sure that data is sent from FPGA to GPIF interface.I am checking producer and consumer events in DMA callback(FX3) .
Is there any way to check from FPGA side that data is transferred to FX3.And also how monitor flags data from FX3 side?
Regards,
Srujana.
Show LessI now want to copy the sensor configurations into the CX3 firmware. But the sensor configurations occupy 28kB space. And my code area and data area size is 180kB and 30kB repectively by default. The data area space is insufficient. So I want to adjust the code area size to 150kB and the data area size to 60kB. How can I achieve it?
Show LessHey guys,
I have a problem regarding SPI flash programming with the new SDK 1.3.4 on Linux:
With SDK 1.3.3 and cyusb_linux 1.0.4 I used to program cyusb_linux_1.0.4/fx3_images/cyfxflashprog.img into RAM. Afterwards I used the download_fx3 example to program my image to SPI flash. This worked pretty well for SDK 1.3.3.
But as soon as I use the cyfxflashprog.img from SDK 1.3.4 and cyusb_linux 1.0.5, it will not erase the SPI flash anymore (I2C still works). I get this output from download_fx3:
Working with old image
./download_fx3 -i /opt/cypress_1.3.3/cyusb_linux_1.0.4/fx3_images/cyfxflashprog.img -t ram
FX3 firmware programming to ram completed
./download_fx3 -i ./myimage.img -t spi
Info: Found FX3 flash programmer
Info: Erased sector 0 of SPI flash
Info: Erased sector 1 of SPI flash
Info: Erased sector 2 of SPI flash
Failing with new image:
./download_fx3 -i /opt/cypress/cyusb_linux_1.0.5/fx3_images/cyfxflashprog.img -t ram
FX3 firmware programming to ram completed
./download_fx3 -i ./myimage.img -t spi
Info: Found FX3 flash programmer
Error: SPI sector erase failed
Error: Failed to erase SPI flash
Error: FX3 firmware programming failed
I am using a Cypress S25FL128,, which should be compatible...
The FX3 does not print anything regarding SPI on its UART, just
Device initialized. Firmware ID: 50 33 58 46 0 47 4F 52
Just as if it never received the USB vendor requests regarding SPI. When I compile the cyfxflashprog.c source code example from SDK 1.3.4 myself it works perfectly. Can anybody confirm this issue or is it a layer 8 problem? J
Best regards,
Michael
My firmware works at super speed perfectly. Now I want to change to high speed for some reason. But I found that host software cannot receive any data.The CX3 firmware always reports DMA_RESET_EVENT. And I found that CyU3PDmaMultiChannelCommitBufer reports error 0x41(CY_U3P_ERROR_INVALID_SEQUENCE).
The following figure is my sensor configuration in CX3 configuration tool. Can any guy tell me why it report such error? Can the following sensor configuration work at high speed?
Show Less
I have a mipi camera based on CX3 at super speed(USB3.0). It works perfectly in PC but not stable in RK3399(Embedded UBuntu16.04 System). After start-up,it can receive data for some time(several seconds or several minutes). After some time it is blocked. And I find in the firmware debug log that it reports DMA_RESET_EVENT.
CyU3pDmaMultiChannelCommitBuffer reports 0x47(CY_U3P_ERROR_INVALID_SEQUENCE) frequently once every second. So increasing the buffer or adding the code to reset GPIF should not work. Does anybody have any solution?
Show LessHi,
I am transferring data from P-Port of FX3 to S0-Port of FX3 and then to SD Card.For that i am using the below attached firmware.Initially,the device is enumerating as Bootloader device but after programming with below firmware endpoints are not detecting.IO Matrix API is failing what is wrong in IO Configuration Matrix?Can anyone please help me.
when i am adding this to check API success,the device is reseting after programming.
status = CyU3PDeviceConfigureIOMatrix (&io_cfg);
if (status != CY_U3P_SUCCESS)
{
CyU3PDeviceReset(CyFalse);
goto handle_fatal_error;
}
When i am checking this API after debugging
Regards,
Srujana.
Show LessHello everyone,
I have a problem. Could somebody help me?
I want to transfer data between PC and Cypress device. The operating system is Ubuntu 16.04.
I can send data to Cypress device and receive response form it. I also need to keep receiveing data from Cypress device.
When I just connect one Cypress device, it works fine. And If there is some problem with transfering data, I will close cypress device by function 'cyusb_close' and open again by function 'cyusb_open'. And I call this as reopen.
But now I need to connect two or more Cypress devices. And I will transfer with them at the same time. So I create two threads. But if I reopen one device to solve some problem, another device will be closed. And sometimes, it will crash when it is transfer data.
I don't know what happens. And I don't know the solution, either.
So could somebody give me some solutions or some advice.
Thanks in advance!
Show LessHello,
I am opening this discussion on behalf of a colleague who can't speak English and I am not familiar with the subject here.
I hope it gets across fine enough and I appreciate any help on this.
He wants to do either of two thing below. His preference is for the second one but he feels he can't hope for it. Either one works in the end.
Please see attachments for his references.
1)
When FIFO0 is full, I want to switch from FIFO0 to FIFO1 as shown below. Is it possible to do this within 80nS (red in below diagram)?
In the manual it says that it takes several μSs, but i am not sure if I understand it right?
2)
Is it possible to send data of FIFO0 immediately when it is FULL and within 80 nSs make it ready to write next data?
Thank you very much and best regards
Sevgi
Show LessDear All:
Our FX3 connects to a lot of slave devices by I2C, and I found the general call address from the I2C spec as the following figure:
I don't realize the meaning exactly.
It means I can get ALL slave devices ID by the general call address with (0x00, 0x04)?
ex: FX3 connects to 3 devices which slave address is 0x0A, 0x0B & 0x0C respectively.
After writing (0x00, 0x04), FX3 will receive (0x0A, 0x0B, 0x0C)?
Hope guys could provide me some suggestions,
Thank you!
Hughes
Show Less