Pages: [1]   Go Down
Author Topic: Emulate USB device  (Read 2506 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all, my boss wants me to use an Arduino UNO r3 to emulate an "USB audio device" that has specific vendor id, vendor name, product id, product name, etc.. Is it possible with the Arduino UNO r3? And if so, how can I do that?

Thank you
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You'll have to re-program the Atmega16U2, used as the USB/Serial converter. Its code is in <arduino-dir>/hardware/arduino/firmwares/arduino-usbdfu.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 613
Posts: 49315
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Assuming you get the Arduino to pretend to be this unknown "USB audio device", then what? What exactly do you intend to have the Arduino do? Generating audio data is not something that the Arduino is particularly good at. Using audio data is not something that the Arduino is particularly good at.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I've been asked to use the Arduino UNO r3 to test a driver on a Linux machine. This driver is used to interact with an audio device that i don't have at the moment. However, I have the protocol used by this device to communicate with the driver. So, in order to test the driver, I have to emulate this device's vendor id, vendor name, product id, product name, etc. otherwise Linux will not load the driver.

As you may have already figured out, I don't have much experience with Arduino, so if you have any idea/tip/suggestion, please let me know. At the moment, I am going through the USB/Serial converter code looking for vendor id, vendor name, etc., but I am not really sure what to do once I find them.

Do you think it's easier to just buy an Arduino USB Host and use that to emulate my audio device?
« Last Edit: October 06, 2012, 10:49:56 am by dlxsf » Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do you think it's easier to just buy an Arduino USB Host and use that to emulate my audio device?

Is the device you are trying to emulate a USB host device? If not, then you don't want to use a host shield.
Logged

0
Offline Offline
Full Member
***
Karma: 4
Posts: 218
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Lots of posts that won't do you much good -what a pain they are

V-usb creates a device that emulates a usb device of your choice where you can set the ID numbers , power requirements etc. One kind soul has altered this to run on Arduino with examples and it can be had here .

http://code.google.com/p/vusb-for-arduino/downloads/list
and here the thread about it
http://arduino.cc/forum/index.php/topic,123306.0.html

Other useful but voluminous materiat
http://www.beyondlogic.org/usbnutshell/usb1.shtml
http://www.obdev.at/products/vusb/index.html
« Last Edit: October 06, 2012, 04:12:43 pm by april » Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Lots of posts that won't do you much good -what a pain they are

Not sure what you mean by that. Reprogramming the Atmega16U2, using the supplied code (in <arduino-dir>/hardware/arduino/firmwares/arduino-usbdfu) will do what the OP asked for.
« Last Edit: October 07, 2012, 06:44:55 am by dxw00d » Logged

0
Offline Offline
Full Member
***
Karma: 4
Posts: 218
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So can you tell us what this is . What does it do? Can we refer to any sites that will give us this info.

arduino-usbdfu does not mean very much on its own

How will it do what the OP wants?.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you april for the link to v-usb. This project looks really what I was looking for!
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 593
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

LUFA features both AudioInput and AudioOutput demonstrations, this is EXACTLY what you are looking for, modify the makefile for the ATmega16U2 and you should be good to go
Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

0
Offline Offline
Full Member
***
Karma: 4
Posts: 218
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was interested to have a look at this also
went here
https://code.google.com/p/lufa-lib/downloads/detail?name=LUFA-120730.zip

downloaded ,installed doxygen and tried to compile .

Mass of errors related to pin names I think -here is a small part-I'll go elsewhere and try it again

Code:
In file included from ../../LUFA/../LUFA/Drivers/Peripheral/Serial.h:68:0,
                 from Benito.h:48,
                 from Benito.c:37:
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h: In function 'Serial_Init':
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:174:5: error: 'UBRR1' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:176:5: error: 'UCSR1C' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:176:21: error: 'UCSZ11' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:176:37: error: 'UCSZ10' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:177:5: error: 'UCSR1A' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:177:35: error: 'U2X1' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:178:5: error: 'UCSR1B' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:178:21: error: 'TXEN1' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:178:37: error: 'RXEN1' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:180:5: error: 'DDRD' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:181:5: error: 'PORTD' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h: In function 'Serial_Disable':
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:187:5: error: 'UCSR1B' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:188:5: error: 'UCSR1A' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:189:5: error: 'UCSR1C' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:191:5: error: 'UBRR1' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:193:5: error: 'DDRD' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:194:5: error: 'PORTD' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h: In function 'Serial_IsCharReceived':
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:204:14: error: 'UCSR1A' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:204:29: error: 'RXC1' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h: In function 'Serial_SendByte':
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:214:14: error: 'UCSR1A' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:214:29: error: 'UDRE1' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:215:5: error: 'UDR1' undeclared (first use in this function)
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h: In function 'Serial_ReceiveByte':
../../LUFA/../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h:228:12: error: 'UDR1' undeclared (first use in this function)
Benito.c: In function 'main':
Benito.c:101:8: error: 'UCSR1A' undeclared (first use in this function)
Benito.c:101:23: error: 'UDRE1' undeclared (first use in this function)
Benito.c:103:4: error: 'UDR1' undeclared (first use in this function)
Benito.c:110:7: error: 'TIFR0' undeclared (first use in this function)
Benito.c:110:21: error: 'OCF0A' undeclared (first use in this function)
Benito.c:113:19: error: 'TOV0' undeclared (first use in this function)
Benito.c:119:5: error: 'DDRD' undeclared (first use in this function)
Benito.c: In function 'SetupHardware':
Benito.c:175:2: error: 'MCUSR' undeclared (first use in this function)
Benito.c:175:18: error: 'WDRF' undeclared (first use in this function)
Benito.c:176:2: error: 'WDTCR' undeclared (first use in this function)
Benito.c:176:2: error: 'WDCE' undeclared (first use in this function)
Benito.c:176:2: error: 'WDE' undeclared (first use in this function)
Benito.c:183:2: error: 'OCR0A' undeclared (first use in this function)
Benito.c:184:2: error: 'TCCR0A' undeclared (first use in this function)
Benito.c:184:17: error: 'WGM01' undeclared (first use in this function)
Benito.c:185:2: error: 'TCCR0B' undeclared (first use in this function)
Benito.c:185:18: error: 'CS01' undeclared (first use in this function)
Benito.c:185:32: error: 'CS00' undeclared (first use in this function)
Benito.c:188:2: error: 'PORTD' undeclared (first use in this function)
Benito.c:189:2: error: 'DDRD' undeclared (first use in this function)
Benito.c: In function 'EVENT_CDC_Device_LineEncodingChanged':
Benito.c:238:24: error: 'UPM11' undeclared (first use in this function)
Benito.c:238:39: error: 'UPM10' undeclared (first use in this function)
Benito.c:246:24: error: 'USBS1' undeclared (first use in this function)
Benito.c:251:24: error: 'UCSZ10' undeclared (first use in this function)
Benito.c:254:24: error: 'UCSZ11' undeclared (first use in this function)
Benito.c:262:2: error: 'UCSR1B' undeclared (first use in this function)
Benito.c:263:2: error: 'UCSR1A' undeclared (first use in this function)
Benito.c:264:2: error: 'UCSR1C' undeclared (first use in this function)
Benito.c:267:2: error: 'UBRR1' undeclared (first use in this function)
Benito.c:271:17: error: 'U2X1' undeclared (first use in this function)
Benito.c:272:18: error: 'RXCIE1' undeclared (first use in this function)
Benito.c:272:34: error: 'TXEN1' undeclared (first use in this function)
« Last Edit: October 10, 2012, 05:16:29 am by april » Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Which Arduino or ATmega are you using? I believe UCSR1C is one of the additional USARTs on a Mega1280/2560.
Logged

Pages: [1]   Go Up
Jump to: