You are here

psoc 3 kit3 integrated with qt, to send data from psoc 3 to qt | Cypress Semiconductor

psoc 3 kit3 integrated with qt, to send data from psoc 3 to qt

Summary: 2 Replies, Latest post by Pradeep Dayama on 30 Sep 2016 07:18 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
Pradeep Dayama's picture
2 posts


i m playing with psoc3 with qt integration. i m trying to send  a data from psoc 3 to qt, but the problem where i m stuck is, in Qt while receiving data from usb using libusb_blucktransfer, i get a error code -5(error not found).

when i debugged it, found that endPoint IN i m setting in qt is 0x01, but when i cross check the endpoint details in linx machine using "lsusb -v" i see that the End point IN for usb is 0x81,

so changed the Endpoint IN while receiving data from psoc 3 to Qt via libusb_bluck_transfer, the application hangs

can some one please help me out with this,

code snippet for psoc 3 is as shown below


#include <device.h>

#define IN_EP       (0x01u)
#define OUT_EP      (0x02u)
#define BUF_SIZE    (0x05u)

uint8 buffer[BUF_SIZE];
uint8 length;

* Function Name: main
* Summary:
*  Wraps the OUT data coming from the host back to the host on a subsequent IN.
* Parameters:
*  None.
* Return:
*  None.
void main()
    /* Enable Global Interrupts */

    /* Start USBFS Operation with 3V operation */
    USBFS_1_Start(0u, USBFS_1_3V_OPERATION);

    /* Wait for Device to enumerate */
    while(USBFS_1_GetConfiguration() != 0u);

    /* Enumeration is done, enable OUT endpoint for receive data from Host */

        /* Check that configuration is changed */
        if(USBFS_1_IsConfigurationChanged() != 0u)
            /* Re-enable endpoint when device is configured */
            if(USBFS_1_GetConfiguration() != 0u)
        /* Check for data received */
        if(USBFS_1_GetEPState(IN_EP) == USBFS_1_IN_BUFFER_EMPTY)
    buffer[0] = 'a', buffer[1] = 'b', buffer[2] = 'c', buffer[3] = 'd',buffer[4] = '\0';            

            /* Load the IN buffer */
            USBFS_1_LoadInEP(IN_EP, buffer, length);

/* [] END OF FILE */



In QT, first i open the device using Libusb, get the handel of device and use lbusb_bulk_transfer as shown below

e = libusb_bulk_transfer(handle,0x01,my_string,length,&transferred,0);

if i use endpoint_IN as 0x01, i get an error code of -5 and if i change endpoint IN to 0x81, then the application hangs.


thanks in advance


HIMA's picture
Cypress Employee
169 posts


I see that you are not assigning any value to 'length', can you try transferring known amount of data and check. Also please let us know if you are using the USBFS in DMA with Automatic memory management mode.



Pradeep Dayama's picture
2 posts

Hello HIMA, thanks for reply. 

I had figure out that, there were few issues in the code, which are listed below

1. Length is empty, and now i m sending length of buffer which is sent

2. In qt application, once libusb bulk transfer is receiving data, need to delay the code for few seconds, i did it for 1 sec and now data is been received by host from psoc


still the issues not seems to be ending, few issues are as follows

1. while sending data from Psoc, IN_ENDPOINT  is set to 0x01, mode of transfer from psoc to host is usb, i.e bulk transfer. But while receiving data form host, when i use the same IN_ENDPOINT  then the data is not been received, once checked in linux machine found that psoc assigns the default endpoints which start from 0x81. and data seems to be receiving when i use 0x81 endpoint in host application

2. The data which is being received from psoc is jumbled up, totally mixed up

    Eg: data sent from psoc to host is "abcdefghij", data received by host from psoc is "defijdbabcd"

Hope that the issue is due to endpoint mismatch


I m newbee to psoc, so please help me out. Also couldn't get you on "DMA with Automatic memory management mode."

what i did to run the project is, download example project form cypress site for usb, modified for my requirements and  using it. Please let me know how do i check for Mode.


Thanks again

Log in to post new comments.