Thank you for this video. It saved me lot of time. Can I also ask how to detect the event of disconnecting the USB cable? Otherwise, in such event, the output buffer keeps playing with no new data coming which makes annoying sound.
Inside usbd_audio.c, there is a function USBD_AUDIO_IsoOutIncomplete. Most probably, this function is invoked when the USB cable is disconnected. You can check it by using breakpoints or printing some messages. If this is the case, you can signal the audio speaker to stop audio streaming.
@@steppeschool3629 This worked. Thank you again! I also discovered, that there are functions HAL_PCD_SuspendCallback() and HAL_PCD_ResumeCallback() in usbd_conf.c that can be used for this purpose as well.
Thank you for the video. It was very informative. Could you also please tell us how we can send audio data from an STM32 microcontroller over USB to a computer? For many days, I have been unable to find a working example that would help me understand how this works. For instance, I would like to generate data on a microcontroller and transmit it over USB to the computer. It would also be interesting to collect data with the ADC and transmit it as audio over USB to a computer. Could you please tell me how to configure the descriptors and which functions I should use to send the messages? There seems to be a great lack of information on this topic. Thank you.
Actually, I have been working on this project which is about designing a USB microphone. But right now, I have too many things to do. I will probably finish it in the near future. But I found this tutorial that explains all the steps pretty well: hackaday.io/project/181868-stm32f4-usb-microphone/details
@@steppeschool3629 Thanks for the answer! Yes, I tried this project. I tried to port it to stm32f411. The board is defined as a microphone. But no data is being transmitted. I've been trying to figure this out for a few days, but I haven't gotten a result. Audio programs freeze when working with such a source. Perhaps in my case there is a small error somewhere, but it is still unclear where. I learned how to make a midi device out of an stm32 and transfer data. But the audio has not been able to start yet. Tinyusb also looks interesting. But it hasn't worked yet either.
Thanks!
Thanks a lot!!! I greatly appreciate your donation
Did you encounter issues when in some USB ports you get flooded with isoOutIncomplete and glitches since a packet is received not each SOF?
can I get full code.
and please make a video for USB_ Microphone
Thank you for this video. It saved me lot of time. Can I also ask how to detect the event of disconnecting the USB cable? Otherwise, in such event, the output buffer keeps playing with no new data coming which makes annoying sound.
There is another callback function for disconnection. Unfortunately, I cannot check it right now. Hopefully, I can check it after a couple of hours
Inside usbd_audio.c, there is a function USBD_AUDIO_IsoOutIncomplete. Most probably, this function is invoked when the USB cable is disconnected. You can check it by using breakpoints or printing some messages. If this is the case, you can signal the audio speaker to stop audio streaming.
@@steppeschool3629 This worked. Thank you again! I also discovered, that there are functions HAL_PCD_SuspendCallback() and HAL_PCD_ResumeCallback() in usbd_conf.c that can be used for this purpose as well.
@@janpribyslavsky1554 🤙👍👍
Thank you for the video. It was very informative. Could you also please tell us how we can send audio data from an STM32 microcontroller over USB to a computer? For many days, I have been unable to find a working example that would help me understand how this works. For instance, I would like to generate data on a microcontroller and transmit it over USB to the computer. It would also be interesting to collect data with the ADC and transmit it as audio over USB to a computer. Could you please tell me how to configure the descriptors and which functions I should use to send the messages? There seems to be a great lack of information on this topic. Thank you.
Actually, I have been working on this project which is about designing a USB microphone. But right now, I have too many things to do. I will probably finish it in the near future. But I found this tutorial that explains all the steps pretty well:
hackaday.io/project/181868-stm32f4-usb-microphone/details
@@steppeschool3629 Thanks for the answer! Yes, I tried this project. I tried to port it to stm32f411. The board is defined as a microphone. But no data is being transmitted. I've been trying to figure this out for a few days, but I haven't gotten a result. Audio programs freeze when working with such a source. Perhaps in my case there is a small error somewhere, but it is still unclear where. I learned how to make a midi device out of an stm32 and transfer data. But the audio has not been able to start yet. Tinyusb also looks interesting. But it hasn't worked yet either.
Hi, what is your main code? I've copied all the code you showed in the video, but I get no audio.
thank you for the video
You're welcome