Page 1 of 1

Using an Obdev AVR-USB device with Labview

Posted: Sun Apr 06, 2008 12:28 pm
by scls19fr
Hello,

I would like to know if there is a way to send a byte (using Labview under Windows) to an Obdev AVR-USB device.

For now I'm using a FTDI (bought at SparkFun on a breakout board)
http://www.sparkfun.com/commerce/produc ... cts_id=718

As FTDI is a surface-mount device it's not very convenient to use it ! So I would prefer using a USB software implementation (like the Obdev AVR-USB)
FTDI provides 2 kinds of drivers
- VCP : Virtual COM Port.
- D2XX : Direct USB drivers

Using VCP is very easy because your device act like a serial device !
Using D2XX drivers with Labview is not very difficult because FTDI provide Labview samples which call a DLL
see http://www.ftdichip.com/Projects/CodeEx ... abVIEW.htm

So I would like to do the same (sending a byte with Labview) with an Obdev AVR-USB device

Best regards

Posted: Mon Apr 07, 2008 10:08 am
by christian
See the AVR-CDC example at http://www.recursion.jp/avrcdc/. This is a virtual COM port.

Please note that there seem to be problems with the driver on Vista which have not been resolved yet.

Posted: Mon Apr 07, 2008 2:09 pm
by scls19fr
All right !

But do you think that my device program (that generate a pulse width modulated signal from 1ms to 2ms with a period of 20ms)
1ms when receiving 0x00=0
2ms when receiving 0xFF=255
can also support the USB stack for Virtual COM port and fit in an ATMega8 ?

Using a Virtual COM port with Labview can be done using NI VISA
http://zone.ni.com/devzone/cda/tut/p/id/4478
Thank for the link about AVR-CDC

Do you know if something has ever been done to avoid using Virtual COM Port (like the D2XX drivers for FTDI ?) http://www.ftdichip.com/Drivers/D2XX.htm

Posted: Mon Apr 07, 2008 4:19 pm
by christian
I must admit that I don't know what Labview is.

CDC mode uses ~ 90% or more of the CPU's time. If you just want to generate a PWM signal, that can be done in hardware with timer1, the hardware should therefore be good enough.

AVR-USB can implement all types of interfaces. I don't know D2XX, but I'm sure you can emulate the FTDI with AVR-USB. Or you can design your own driver based on control and optionally interrupt transfers.

See the documentation linked from http://www.obdev.at/avrusb/ for details.

Posted: Mon Apr 14, 2008 8:25 pm
by spiff
scls19fr wrote:But do you think that my device program (that generate a pulse width modulated signal from 1ms to 2ms with a period of 20ms)


Since I guess from the timing you are mentioning, that you want to control an RC servo, you should probably look at the USB-Servo projects:
http://obdev.at/products/avrusb/prjcontrol.html

Posted: Wed Apr 16, 2008 4:44 pm
by scls19fr
Thanks for the link but I ever made my own AVR-gcc program to manage servo ! So the problem is just about using AVR-USB with Labview.

virtual com port

Posted: Fri May 09, 2008 4:13 pm
by Guest
Since the CDC use more than 90% of the cpu time, is it possible to implement a virtual com port on the host side talking to AVR USB running the HID mode ?
Is such a thing already exist ?
Can you point my to an example of such an driver in the reference samples (PowerSwitch, etc) ?

Thank for this great work.

Nick

Posted: Fri May 09, 2008 8:13 pm
by christian
You can implement a virtual COM port, but you need your own drivers on the Windows side. The big advantage of CDC mode is that drivers are already included with Windows.

An example for an application layer driver based on libusb-win32 can be found in AVR-Doper. The "avrdebug" tool sends to and receives from a serial interface. The implementation may not be very efficient, though.