USBFS - Descriptor request failed

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Tranzystomator
Level 1
Level 1
5 questions asked 10 sign-ins 5 replies posted

Hi, 

My project is about making a full-duplex communication between PC and uC (microcontroller). At the uC I have to make a simple wave generator which allow user to chose a few signal type like: sinus, triangular, saw etc. When I will do that I have to convert the signal by ADC converter and pass them to USB port.

The usb port have to be fast, because we have sampled signal. If any sample will be lost, I can go ahead - so I think its good choice to use ISOC Transfer, but the USB also have to provide changing signal attribute, like amplitude or phase, or even change signal type from sinus to saw. To make it possible I want to use second endpoint - control transfer.

Summarize, I have
- first endpoint - CONT Transfer - 16 bytes buffor - use to changing signal type
- second endpoint -  ISOC Transfer - 64 bytes  -  using  for transmitting signal samples

Everything has to be connected with desktop app build with Java and JavaFX to give user simple interface to control and see current signal on board.

I have problem with USBFS. I configured usb descriptors like below.

Prusinowsky_0-1619214093238.png

Prusinowsky_1-1619214111757.png

Prusinowsky_2-1619214137785.png

Prusinowsky_3-1619214162106.png

Prusinowsky_4-1619214176663.png

I don't know why, when i plug my psoc 5LP to my computer sometimes it's works, and sometimes not.

Prusinowsky_5-1619214267230.png

Thanks for helping

 

0 Likes
1 Solution
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello @Tranzystomator 

Can you try using a vendor specific class (0xFF) for your project.

Ekta_0-1619415178422.png

There's a appnote on Implementing USB Trasnfers: PSoC® 3 and PSoC 5LP – Introduction to Implementing USB Data Transfers

You can refer to the Project 1: Implementing Multiple Transfer Types in the Appnote which mentions the detailed steps to create a vendor specific USB Class. In your case you can remove the endpoints and Alternate settings not required by you.

Since PSoC is configured as a Vendor Specific device, Windows asks for a driver (.inf and .sys). You can use the .inf file that comes with the project as a reference.

In the previous posts you had mentioned that you where facing issues when enumerating the USB CDC class as well. I think that this might be due improper configuration of the USB CDC descriptor. Can you please program an existing USB CDC project and let me know if the device is recognized?

Link to PSoC 5LP USB CDC Code example: https://www.cypress.com/documentation/code-examples/ce95396-usb-uart-psoc-35lp

Thanks and Regards

Ekta

View solution in original post

9 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Len_CONSULTRON_0-1619215325510.png

 

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Tranzystomator
Level 1
Level 1
5 questions asked 10 sign-ins 5 replies posted

I've set that to 0x00 but it also not work as expected. 

0 Likes

Have you tried any of the USBFS project examples provided by Cypress?

If so, is any example similar to operation and configuration?

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

I don't understand that when I set 0x02 (CDC) Device Class my computer also doesn't recognize my USB. I've tried Cypress examples, there everything works, but when I create on USBFS based on exactly the same USB Descriptor Settings it's completly failed. Why? I use every settings the same. 

Here is a screen

Prusinowsky_0-1619251684832.png

As I understand if I set Device Class to 0x02 (CDC) my computer would install the default drivers to CDC communication. That's not happening.

0 Likes

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

My project is about making a full-duplex communication between PC and uC (microcontroller). At the uC I have to make a simple wave generator which allow
user to chose a few signal type like: sinus, triangular, saw etc. When I will do that I have
to convert the signal by ADC converter and pass them to USB port.

The usb port have to be fast, because we have sampled signal. If any sample will be lost, I can go ahead - so I think its good choice to use ISOC Transfer, but the USB also have to provide changing signal attribute, like amplitude or phase, or even change signal type from sinus to saw. To make it possible I want to use second endpoint - control transfer.

Summarize, I have
- first endpoint - CONT Transfer - 16 bytes buffor - use to changing signal type
- second endpoint -  ISOC Transfer - 64 bytes  -  using  for transmitting signal samples

Everything has to be connected with desktop app build with Java and JavaFX to give user simple interface to control and see current signal on board.

0 Likes

Prusinowsky,

Thanks for a more detailed description of your project intent.

The USB HW implementation on the PSoC5 is v2.0 (Full-speed).   This is about 12Mbps.  This works out to (12Mbps/8bits_per_Byte - protocol overhead) about 1.3MBps.

Your total USB port bandwidth should not exceed 1.3MBps.  This includes ALL USB devices on the USB port.   Therefore if you are using other USB devices through a USB hub then your overall and burst datarate will be reduced.

What is your maximum sample rate you're expecting on Endpoint 2?  This should be the Endpoint requiring the most bandwidth.

Based on your description, you are creating, in effect, an AWG on the uC (PSoC5).

Arbitrary Wave Generator (AWG)

The PSoC5 has a WaveDAC8 component.   I very much like this component but it has some limitations.

You are not required to use this component but if you study how it works, you might be able to model your TopDesign with many of the 'good' features and possibly add some goodies of your own.

Generating the Wavetype

The WaveDAC8 can be configured to generate a Sine, Triangle, Sawtooth, Square or arbitrary wave from a file.   Basically what you are looking to do ... except ...

The assigned wave is created in FLASH at design time and not run time which is what you are trying to accomplish.  I assume you have your own wavegen code.(?)

If you don't have wavegen code, I remember you can generate each wavegen type using the WaveDAC8.   After the Application Build phase, you can 'steal' the FLASH array for that wave and save it for your project's wavegen.

Generating the Desired Frequency

The WaveDAC8 is intended to output using DMA the selected wavetypes at a fixed period (hence fixed frequency) using the internal clock.  If you use the external clock option, it can generate many frequencies.  If you haven't found this yet, I suggest the DDS24 from to generate many input clock frequencies with very find resolution.    even provides a form of AWG in his examples.

link: Code-Examples/DDS24-24-bit-DDS-arbitrary-frequency-generator-component 

Endpoint 2.  An emulated Oscilloscope

My understanding is that you are planning monitoring the resultant AWG output using a ADC and then to send all this data to the PC to be displayed.

I have some suggestions.

Use DMA with the ADC to capture to RAM

When you create the AWG monitoring using the ADC, use a DMA to capture the live data to RAM.   Since a snapshot of data is faithfully captured to RAM in theory NO data is lost.   You can then send the results across Endpoint 2 of the USB channel with no data loss.

Here is the down-side(s) of this technique.  If you are trying to display and possible store a continuous stream of sample data, this technique could be problematic.  This is most likely to occur if your sample rate exceeds the USB channel bandwidth (let's say 1.3MBps), then you will have 'gaps' in the stream of data.

If you need a continuous stream of data you may have to lower the sample rate and encode a timestamp with the data to be sent.  When you place a timestamp, you can perform PWL (Piece-Wise Linear) interpretation of the data.

Note: Unless the sample rate on a commercial scope is fairly slow to allow for a 'roll mode', it produces a display that has significant 'gaps' in the continuous data being sampled.  That's one of the reasons they use a trigger mode to sync multiple instances of the display across samples.

Incorporate a Trigger mode

If you create a Trigger mode to begin the data to send on EndPoint 2, it will more resemble a scope display.  If you can disable the Trigger mode in the EndPoint 1 settings, you will get the equivalent of 'Auto Trigger' on a scope.

Scope Plotting Code for the PSoC and the PC

 has provided some links to PSoC5 and PC code to send analog data from the PSoC5 and plot on a PC.  It might be useful.

link:  Code-Examples/SerialPlot-interface-to-real-time-data-charts 

I have provided my own Terminal application using Visual C# for the PC that includes a data plotting function.  The source code is provided.   You can use it "as-is" or modify it as you need.

link: Code-Examples/PC-Terminal-Program-with-C-Source-Code 

I hope this long-winded post is helpful.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Tranzystomator
Level 1
Level 1
5 questions asked 10 sign-ins 5 replies posted

Prusinowsky_0-1619216263831.png

 

 
0 Likes
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello @Tranzystomator 

Can you try using a vendor specific class (0xFF) for your project.

Ekta_0-1619415178422.png

There's a appnote on Implementing USB Trasnfers: PSoC® 3 and PSoC 5LP – Introduction to Implementing USB Data Transfers

You can refer to the Project 1: Implementing Multiple Transfer Types in the Appnote which mentions the detailed steps to create a vendor specific USB Class. In your case you can remove the endpoints and Alternate settings not required by you.

Since PSoC is configured as a Vendor Specific device, Windows asks for a driver (.inf and .sys). You can use the .inf file that comes with the project as a reference.

In the previous posts you had mentioned that you where facing issues when enumerating the USB CDC class as well. I think that this might be due improper configuration of the USB CDC descriptor. Can you please program an existing USB CDC project and let me know if the device is recognized?

Link to PSoC 5LP USB CDC Code example: https://www.cypress.com/documentation/code-examples/ce95396-usb-uart-psoc-35lp

Thanks and Regards

Ekta