This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB audio microphone: Windows recording and bSubFrameSize

Hey,

I'm working on a USB microphone using an isochronous endpoint. Although 8 bits would be sufficient resolution, it turns out that Windows' standard USB driver only supports 16 bit PCM or higher.

In going from:

    0x01,                                 // bSubFrameSize
    0x08,                                 // bBitResolution

to

    0x02,                                 // bSubFrameSize (two bytes per subframe)
    0x10,                                 // bBitResolution (16 bit PCM)

... it seems something breaks. Attempting to start recording the device in Windows yields an uninformative 'cannot start' error. Using arecord -f S16_LE in Linux works fine.

The EP ISR is really simple, and just returns 16 bytes every time (sample rate 8 kHz, one channel, two bytes/sample = 16 bytes). Thus, the ENDP1 TX count is always equal to 16:

void EP1_IN_Callback(void){
    SetEPTxCount(ENDP1, 16);
    ToggleDTOG_TX(ENDP1);
    SetEPTxValid(ENDP1);
}

Finally, note that I'm still on single buffering (double buffering would be next after this issue is fixed). The device is an STM32F103.

Much obliged for any pointers.

  • I don't see any problem on your sescriptor set.

    On the audio control interface, Feature unit is not usually implemented for microphone.
    Delete this descriptor, and change bSourceID of the outoput terminal to the ID of the input terminal. wTotalLength fields of the Config and Audio header descriptors are also descreased by the size of this descriptor.

    You may have the Feature unit, but you have to implement request handlers for the audio control requests, Set_/Get_Cur, MIN, MAX, RES, targetting to the feature unit on your firmware. Without this handler, enumeration will fail.

    Tsuneo

  • Hi,

    May I ask you which stack and OS did you used for this application ?

    I tried with the USB FS V4.0 from ST but I still get a yellow mark in my configuration windows (code 10)
    I'm working on a stm32f103 and windows7 (However it works well on windows XP...)

    Thanks for reading !

    Théo