PORTS Forum

Ports and Interfaces => USB => Topic started by: yusufs on March 26, 2012, 10:12:55 am

Title: USB application with Texas C5515 DSP
Post by: yusufs on March 26, 2012, 10:12:55 am
Dear Friends,

I am working on sending and reading some data betweenTexas Instruments C5515 DSP chip
and  PC through USB. However I have some trouble about finding a driver for the DSP chip
as a USB device. Texas does not provide any drivers for the use as a USB
device. I have worked on WinUSB utility of Microsoft in order to create a generic device
driver. However, after applying the procedure, still I could not solve
the problem. It is good to know that I am using Win7-64bit OS. What do
you recommend me to solve this driver problem? Thanks in advance...

Best Regards.

Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on March 26, 2012, 01:38:10 pm
Do you have any example device firmware for the device? If so, what USB class does it use?

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on March 27, 2012, 01:43:27 am
Yes, I have. There are example applications supplied by Texas for USB communications. Actually, there is an open source driver installation and host application program of this chip. However, it works only in 32bit operating systems. Maybe, you could give me some idea about the differences that 32bit and 64 bit drivers have. Also, is it possible to modify a 32bit compatible driver to a 64bit compatible device driver? I am going to first use bulk transfers than my aim is to use interrupt transfer. Thanks for your interest.

Regards.

Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on March 27, 2012, 10:25:35 am
Every USB communication requires device firmware and a compatible driver on the host.

If the only example firmware you have is for a vendor-provided driver that supports only 32 bit hosts, one option is to modify the driver to work on 64-bit systems. Since the driver is open source, that should be possible. Start by downloading the WDK. I'm assuming it's a vendor-provided driver, not one with wide support such as libusb.

Or you can modify the firmware to work with an existing driver. At minimum you'll need to either change the descriptors to specify a supported class or provide an INF file to assign the new driver (maybe both).

For WinUSB, see:

http://www.lvr.com/winusb.htm

If you're having a specific problem with WinUSB, describe it.

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on March 27, 2012, 11:02:03 am
Hi,
Thank you for your suggestions.
I am working on WinUSB installation ,but I have some problems with signing the catalog file that created for driver package. I have just copied the commands about signing the catalog file.,but I see some errors. Do I need to do something before signing?  Is that necessary for creating a driver file?
Regards..
Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on March 27, 2012, 11:22:20 am
You've probably seen this or something similar:

http://msdn.microsoft.com/en-us/library/windows/hardware/ff553480%28v=vs.85%29.aspx

Does a web search on the errors you're getting bring up anything?

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on March 27, 2012, 11:33:19 am
Thank you. I am going to work on this signing driver issue.
Kind Regards...

Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on March 28, 2012, 09:48:19 am
Hello Mrs. Axelson,

I have created device driver package using WinUSB installation procedure. When I plug the USB cable, PC warns me that an unrecognized device is plugged in. Then I pointed the driver package that I created, actually the .inf file. Then it starts to install drivers. At the end, driver installer wizard gives a error saying that "device cannot start(Code 10)". When I look at the device properties in device manager, I can see the information that I put into the .inf file. What should I do next in order not to see the error?

Best Regards...
Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on March 28, 2012, 12:04:46 pm
A protocol analyzer will show what is happening on the bus during enumeration. If you don't have a protocol analyzer, use whatever debugging tools you have to find out if the host sent a Set_Configuration request with a value > 0 and if so, how the device is responding to other communications from the host.

Viewing the setupapi log files can also be helpful.

http://support.microsoft.com/kb/927521

Jan.
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on April 03, 2012, 02:18:28 am
Now I am trying to see what is happening during enumeration by using debugging tool. For the first endpoint 0 interrupt, I determine the setup packet. The setup packet consists of some unreasonable values such as
bmRequestType=0x14H  bRequest=0x43H. Can you see what the problem is? I will appreciate for any help. Thank you.

Best Regards..

Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on April 03, 2012, 08:27:55 am
Hello again,

I know that I am asking too much questions but I am determined to finish this, so I expect you understand me.:)
My ultimate purpose is to read 64bytes of data in 1 ms guaranteed time. I want to use interrupt endpoints to manage this.
By the way, I have found a sample firmware code for my device for the use as a HID device. I tested it and it works.
I have read HID part of your book(USB Complete) and I saw that I can use interrupt endpoints in a limited way with a HID driver.
What is HID's maximum data rate limit in interrupt transfers? Can I use it for USB 2.0 high speed mode?
Thanks for your help.

Best regards ...
Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on April 03, 2012, 12:14:02 pm
For full- and high-speed devices using the default Windows driver, the shortest maximum latency is 1 ms.

The OS and application can add overhead. For example, you may be unable to call ReadFile to read a report every millisecond. However, the HID can define longer reports, and ReadFile can use a large buffer to retrieve multiple reports at once.

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on April 04, 2012, 10:58:41 am
Hello Mrs. Axelson,

I think, that overhead issue will constitute a risky situation in our case. Today I got into installing Winusb driver. After I completed all of the steps, I tried to install the drivers from the WinUSB driver package that I created. When I select the .inf file (adapted from the one which comes with your  'winusb_cs' host program) ,

Class = USB
ClassGUID={36FC9E60-C465-11CF-8056-444553540000}

It gives an error saying that: "The folder you specified doesn't contain a compatible software driver for your device. If the folder contains a driver, make sure it is designed to work with Windows x64 based systems." Then I changed the device GUID information in the inf file, I changed it with a image class device GUID number. Then it worked and the driver was installed properly. What is the problem here with USB device class GUID?

Additionally, I want to use winusb_cs program that you've written for some read and write operations. In my case , is the device class important for running with your host application?

Thank you for your all help.
Sincerely...

Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on April 04, 2012, 05:35:10 pm
The GUID in the INF should match the GUID your application uses.

On attachment, the folder you specify to the hardware wizard should contain in INF file with the GUID. The INF file in turn should point to the locations of the driver files.

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on April 05, 2012, 09:31:33 am
Hi,
Thank you for all of your help. They were very useful for me.
I have examined source code of winusb_cs program, there is a GUID definition in frmMain.cs file such that WINUSB_DEMO_GUID_STRING = "{42CA71EC-CE1C-44c2-82DE-87D8D8FF6C1E}".
When I put this GUID into my .inf file, it says that  "The install class is not present or is invalid". How can I add this device class to my PC.?

Kind Regards.
Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on April 05, 2012, 10:09:51 am
Place it in the INF file. See the example INF and readme.

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on April 19, 2012, 01:57:05 am
Dear Jan,

Since the last time I posted here, I proceed someway. I installed libusb drivers to my device, the enumeration works fine. Also the device is able to receive and read a 64bytes data packet from the host application. However, I could not send any data to PC. The transfer fails in host application. In my code, when a TX interrupt comes to controller it loads data packet to related FIFO registers. But the packet contains only the data I want to send, in other words there is not any Sync   PID   Data   CRC16 EOP information in the packet. Does that cause the problem? Or what can cause this problem? Thanks in advance.

Best Regards...
Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on April 19, 2012, 10:35:43 am
Generally the controller hardware handles the low-level error checking and packet formatting.

Use a protocol analyzer or whatever debugging tools you have to find out what is happening on the bus.

Is the host sending the data?

If so, is the device NAKing it, ACKing but ignoring the data, not responding at all?

The answers to these will help you isolate the problem.

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on April 19, 2012, 11:13:31 am
I am using USBLyzer analyzer program. As I can see from the screenshot attached here, there are two unsuccessful IN transfer attempts.In status bar "Unsuccessful(Stall PID)" is written. I think, device tries to send packet, bu it is not approved by the host.

Thank for all help.

Yusuf

[attachment deleted by admin]
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on April 19, 2012, 11:31:58 am
Stall is the handshake code returned by the device.

Change your firmware so the endpoint sends data in response to IN token packets instead of stalling.

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on April 27, 2012, 05:03:22 am
Dear Jan Axelson,
I want to thank you due to your help and answers to my questions. Since a few days ago, my device is able to transmit data to PC in any packet size that I want to use and in high speed mode. Thanks for all information you have provided here and into your book.
Best wishes...
Yusuf Sekman
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on April 27, 2012, 09:57:59 am
Excellent! I'm glad you got it working.

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on May 07, 2012, 04:03:32 am
Hello again,
I've set packet size to 512 bytes in high speed interrupt mode. As I am tracing my device transferring data to PC by using USBlyzer, I see that the period between two packet transaction is nearly 500-600us, indeed I expect 125 us to pass between two packet transaction according to high speed usb specification. Do you have any clue about how can I modify my device code or host software in order to decrease microframe interval to 125us? Thanks in advance.
Best of all.
Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on May 07, 2012, 04:20:54 pm
the host OS adds overhead for each call to send or retrieve reports.

For device-to-host reports, increase the size of the ReadFile buffer. ReadFile returns as many available reports as will fit in the buffer.

For both directions, defining longer, multi-packet reports is more efficient.

Jan
Title: Re: USB application with Texas C5515 DSP
Post by: yusufs on September 25, 2012, 09:08:52 am
Hello Jan,

As we are trying to use our usb device that sends continuous data to PC in interrupt mode, we realized that the device works as expected on USB 2.0 port of PC. However, when we plug it into USB 3.0 port, the speed of data transfer decreases a lot. libusb driver installation or data transfer do not fail in usb 3.0 port, but only transfer speed decreases(normally it takes 4ms for transferring each 64 byte packet as host program defines as 4ms. It increases to 32ms on usb 3.0 port of PC.) What do you think about the problem? Thanks in advance.
Best regards..

Yusuf
Title: Re: USB application with Texas C5515 DSP
Post by: Jan Axelson on September 25, 2012, 11:11:04 am
Does increasing the size of the ReadFile buffer help? If so, the problem is likely in the overhead of calling ReadFile. I don't know why it would be worse on a USB 3.0 port.