Jump to content

Using USB as general purpose serial bus?


NormL

Recommended Posts

I just found this forum, and hope you can help me out. This is my first post, so please be gentle...

I am developing a device that interfaces between a sensor and a host PC. The device will digitize the sensor signal and send it to the host running a LabVIEW VI (which I also need to develop). I'd like to use USB to transfer the data, and had some questions:

Can I use the USB as a general purpose serial bus, similar to RS232, to just dump data from the device to the host, sending a few bytes at a time?

Assuming the above is possible, what's the best way to read the data? LabVIEW has a few USB VIs, but I'm not having much success figuring them out.

The interface device has a PIC18F4550 microcontroller, which has a built-in USB controller. I'd really prefer to use USB to save space, and because the data rate could get fairly high for RS232. However I'm beginning to feel this is a fool's errand, and I should just cut my losses and go with RS232.

Any advice would be appreciated. Thanks - Norm Lind

Link to comment

I think a simple option would be to use USB to RS232 adapters on both ends, and I may have to resort to that. What I'd really like to do is avoid the adapters. To provide a bit more background into my problem, the device would just be spitting data over the USB. It has no vendor ID or product ID - it's even more "raw" than USB RAW.

Link to comment
I think a simple option would be to use USB to RS232 adapters on both ends, and I may have to resort to that.  What I'd really like to do is avoid the adapters.  To provide a bit more background into my problem, the device would just be spitting data over the USB.  It has no vendor ID or product ID - it's even more "raw" than USB RAW.

4568[/snapback]

This will create trouble no matter what. An USB device without vendor ID and product ID can't be enumerated by the USB subsystem and consequently won't be visible at all. There is really no way you can trick LabVIEW or other software into seeing such a device without completely writing a kernel device driver to replace the OS provided USB handling. And writing kernel device drivers is a task you for sure don't want to get into.

Try to read into the USB spec and what is necessary on your embedded controller to properly implement a basic USB handling. Most embedded controllers with built in USB port come with example source code how to implement some kind of proper USB device type. For not to fast communication the emulation of a HID (Human Interface Device) interface will be usually the simplest method, since you won't need to implement any device driver on the OS side. For faster communication you may need to resolve to a raw USB data stream device and in that case you either need to write a device driver on the computer side or use VISA control to create an according VISA device interface. For raw devices it won't be trivial as there are much less source code examples for embedded controller firmware to do this, as well as the need to fiddle on the computer side with the device interface programming. For VISA there are a few interesting application and technical notes on www.ni.com, how to go about this.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.