Using an Obdev AVR-USB device with Labview

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
scls19fr
Posts: 3
Joined: Sun Apr 06, 2008 12:19 pm
Contact:

Using an Obdev AVR-USB device with Labview

Post by scls19fr » Sun Apr 06, 2008 12:28 pm

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

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Mon Apr 07, 2008 10:08 am

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.

scls19fr
Posts: 3
Joined: Sun Apr 06, 2008 12:19 pm
Contact:

Post by scls19fr » Mon Apr 07, 2008 2:09 pm

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

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Mon Apr 07, 2008 4:19 pm

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.

spiff
Rank 1
Rank 1
Posts: 24
Joined: Tue Apr 17, 2007 1:00 am
Location: Virum, Denmark
Contact:

Post by spiff » Mon Apr 14, 2008 8:25 pm

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

scls19fr
Posts: 3
Joined: Sun Apr 06, 2008 12:19 pm
Contact:

Post by scls19fr » Wed Apr 16, 2008 4:44 pm

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.

Guest

virtual com port

Post by Guest » Fri May 09, 2008 4:13 pm

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

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Fri May 09, 2008 8:13 pm

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.

Post Reply