Forum: Mikrocontroller und Digitale Elektronik PIC18F4550 AudioDevice


von Max B. (maxberg)


Lesenswert?

Hi!

Ich hätte da eine Frage^^

Also ich versuche einen PIC18F4550 als Audiodevice zu erkennen...
Hab schon versucht im Interface Descriptor etc. 0x01 (für audio) 
einzutragen...

PIC wird als erkannt, ich kann audiotreiber installieren aber im 
Gerätemanager kommt ein gelbes Rufzeichen (Fehlercode 10 [Gerät kann 
nicht gestartet werden])

Kann mir wer helfen?

Einen schönen Nachmittag..

Max Berg

Ps: Danke!

von Max B. (maxberg)


Lesenswert?

Oder kann ich vielleicht den Microchip custom Treiber so anpassen, dass 
mein Device als AudioDevice erkannt wird?

von Εrnst B. (ernst)


Lesenswert?

Du hast nur das eine Byte im Interface descriptor angepasst?
Reicht vermutlich nicht, erstmal müssen wohl die richtigen Endpoints 
vorhanden sein, und dann muss der PIC natürlich korrekt auf die Requests 
antworten.

Ich schau mal, ob ich ein USB-Audio Device hier finde, und dir den 
Descriptor dumpen kann, sollte schonmal ein Anfang sein.

von Εrnst B. (ernst)


Lesenswert?

So, gleich gefunden :)

Vorsicht, ist recht Lang.
Das Interface#2, HID, ist für die Lautstärke/Mute Tasten am Headset, 
brauchst du nur wenn du auch Tasten an deinen Pic bauen willst.

Einfaches nachbauen des Deskriptors ist natürlich suboptimal, die Spec 
für USB-Audio sollte man nebenbei schon offen haben, um zu verstehen, 
was da alles angegeben wird.
1
Bus 001 Device 013: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
2
Device Descriptor:                                                      
3
  bLength                18                                             
4
  bDescriptorType         1                                             
5
  bcdUSB               1.10                                             
6
  bDeviceClass            0 (Defined at Interface level)                
7
  bDeviceSubClass         0                                             
8
  bDeviceProtocol         0                                             
9
  bMaxPacketSize0        64                                             
10
  idVendor           0x0d8c C-Media Electronics, Inc.                   
11
  idProduct          0x000c Audio Adapter                               
12
  bcdDevice            1.00                                             
13
  iManufacturer           0                                             
14
  iProduct                1 C-Media USB Headphone Set                   
15
  iSerial                 0                                             
16
  bNumConfigurations      1                                             
17
  Configuration Descriptor:                                             
18
    bLength                 9                                           
19
    bDescriptorType         2                                           
20
    wTotalLength          253                                           
21
    bNumInterfaces          4                                           
22
    bConfigurationValue     1                                           
23
    iConfiguration          0                                           
24
    bmAttributes         0xa0                                           
25
      (Bus Powered)                                                     
26
      Remote Wakeup                                                     
27
    MaxPower              100mA                                         
28
    Interface Descriptor:                                               
29
      bLength                 9                                         
30
      bDescriptorType         4                                         
31
      bInterfaceNumber        0                                         
32
      bAlternateSetting       0                                         
33
      bNumEndpoints           0                                         
34
      bInterfaceClass         1 Audio                                   
35
      bInterfaceSubClass      1 Control Device                          
36
      bInterfaceProtocol      0                                         
37
      iInterface              0                                         
38
      AudioControl Interface Descriptor:                                
39
        bLength                10                                       
40
        bDescriptorType        36                                       
41
        bDescriptorSubtype      1 (HEADER)                              
42
        bcdADC               1.00                                       
43
        wTotalLength          100                                       
44
        bInCollection           2                                       
45
        baInterfaceNr( 0)       1                                       
46
        baInterfaceNr( 1)       2                                       
47
      AudioControl Interface Descriptor:                                
48
        bLength                12                                       
49
        bDescriptorType        36                                       
50
        bDescriptorSubtype      2 (INPUT_TERMINAL)                      
51
        bTerminalID             1                                       
52
        wTerminalType      0x0101 USB Streaming                         
53
        bAssocTerminal          0                                       
54
        bNrChannels             2                                       
55
        wChannelConfig     0x0003                                       
56
          Left Front (L)                                                
57
          Right Front (R)                                               
58
        iChannelNames           0                                       
59
        iTerminal               0                                       
60
      AudioControl Interface Descriptor:                                
61
        bLength                12                                       
62
        bDescriptorType        36                                       
63
        bDescriptorSubtype      2 (INPUT_TERMINAL)                      
64
        bTerminalID             2                                       
65
        wTerminalType      0x0201 Microphone                            
66
        bAssocTerminal          0                                       
67
        bNrChannels             1                                       
68
        wChannelConfig     0x0001                                       
69
          Left Front (L)                                                
70
        iChannelNames           0                                       
71
        iTerminal               0                                       
72
      AudioControl Interface Descriptor:                                
73
        bLength                 9                                       
74
        bDescriptorType        36                                       
75
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)                     
76
        bTerminalID             6                                       
77
        wTerminalType      0x0301 Speaker                               
78
        bAssocTerminal          0                                       
79
        bSourceID               9                                       
80
        iTerminal               0                                       
81
      AudioControl Interface Descriptor:                                
82
        bLength                 9                                       
83
        bDescriptorType        36                                       
84
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)                     
85
        bTerminalID             7                                       
86
        wTerminalType      0x0101 USB Streaming                         
87
        bAssocTerminal          0                                       
88
        bSourceID               8                                       
89
        iTerminal               0                                       
90
      AudioControl Interface Descriptor:                                
91
        bLength                 7                                       
92
        bDescriptorType        36                                       
93
        bDescriptorSubtype      5 (SELECTOR_UNIT)                       
94
        bUnitID                 8                                       
95
        bNrInPins               1                                       
96
        baSource( 0)           10                                       
97
        iSelector               0                                       
98
      AudioControl Interface Descriptor:                                
99
        bLength                10                                       
100
        bDescriptorType        36                                       
101
        bDescriptorSubtype      6 (FEATURE_UNIT)                        
102
        bUnitID                 9                                       
103
        bSourceID              15                                       
104
        bControlSize            1                                       
105
        bmaControls( 0)      0x01                                       
106
          Mute                                                          
107
        bmaControls( 1)      0x02                                       
108
          Volume                                                        
109
        bmaControls( 2)      0x02                                       
110
          Volume                                                        
111
        iFeature                0                                       
112
      AudioControl Interface Descriptor:                                
113
        bLength                 9                                       
114
        bDescriptorType        36                                       
115
        bDescriptorSubtype      6 (FEATURE_UNIT)                        
116
        bUnitID                10                                       
117
        bSourceID               2                                       
118
        bControlSize            1                                       
119
        bmaControls( 0)      0x43                                       
120
          Mute                                                          
121
          Volume                                                        
122
          Automatic Gain                                                
123
        bmaControls( 1)      0x00                                       
124
        iFeature                0                                       
125
      AudioControl Interface Descriptor:                                
126
        bLength                 9                                       
127
        bDescriptorType        36                                       
128
        bDescriptorSubtype      6 (FEATURE_UNIT)                        
129
        bUnitID                13                                       
130
        bSourceID               2                                       
131
        bControlSize            1                                       
132
        bmaControls( 0)      0x03                                       
133
          Mute                                                          
134
          Volume                                                        
135
        bmaControls( 1)      0x00                                       
136
        iFeature                0                                       
137
      AudioControl Interface Descriptor:                                
138
        bLength                13                                       
139
        bDescriptorType        36                                       
140
        bDescriptorSubtype      4 (MIXER_UNIT)                          
141
        bUnitID                15                                       
142
        bNrInPins               2                                       
143
        baSourceID( 0)          1                                       
144
        baSourceID( 1)         13                                       
145
        bNrChannels             2                                       
146
        wChannelConfig     0x0003                                       
147
          Left Front (L)                                                
148
          Right Front (R)                                               
149
        iChannelNames           0                                       
150
        bmControls         0x00                                         
151
        iMixer                  0                                       
152
    Interface Descriptor:                                               
153
      bLength                 9                                         
154
      bDescriptorType         4                                         
155
      bInterfaceNumber        1                                         
156
      bAlternateSetting       0                                         
157
      bNumEndpoints           0                                         
158
      bInterfaceClass         1 Audio                                   
159
      bInterfaceSubClass      2 Streaming                               
160
      bInterfaceProtocol      0                                         
161
      iInterface              0                                         
162
    Interface Descriptor:                                               
163
      bLength                 9                                         
164
      bDescriptorType         4                                         
165
      bInterfaceNumber        1                                         
166
      bAlternateSetting       1                                         
167
      bNumEndpoints           1                                         
168
      bInterfaceClass         1 Audio                                   
169
      bInterfaceSubClass      2 Streaming                               
170
      bInterfaceProtocol      0                                         
171
      iInterface              0                                         
172
      AudioStreaming Interface Descriptor:                              
173
        bLength                 7                                       
174
        bDescriptorType        36                                       
175
        bDescriptorSubtype      1 (AS_GENERAL)                          
176
        bTerminalLink           1                                       
177
        bDelay                  1 frames                                
178
        wFormatTag              1 PCM                                   
179
      AudioStreaming Interface Descriptor:                              
180
        bLength                14                                       
181
        bDescriptorType        36                                       
182
        bDescriptorSubtype      2 (FORMAT_TYPE)                         
183
        bFormatType             1 (FORMAT_TYPE_I)                       
184
        bNrChannels             2                                       
185
        bSubframeSize           2                                       
186
        bBitResolution         16                                       
187
        bSamFreqType            2 Discrete                              
188
        tSamFreq[ 0]        48000                                       
189
        tSamFreq[ 1]        44100                                       
190
      Endpoint Descriptor:                                              
191
        bLength                 9                                       
192
        bDescriptorType         5                                       
193
        bEndpointAddress     0x01  EP 1 OUT                             
194
        bmAttributes            9                                       
195
          Transfer Type            Isochronous                          
196
          Synch Type               Adaptive                             
197
          Usage Type               Data                                 
198
        wMaxPacketSize     0x00c8  1x 200 bytes                         
199
        bInterval               1                                       
200
        bRefresh                0                                       
201
        bSynchAddress           0                                       
202
        AudioControl Endpoint Descriptor:                               
203
          bLength                 7                                     
204
          bDescriptorType        37                                     
205
          bDescriptorSubtype      1 (EP_GENERAL)                        
206
          bmAttributes         0x01                                     
207
            Sampling Frequency                                          
208
          bLockDelayUnits         1 Milliseconds                        
209
          wLockDelay              1 Milliseconds                        
210
    Interface Descriptor:                                               
211
      bLength                 9                                         
212
      bDescriptorType         4                                         
213
      bInterfaceNumber        2                                         
214
      bAlternateSetting       0                                         
215
      bNumEndpoints           0                                         
216
      bInterfaceClass         1 Audio                                   
217
      bInterfaceSubClass      2 Streaming                               
218
      bInterfaceProtocol      0                                         
219
      iInterface              0                                         
220
    Interface Descriptor:                                               
221
      bLength                 9                                         
222
      bDescriptorType         4                                         
223
      bInterfaceNumber        2                                         
224
      bAlternateSetting       1                                         
225
      bNumEndpoints           1                                         
226
      bInterfaceClass         1 Audio                                   
227
      bInterfaceSubClass      2 Streaming                               
228
      bInterfaceProtocol      0                                         
229
      iInterface              0                                         
230
      AudioStreaming Interface Descriptor:                              
231
        bLength                 7                                       
232
        bDescriptorType        36                                       
233
        bDescriptorSubtype      1 (AS_GENERAL)                          
234
        bTerminalLink           7                                       
235
        bDelay                  1 frames                                
236
        wFormatTag              1 PCM                                   
237
      AudioStreaming Interface Descriptor:                              
238
        bLength                14                                       
239
        bDescriptorType        36                                       
240
        bDescriptorSubtype      2 (FORMAT_TYPE)                         
241
        bFormatType             1 (FORMAT_TYPE_I)                       
242
        bNrChannels             1                                       
243
        bSubframeSize           2                                       
244
        bBitResolution         16                                       
245
        bSamFreqType            2 Discrete                              
246
        tSamFreq[ 0]        48000                                       
247
        tSamFreq[ 1]        44100                                       
248
      Endpoint Descriptor:                                              
249
        bLength                 9                                       
250
        bDescriptorType         5                                       
251
        bEndpointAddress     0x82  EP 2 IN                              
252
        bmAttributes            5                                       
253
          Transfer Type            Isochronous                          
254
          Synch Type               Asynchronous                         
255
          Usage Type               Data                                 
256
        wMaxPacketSize     0x0064  1x 100 bytes                         
257
        bInterval               1                                       
258
        bRefresh                0                                       
259
        bSynchAddress           0                                       
260
        AudioControl Endpoint Descriptor:                               
261
          bLength                 7                                     
262
          bDescriptorType        37                                     
263
          bDescriptorSubtype      1 (EP_GENERAL)                        
264
          bmAttributes         0x01                                     
265
            Sampling Frequency                                          
266
          bLockDelayUnits         0 Undefined                           
267
          wLockDelay              0 Undefined                           
268
    Interface Descriptor:                                               
269
      bLength                 9                                         
270
      bDescriptorType         4                                         
271
      bInterfaceNumber        3                                         
272
      bAlternateSetting       0                                         
273
      bNumEndpoints           1                                         
274
      bInterfaceClass         3 Human Interface Device                  
275
      bInterfaceSubClass      0 No Subclass
276
      bInterfaceProtocol      0 None
277
      iInterface              0
278
        HID Device Descriptor:
279
          bLength                 9
280
          bDescriptorType        33
281
          bcdHID               1.00
282
          bCountryCode            0 Not supported
283
          bNumDescriptors         1
284
          bDescriptorType        34 Report
285
          wDescriptorLength      50
286
         Report Descriptors:
287
           ** UNAVAILABLE **
288
      Endpoint Descriptor:
289
        bLength                 7
290
        bDescriptorType         5
291
        bEndpointAddress     0x83  EP 3 IN
292
        bmAttributes            3
293
          Transfer Type            Interrupt
294
          Synch Type               None
295
          Usage Type               Data
296
        wMaxPacketSize     0x0004  1x 4 bytes
297
        bInterval              32
298
Device Status:     0x0000
299
  (Bus Powered)


Und, der Vollständigkeit halber, nochmal den gesammten Deskriptor-Block 
als Hexdump:
1
00000000  12 01 10 01 00 00 00 40  8c 0d 0c 00 00 01 00 01  |.......@........|
2
00000010  00 01 09 02 fd 00 04 01  00 a0 32 09 04 00 00 00  |..........2.....|
3
00000020  01 01 00 00 0a 24 01 00  01 64 00 02 01 02 0c 24  |.....$...d.....$|
4
00000030  02 01 01 01 00 02 03 00  00 00 0c 24 02 02 01 02  |...........$....|
5
00000040  00 01 01 00 00 00 09 24  03 06 01 03 00 09 00 09  |.......$........|
6
00000050  24 03 07 01 01 00 08 00  07 24 05 08 01 0a 00 0a  |$........$......|
7
00000060  24 06 09 0f 01 01 02 02  00 09 24 06 0a 02 01 43  |$.........$....C|
8
00000070  00 00 09 24 06 0d 02 01  03 00 00 0d 24 04 0f 02  |...$........$...|
9
00000080  01 0d 02 03 00 00 00 00  09 04 01 00 00 01 02 00  |................|
10
00000090  00 09 04 01 01 01 01 02  00 00 07 24 01 01 01 01  |...........$....|
11
000000a0  00 0e 24 02 01 02 02 10  02 80 bb 00 44 ac 00 09  |..$.........D...|
12
000000b0  05 01 09 c8 00 01 00 00  07 25 01 01 01 01 00 09  |.........%......|
13
000000c0  04 02 00 00 01 02 00 00  09 04 02 01 01 01 02 00  |................|
14
000000d0  00 07 24 01 07 01 01 00  0e 24 02 01 01 02 10 02  |..$......$......|
15
000000e0  80 bb 00 44 ac 00 09 05  82 05 64 00 01 00 00 07  |...D......d.....|
16
000000f0  25 01 01 00 00 00 09 04  03 00 01 03 00 00 00 09  |%...............|
17
00000100  21 00 01 00 01 22 32 00  07 05 83 03 04 00 20     |!...."2....... |

Hoffe das hilft dir irgendwie weiter.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.