简体   繁体   中英

Audio IN over USB on STM32F4

I try to create a simple USB audio interface with audio IN and OUT on a custom board based on an STM32F412 . The audio OUT (from host to target) is working, also with the help of the CubeMX setup for the audio device usb class. But somehow I can't figure out how the opposite way (from target to host) should work.

I see for audio out, AUDIO_PeriodicTC_FS gets called periodically (every 1ms) with the AUDIO_OUT_TC command. It never gets called with AUDIO_IN_TC . I tried to call HAL_PCD_EP_Transmit with some audio data, but the host doesn't get the input...

The descriptor should be right, at least I see both interfaces (in and out) show up on the host.

Is someone experienced in this or can provide some working examples?

Look here . Used and verified. It works. It may need some deeper modification if your chip doesn't have USB OTG

Ive created a simple USB headset on my stm32f4 discovery board. You can check it out, if you're interested:

https://github.com/ancher-bohdan/stm32_usb_interface

It is far from ideal, but it can play music from host and send recorded sound from analog mic to host

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM