cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

RaAl_264636
Contributor II

Hi,

I've a PSoC 5LP with two virtual COM ports (EP1 through EP6) and two interrupt endpoints, configured as a IN/OUT pair with 64 bytes packet size and 1ms. Those two endpoints are also accompanied by an interface association descriptor (see attachment) to be able to bind the CyUSB3.sys driver to this interface (this is my understanding of how to use the IADs when the device provides more than one function and/or endpoints for different tasks).

The VCPs are working, but I can't access the interrupt endpoints. The current test setup is as follows:

I'm using the 'USB control center' application, which is part of the FX3 SDK. The two interrupt endpoints of the device are correctly detected. I select the detected interrupt out endpoint of the device, and send some text to the device, but I'm getting 'error 997'.

The device firmware is merged from the USBFS_UART example source code and the AN56377 'PSoC 3 and PSoC 5LP USB Transfer Types' application note example #1. Using the original AN56377 source code, the device works well, so it's not a faulty hardware. Now, how can I figure out on which side of the USB cable the error is? It's either my driver INF file and the binding to the CyUSB3.sys driver (I doubt because the device manager doesn't show errors, the VCPs are working and the device and the two endpoints are correctly detected by the USB control center application) or my device firmware - but it's simply extended the USBFS_UART example source code by the interrupt endpoint part of the AN56377 example #1 code. So, in fact the main function pseudo code is as follows:

void main(void) {

//device initialization (same a USBFS_UART code)

...

//main loop

  for(;;) {

    //check for USB configuration change from host

    {...}

    //service USB CDC, extended for two VCPs

    {...}

    //code snippet from AN56377 for interrupt IN/OUT handling

    if(USBFS_1_GetEPState(8) == USBFS_1_OUT_BUFFER_FULL) {

        countI = USBFS_1_GetEPCount(8);

        USBFS_1_ReadOutEP(8, bufferIrx, countI);

        USBFS_1_LoadInEP(7, bufferIrx, countI);

        USBFS_1_EnableOutEP(8);

    }

  }

}

The main difference from AN56377 is that in my implementation there's only one alternate setting 0, which directly has the two interrupt endpoints assigned. From my understanding, AN56377 needs alternate setting 0 with no endpoints because of the supported bulk interface. That's why I assigned the two endpoints directly to alternate setting 0.

So, anyone can help me figuring out what's going wrong?

Regards

0 Likes
Reply
1 Solution
AnkitaS_51
Employee

Hi,

There are multiple Points here to consider:

>> There was no need for IAD for single Custom interface because IAD is used to bind multiple interfaces.But here it was only one Custom interface.

>>Please install FX3 SDK (if you didn't did so already) from this link because it gives you latest cyusb3 driver and Control Center app.

I am attaching the project and hex file  which worked for me for reference in which I made few changes ( removing a IAD and changing PID mainly)

>>  installed the driver cyusb3.sys for the Custom_interface from this path :

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\driver\bin\win7\x64

Then the Custom Interface will get enumerated.

Then update the remaining CDC Communication Interface0 & 1 by using Usbfs_1_cdc.inf present at this path:

Project_Folder>\Generated_Source\PSoC5

Then after all the proper binding of .inf files , the ports will get enumerated as shown in image Enumeration_custom_CDC.png

View solution in original post

0 Likes
Reply
9 Replies
AnkitaS_51
Employee

Hi,

Please refer to this Code example  which shows an implementation of dual COM PORT with a single USBFS component which may be useful:

https://www.hackster.io/hima/designing-dual-com-port-with-psoc-5lp-usb-2e15f2

0 Likes
Reply
RaAl_264636
Contributor II

Hello anks,

thank you for this link. But my problem is not with the CDC (this works), it's with the two remaining endpoints. I want to communicate with them by CyUSB3.sys and CyUSB3.dll.

Regards

0 Likes
Reply
AnkitaS_51
Employee

Can you please attach the creator project

0 Likes
Reply
RaAl_264636
Contributor II

Hello anks,

attached you'll find the project archive.

Regards

0 Likes
Reply
RaAl_264636
Contributor II

Hello anks,

any news about it?

Regards

0 Likes
Reply
AnkitaS_51
Employee

Hi,

There are multiple Points here to consider:

>> There was no need for IAD for single Custom interface because IAD is used to bind multiple interfaces.But here it was only one Custom interface.

>>Please install FX3 SDK (if you didn't did so already) from this link because it gives you latest cyusb3 driver and Control Center app.

I am attaching the project and hex file  which worked for me for reference in which I made few changes ( removing a IAD and changing PID mainly)

>>  installed the driver cyusb3.sys for the Custom_interface from this path :

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\driver\bin\win7\x64

Then the Custom Interface will get enumerated.

Then update the remaining CDC Communication Interface0 & 1 by using Usbfs_1_cdc.inf present at this path:

Project_Folder>\Generated_Source\PSoC5

Then after all the proper binding of .inf files , the ports will get enumerated as shown in image Enumeration_custom_CDC.png

View solution in original post

0 Likes
Reply
RaAl_264636
Contributor II

Hello anks,

thank you. I got your example to work. Also I can communicate with the device using custom PC software.

A few questions:

  1. I understand that the IAD is not necessary because those two endpoints are the last ones available. In this case it wouldn't make any difference if I use IAD or not, right? So the project would also run if I keep the IAD? In other words, if I had abort and reset the pipe, the original project would also work?
  2. If I'd use one CDC and two pairs of IN/OUT endpoints (each pair has its own task), I definitely need IAD, right?
  3. Your screenshots show the enumeration as 'Billboard Bridge Vendor CFG'. According to the contents of cyusb3.inf the corresponding product ID value is either 0x5218 or 0x5219. However, the project modified by you has a product ID of 0x0009. Please clarify.
  4. What's the reason of aborting/resetting the pipe? The example project of AN56377 doesn't need those steps. When and where are those steps needed?
  5. The PSoC firmware of AN56377 uses the USBFS_1_ReadOutEP() function with the number of bytes received from host. The USBFS_1_LoadInEP() function uses the fixed value of maximum packet size as number of bytes to transfer. Why it doesn't use the number of bytes received?

Regards

0 Likes
Reply
AnkitaS_51
Employee
  1. I understand that the IAD is not necessary because those two endpoints are the last ones available. In this case it wouldn't make any difference if I use IAD or not, right? So the project would also run if I keep the IAD? In other words, if I had abort and reset the pipe, the original project would also work?

>>Ya, it should work.

  1. If I'd use one CDC and two pairs of IN/OUT endpoints (each pair has its own task), I definitely need IAD, right?

>>You need IAD when you have multiple interfaces.Please check this KBA for proper understanding:

Implementing USB Composite Device with PSoC 3, PSoC 4L, or PSoC 5LP - KBA223141

  1. Your screenshots show the enumeration as 'Billboard Bridge Vendor CFG'. According to the contents of cyusb3.inf the corresponding product ID value is either 0x5218 or 0x5219. However, the project modified by you has a product ID of 0x0009. Please clarify.

>>you can manually choose any of the names that get listed for any PID

  1. What's the reason of aborting/resetting the pipe? The example project of AN56377 doesn't need those steps. When and where are those steps needed?

>>Seems like there is a Halt condition for EP for that you need aborting/resetting the pipe

  1. The PSoC firmware of AN56377 uses the USBFS_1_ReadOutEP() function with the number of bytes received from host. The USBFS_1_LoadInEP() function uses the fixed value of maximum packet size as number of bytes to transfer. Why it doesn't use the number of bytes received?

>>That you need to handle in your firmware to send that no. of bytes as received to send using API USBFS_1_LoadInEP() function

RaAl_264636
Contributor II

Hello anks,

would be nice if you could answer the questions. This would help me (and maybe others) to understand what happens (or why something should happen).

Regards

0 Likes
Reply