cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4-Discovery Audio playback and record example USB problem

eldarsabanovic
Associate
Posted on April 20, 2012 at 16:43

Hello,

I am beginner with STM32F4-Discovery. I loaded some examples to flash, all worked, but can't play ''audio.wav'' wave audio file from USB key nor record ''rec.wav'' with ''audio player and recorder example''. Program goes over USBH_Process(&USB_OTG_Core, &USB_Host) in main.c, and cycles here forever, no blue led ligths up, no sound, no switch to recording mode. It seems like something wrong with usb flash connection initialization, because USBH_Process function in usbh_core.c repeats at ''volatile USBH_Status status = USBH_FAIL'' after ''case HOST_ERROR_STATE:''. How I can fix this, or what I did wrong?
22 REPLIES 22
rajrahulonline
Associate II
Posted on August 27, 2014 at 13:22

Hi ,

   I think this is a common issue in Eclipse.

I got the following errors.

../src/main.c:85:43: error:

'USBH_MSC_cb'

undeclared (first use in this function)

../src/main.c:85:57: error:

'USR_Callbacks'

undeclared (first use in this function)

I searched in all the files related to USB to find the definition of those variable.

They are declared as extern in usbh_core.h.

USB_OTG_CORE_HANDLE

was also undeclared i suppressed warning by defining  

struct USB_OTG_CORE_HANDLE          USB_OTG_Core;

Anyone know where are these things defined.

Posted on August 27, 2014 at 14:22

I think this is a common issue in Eclipse.

The commonality I'm observing is individuals picking tools they don't understand sufficiently, trying to port code into those tools without a good grasp of how the project is constructed in any other tool. I suppose one solution is to bang heads together until it works, but I'd usually do logical analysis. Do you have MEDIA_USB_KEY defined and passed to the compiler command line? This would be required for USB_OTG_Core to defined in main.c

#if defined MEDIA_USB_KEY
USB_OTG_CORE_HANDLE USB_OTG_Core;
USBH_HOST USB_Host;
#endif

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rajrahulonline
Associate II
Posted on August 28, 2014 at 08:48

Thanks Clive1

My Code is Working now..:):)