We're using libusb v1.0.9.0 in C++ code (with a Java front end). We're testing it on multiple versions of Windows and multiple machines for various USB 2.0/3.0 controllers, and we've found a couple of very bad problems.
On Windows 7, it can't see any ports on an "Intel USB 3.0 Extensible Host Controller" platform.
On Windows Server 2008, it can't see certain ports on both the USB 2.0 and 3.0 controllers. Some ports on the 2.0 hub work, and some ports on the 3.0 hub work, but other ports are invisible to the same device, to any device.
The first one might be just a specific controller idiosyncrasy that will be supported soon, but the second one really worries us. Is this kind of behavior common? How do we fix it?
We're using libusb_get_device_list() or libusb_open_device_with_vid_pid().
I had some trouble concerning certain USB 3.0 ports as well, even though it was maybe a little different to your situation. So I am not quite sure if I can help you out, I believe it's more related to a hardware-issue. But keep in mind the following facts:
USB 3.0 hardware is not yet well established (still under development) - some ports are loosing their functionality over the time, especially these quite cheap ones (built-in ports on mainboards with an Intel chipset). Because the current provided over USB 3.0 and the data rate is much higher than USB 2.0, it's not a miracle that these ports made of cheap wire break easily.
Even using a different cable makes a difference, not speaking of hubs - they seem to be still prototypes, at least the ones I used.
Keep looking regularly for the latest drivers of your xHCI. There are often nasty bugs fixed within.
Last, but not least, vary the size of packets sending to your xHCI. Actually, the preferred size is 64 KB, so split up your data in blocks of this size. This is related to the problem of the interrupts which are caused by huge packets. To some xHCIs this is already the reason to surrender (especially if you are running under USB 2.0!).
All in all, the behaviour of different xHCIs (Renesas, Intel, ..) differs quite a lot. It is mostly annoying because the reason is not obvious at all.
A last suggestion: Try tools like the USBlyzer. The last option would be something like Voyager M3i (protocol analyzer), if you are willing to spent about US$30,000 or so..
Related
I'm trying to use Psychopy to trigger a second machine's data collection. I could use an I/O card, but I wondered how difficult it would be to use the NICs in Ad-Hoc mode?
Thank you
We are currently communicating with an eye link 2 running our experiment on one machine and the eye link software on another. In some tests of the mirametrix eye tracker we also used some variations of virtual and real machines talking to one another (as an aside, we never quite got the performance from the mirametrix that we needed).
We mention some of the tools we used here: https://brittlab.uwaterloo.ca/research-tips/
If you have a network card in each machine you could just connect them with an ethernet cable and set up tcp/ip to let the programs on the two machines talk to each other. If one machine needs to also talk to the outside world you could add a second network card (or if a laptop just buy a cheap usb wireless).
With more specifics about what you are trying to achieve others may be able to give you more specific feedback.
I am new to hardware programming(especially USB) so please bear with me and my questions. I am using C++ and I need to send/receive some data (a byte array) to/from a USB port on a microprocessor board.
Now, I have done some serial port programming before and I know that for a serial port you have to open a port, setup, perform i/o and finally close the port. I am guessing to use a USB port, it is not as simple as what I mentioned above.
I do know that I want to use Microsoft standard drivers and implement standard Windows IO commands to accomplish this, since I believe there are no drivers for the microprocessor board for me to interact with.
If somebody can point me in the right direction as to the steps needed to "talk" to a USB port (open, setup, i/o) via standard Windows IO commands, I would truly and greatly appreciate it. Thanks you so much!!
USB in a nutshell is excellent background reading.
For a generic USB module try LibUSB which includes some examples of talking to standard devices. LibUSB-Win32 is the windows port of that library.
You're right though, it's nowhere near as simple as an RS232 port.
What microprocessor are you using? Does it come with any USB hardware or are you thinking of trying to implement it all in software (not something I'd recommend even contemplating!). A lot of microprocessors come with code samples which can emulate simple HID USB devices like keyboards / mice etc. which you can use as a starting point. Failing that, there's probably a few off-the-shelf options which will save you a lot of headaches :-)
Find out the USB chipset used on the microprocessor board, e.g. Ftdi, Cypress, etc. These manufacturers supply drivers, libraries and example programs for the comms, this is the easiest way.
There are no 'standard' drivers as such unless your board is set up as an HID device, however if you are using Windows, Microsoft supply a WinUSB.sys 'generic' driver which may or may not meet your needs (it doesn't support Isochronous transfers).
Should you write a driver for the USB device that will attach itself. If you know the type of chip that has the USB i/o on the board, the driver will be for that device.
There may already be driver's for that chip if it is an STM or there may be an API to help develop drivers for it. It would probably be a custom device but you should look through device types to see if there is an existing type that matches your device. If so there may also be a driver already for it which you can use. Information about the board is necessary.
WRITE YOUR OWN DRIVER
With out getting too far into it, you should learn Microsoft's driver model, the difference between user mode and kernal mode drivers, what driver node's represent, driver hierarchy and how they logically attach themselves, different types of drivers (filter, function, bus), how kernal driver's communicate with user interface, dynamic link libraries, frameworks and API's, WDM framework/API, KMDF and UMDF API's and this is just a short list.
OR you can use an existing driver.
USE USB MICROCONTROLLER SUPPLIED DRIVER
We do not know what firmware the USB microcontroller is using, if any. If there is no firmware (if say the chip came with out it or relies on eprom to store it and not flash) then if we knew if the chip supports usb bootloader, you can flash it or load it's firmware through the USB and there is no need for JTAG or other peripherials. Likely the usb alone is capable of getting you off the ground and anywhere from there. Typically these types of questions arise when considering board's with out a USB microcontroller.
Here is a link to a slighly related driver. Most USB microcontrollers serve the purpose of switching USB communication to UART as most microconrollers that actually do the thinking and control everything are not equiped with USB i/o but instead UART or some other i/o pins like I2C or SPI etc..
https://www.silabs.com/products/mcu/Pages/USBXpress.aspx
That driver may actually work, if not something similar but for the manufacturer of your USB microcontroller; will almost certainly do the job. Hope this helps.
By hardware programming, do you mean you will be programming the microcontroller? If so, there is no way you will use "standard windows drivers" or anything like that.
The USB standard is very thick. Check it out here
It is a very involved topic and I recommend finding USB implementations already created for your microcontroller. (which we may be able to find if you gave us more info)
What kind of microprocessor and what kind of board?
Many processors come with support for USB ports. Also, some hardware boards come with USB contollers too.
For example, the processor that my shop is using comes with two USB controllers that can act as a hub or as a device. We're even adding another processor to act as a USB controller.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm currently working on a serial interfacing project based upon connecting to the rs232 port. However, seeing as a decent number of laptops and/or PC's seem like they might have their rs232 ports disappear within the next 5 years, I was considering using the RJ45 modular port for my project (EIA/TIA 568). However, I'm not quite sure how to denominate it when accessing the port through the Win32API (I'm programming in C++). It's currently programmed to "COM1". Does anyone know how I can find out what this port is called or how to configure it so it can be used in this manner?
I'm really confused... RJ45 ports on laptops/PCs are for Ethernet connections, aren't they? I don't understand how you could utilize one as a COM port.
If you need a serial port, and don't need ultra-low latency*, pick up a USB <-> RS232 converter, they run about $20-$30 and work just fine: from the PC software's point of view it looks like a regular old COM port.
*RS232 itself has low latency, but if you use USB as part of the serial connection, you're limited by the timing of its frames and how the USB serial converter uses them... I seem to remember USB has 1msec and 16msec frame timing; USB 2.0 appears to have 125usec microframes but I don't know if any of the serial converters manage to use them. You'd run into latency issues if you're using a command-response protocol in RS232 with lots of back-and-forth traffic.
The USB port has been starting to take over the duties of RS-232 for the last few years.
You should seriously consider USB as an interface for your project.
Oh, yes; that might seem like a ludicrously obvious statement -- "duh! nobody's been using Serial for a decade now".
Not so easy: there is a lot more than mice and printers out there.
RS-232 has been the preferred interface for custom-build devices, scientific instruments, and low-production devices far long after everybody started using USB for mice and high volume consumer devices.
My most direct experience comes from amateur astronomy and accessibility computer accessories for the visually-impaired. Until not too long ago, all of the above were still mainly RS232 devices, and a common headache has been finding a way to plug those in a modern laptop. RS232-to-USB consumer adapted will sometimes work, sometimes not. At least one manufacturer of accessibility devices (a braille embosser) has stated to us that they don't recommend RS232-to-USB adapters because they have had (unspecified) problems with them.
I don't know the cause. Maybe USB components are more expensive, maybe it's the need to interface with legacy devices that would be expensive to redesign; maybe it's what the engineers know. Maybe it's just "ain't broken, don't fix it" or simple inertia.
It's only been in the last couple of years, but I've finally seen a number of these devices offered with USB ports instead of serial RS232; in some cases, RS-232 versions have been discontinued. It's just taking a little longer.
On the meta level, what you want to do is a bad idea. You're inventing your own standard for hardware, in a manner which is wholly inconsistent with established protocols.
You are much better directly using either USB or a DB-9 connector with RS-232. RS-232 is really quite good, but it's getting outdated(unfortunately, it's much simpler than usb).
For salable products, you'd want to have both. For researchy/geek products, USB is much better.
You should be able to enumerate your com ports from Windows and open a given com port as a file(I've done it).
The RJ45 port you are referring to is an Ethernet port, not a serial port.
If you are looking for a more current technology, you should investigate the USB interface. If you really want Ethernet, you might be interested in the XPort from Lantronix.
-- Edit --
What type of device are you looking to use as a host?
You're worried about an aging but common standard (RS-232) going away, but you're going to use a non-standard, that never was?
The documents you refer to appear to be an alternate wiring method for a typical RS-232 port.
By the way what you're referring to as RJ-45 is a wiring standard not an interface. RS-232 can be connected via DB-9, DB-25, RJ-45 or screw terminals. The voltages and signaling are part of the protocol. The connector type is determined more by convenience.
Most computers use an RJ-45 for ethernet. The only time I've seen RJ-45 connections for serial connections was on networking equipment or terminal servers.
http://site.gridconnect.com/docs/PDF/xportmanual.pdf
you mite get some ideas from reading this manual.
the way this manufacturer communicates with the product is by the rs-232 port on the camera and the Ethernet connection. the plug combines both the software to connect and the plug with samples.
Although I would like to have this setup , I am trying to make it myself rather than buying it.
You may just consider buying the product and just shairing back to this thread the way they comuncate and the wireing of the plug or at least the fact that the conversion from serial to lan a valid solution.
I am also with a laptop that I want to talk to a CNC machine by way of rs-232 (25 Pin serial) and the LAN connection on the laptop.
It is not about keeping the past alive or saying whitch standard is better or worse than another.
It's about being able to run the CNC machine with the laptop and How to wire the RS-232 to the LAN 45rj - nine pin connector on the laptop and what software to use to make it happen.
::::::NOTE::::::
Also I wish to have the ability to use a Microsoft sidewinder joy stick that uses another connection ; a """" A Game Port """"" another failed attempt to make things easier. Run the CNC for use as a CMM or Computer Measuring Machine.
A little known fact is that people should only give information , if they know what they are talking about.
Correct me if I'm wrong, but does the Yost wiring standard not allow one to connect to an RJ45 port in order to do serial communications?
http://yost.com/computers/RJ45-serial/
http://www.lammertbies.nl/comm/cable/yost-serial-rj45.html
All I'm wondering is how to actually access the port from the win32 API. Am I terribly off base here?
– Nicholas Sullivan
Maybe you are thinking about something like this...
http://www.comtrol.com/products/specifications/30130-1
Julianno Jungle
My friend is working on a project in which he needs to get some digital signals into a computer to display/manipulate them.
So I advised him to insert those signals into a USB port due to it's popularity (because the device (which outputs the signals) and the program used for display and manipulation should both be designed for real world usage and might be sold in the market)
The targeted platform is Windows primarily but it would be better if the software was cross-platform.
And my friend has knowledge in C++, and wouldn't mind learning C as well.
Where should he start, and what are the steps to get the signals into memory?
Many Thanks
There is a great article here: USB hardware/software integration that describes the process in full.
Get a Labjack or one of the Phidgets. (I've used the former several times, not the latter) They're fairly inexpensive and both have Java driver support, among other things. (like LabView drivers)
There are more ports on computers, and many ports are easier than USB. USB supports 127 devices, and therefore devices have to cooperate. On the other hand, a microphone input is meant for exactly one input. You can sample it at 8 bit/22Khz or better, and typically you get HW buffering. You can also use existing drivers, and simple APIs.
I am trying to connect to a single USB device using the USB host port on an Atmel processor. I have an embedded system with limited memory and no OS. I want to implement a simple dedicated host to interface to a single USB slave device.
Can anyone guide me to a simple USB host implementation?
The processor is the Atmel AT91SAM9261S.
First of all if i remember correctly AT91SAM9261S have OHCI usb controller on board and you need to implement at least simple host controller driver (you can take a look on Linux implementation) . Depending on the transfer types your device will be using it might be not very hard - to very hard :) There is no trivial way to implement usb stack.
After implementing a controller driver you will need to take care usb device enumeration part take a look at Chapter 9 of USB spec. And only after this you can start implementing your device logic.
For simplified use case there is a lot of code that could be omitted, but without good usb background is hard to decide what is relevant and what is not.
Any way if you are looking for commercial solution my company can provide one.
I've used the RTUSB-32 stack from On-Time. It is a small foot print stack and was easy to integrate into our environment and the documentation is good. They abstract out nicely the needed support so that it is completely platform and OS neutral and has a relatively small number of hooks you need to provide to it - ie: It is well encapsulated.
Since you get all the source, you'll see that the code is not the most well constructed code in the world, certainly, but it can be deciphered without a whole lot of work if needed. In any case, it basically "just works" without issue. We have had it running in some products for a few years now and have only run into one compatibility problem with the stack where it wasn't quite doing auto-discovery quite right with a certain type of USB 2.0 hub. We sent them a sample of the hub and they had a patch for it within a few days. Hard to beat that. Overall, I consider it a good value and certainly beats sitting down to write the thing from scratch.
This would be so much easier if your device didn't have to be a host :-P, because Atmel provides example source code for USB devices. If I were you, I'd look into using one of the USB-loving RTOSs on Atmel's AT91SAM third party page which might entail the USB stack from jungo as suggested by Ilya.
If you do write your own OHCI driver, libusb could be helpful as an implementation of the upper layers of the USB stack.