2017-03-20 07:39 PM
Hello
I try to create an USB Audio speaker with Stm32f103c8t6. I generate project in CubeMX 4.20 for Keil v5 and i set 44100 for sound sample rate. Project compiled fine. USB device normal detected in Windows 8. Mute button in windows works normal and call function 'AUDIO_MuteCtl_FS' in file 'usbd_audio_if.c'. But when I try to play test sound in Windows everything breaks down. Stm32f103c8t6 freeze, mute button no more works, debugger in Keil disconnect from Stm32f103c8t6.What could be the problem?
#stm32 #usb-audio #usb #stm32f103c8t62017-03-22 02:33 AM
At that moment, the function for hardware (CODEC) initialization is called, and then the data start to arrive which you should be shoveling into the CODEC. It's upon you to write those functions. Look at the examples which come with Cube for the EVAL boards.
I don't use Cube but got one of those examples working on my board. One thing to notice is that the example ruthlessly uses malloc() to get space for the data, so your program should be prepared to accept that (have enough space in heap etc.).
JW
2017-03-22 02:53 AM
Hello,
I recommended you to have a look to the
, the USB-FS-Device Audio Speaker demo gives examples of how to use the STM32F10xxx USB-FS-Device peripheral. More details about this Demo implementation is given in the attached User manual 'UM0424 STM32F10xxx USB development kit', in section 'USB audio speaker demo'.Imen
________________ Attachments : STM-STM32-STM32F103C8-Learning Centre MCU-User Manuals-STMicroelectronics.Manuals_1.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hylg&d=%2Fa%2F0X0000000bCF%2FnX6HZ1M30SPw9CfoS9.f5U2jOxA4bch25D21zf75DyI&asPdf=false2017-03-22 01:31 PM
I set heap size to 0x2000,
set AUDIO_OUT_PACKET_NUM=20
and set correct size of static buffer in malloc function static uint8_t mem[4096];
Now I was able to receive a sound data from PC, but only once.
Stm32f103c8t6 does not freeze now, but it need to reconnect to PC USB after each first sound data packet.
2017-03-22 01:37 PM
Thanks for the example.
In the example used 8bit 22KHz sound. Is it maximum for
STM32F10xxx? I need 16bit 44100 two-channel sound, can
STM32F10xxx work in this mod?
2017-03-23 03:25 AM
Hi,
You should refer to the reference manual and datasheet related to your device for more clarification about your product characteristics.
Imen