Go Down

Topic: Emulate USB device (Read 2834 times) previous topic - next topic

dlxsf

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

dxw00d

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.

PaulS

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.

dlxsf

#3
Oct 06, 2012, 05:48 pm Last Edit: Oct 06, 2012, 05:49 pm by dlxsf Reason: 1
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?

dxw00d

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.

april

#5
Oct 06, 2012, 10:55 pm Last Edit: Oct 06, 2012, 11:12 pm by april Reason: 1
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

dxw00d

#6
Oct 07, 2012, 12:32 pm Last Edit: Oct 07, 2012, 01:44 pm by dxw00d Reason: 1
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.

april

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?.

dlxsf

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

frank26080115

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
Freelance engineer, consultant, contractor. Graduated from UW in 2013.

april

#10
Oct 10, 2012, 12:14 pm Last Edit: Oct 10, 2012, 12:16 pm by april Reason: 1
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: [Select]
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)

dxw00d

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

Go Up