2

I am using a STM32F103RCT6 board with STM32CubeIDE. I enabled the USB Audio device and the code is working and windows recognized the board as an audio device or speaker.

I have searched and read documents but I have no idea what it is doing in the code. The code is only MX_USB_DEVICE_Init();

1- Is it now receiving data from PC and saving them somewhere in RAM in a buffer?

2- How I can get access to the data and send them to DAC?

I am not going to use I2C and a codec because I don't have a codec IC. So I just want to use DAC to generate the audio to send to speakers.

Thanks!

  • @Colin According to datasheet, F103xC has 2 × 12-bit D/A converters, also I am using STM32CubeIDE which is showing DAC for it and I enabled it. – Aministrator Nov 14 '20 at 11:08
  • Looks like it has 3 x analogue-to-digital converters along with 2 x digital to analogue, so should be possible. [See specs.](https://www.st.com/en/microcontrollers-microprocessors/stm32f103rc.html) – Tom Nov 14 '20 at 17:40
  • You may want to look for a function like `USBD_AUDIO_DataOut` where the USB peripheral calls back with data from the host, which can then be loaded into a buffer. There are examples around, maybe not for your exact device but likely compatible usage of ST's USB stack. – Tom Nov 14 '20 at 17:49
  • @Tom All examples that I see they only do the init in main like me and I don't understand how they do other stuff. And apparently user doesn't need to use functions like USBD_AUDIO_DataOut. According to UM1734 : The entire transfer is managed by the following functions (no need for user to call any function for out transfers): • usbd_audio_DataIn() and usbd_audio_DataOut() which update the audio buffers with the received or transmitted data. For Out transfers, when data are received, they are directly copied into the audiobuffer and the write buffer (wr_ptr) is incremented. – Aministrator Nov 16 '20 at 16:23

0 Answers0