Skip to main content
eldarsabanovic
Visitor II
April 20, 2012
Question

STM32F4-Discovery Audio playback and record example USB problem

  • April 20, 2012
  • 22 replies
  • 4589 views
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?
    This topic has been closed for replies.

    22 replies

    frankmeyer9
    Associate III
    August 22, 2014
    Posted on August 22, 2014 at 11:11

    Is there any version of FW for ECLIPSE IDE??

     

    Atollic is Eclipse-based, so it is as close as you can get.

    However, you need to come to grips with your IDE. Of course you need to adapt the project for your environment, because your plain Eclipse is not aware of Atollic-specific settings. Especially set the paths to the sources and header files correctly.

    If you do not want to use Atollic (or another of the directly supported toolchains) it is best to create a new, matching project from scratch, and import/include all required files manually.

    avinashpkrishnan
    Associate
    August 23, 2014
    Posted on August 23, 2014 at 07:36

    Hi,

    I tried to build a project using the provided source code in Eclipse IDE.

    Added all the files related to USB. Now I am stuck with an error ''

    ../src/diskio.c:26:29: error: 'USB_OTG_Core_dev' undeclared (first use in this function)

    ''. I searched in all the files, but couldnt find a define '

    USB_OTG_Core_dev

    '. Please let me know what value shall i define for 'USB_OTG_Core_dev'.

    Tesla DeLorean
    Guru
    August 23, 2014
    Posted on August 23, 2014 at 12:21

    Perhaps you're not supposed to be using that file? Have you looked at the construction of any other of the projects for the supported tool chains? They are in ASCII, and human readable..

    Perhaps you should be using STM32F4-Discovery_FW_V1.1.0\Libraries\STM32_USB_HOST_Library\Class\MSC\src\usbh_msc_fatfs.c ? and not diskio.c (a generic form)

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    avinashpkrishnan
    Associate
    August 24, 2014
    Posted on August 24, 2014 at 11:09

    I have created my  own project in Eclipse as you suggested.

    Compiling the project after adding all the files related to USB ,I got the following error:

    /src/usb/usb_dcd.c:93:7: error: '

    USB_OTG_CORE_HANDLE

    ' has no member named '

    dev

    '.

    I have gone through all the files ,

    dev

    is used in many places (pdev->dev.device_status = USB_OTG_DEFAULT;  pdev->dev.device_address = 0;) but it is not declared anywhere. 

    Tesla DeLorean
    Guru
    August 24, 2014
    Posted on August 24, 2014 at 15:04

    Odd then, that the project in Keil, using the correct files, compiles just fine....

    Perhaps you should read my previous advice more slowly, instead of dumping all the files you can find into the project?

    0690X00000603I2QAI.jpg

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    avinashpkrishnan
    Associate
    August 25, 2014
    Posted on August 25, 2014 at 06:39

    Its clear now, I may have added unwanted files!!!

    Please let me know the list of  header files also.

    Tesla DeLorean
    Guru
    August 25, 2014
    Posted on August 25, 2014 at 15:29

    Please let me know the list of header files also.

    This seems to involve a lot of work on my part to do your job. Attached is a dependency tree, in ASCII, parse it with AWK or PERL

    ________________

    Attachments :

    Audio_playback_and_record_MEDIA_USB_KEY.dep : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzjm&d=%2Fa%2F0X0000000bP2%2F6b.mL8dyasT5bRQv.KkDY1AFN.HPM5O4wdFQsmg16s8&asPdf=false
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    avinashpkrishnan
    Associate
    August 26, 2014
    Posted on August 26, 2014 at 09:06

    Sir,

    Please bear with me if I ask any foolish questions. I have been sitting on this for last two week because this is an important  part of my project.

    As u suggested I have removed all the unused files from my project.Now i m getting an error

    ../src/usb/diskio.c:26:29: error: 'USB_OTG_Core_dev' undeclared (first use in this function).

    diskio.h

    is included in

    usbh_msc_fatfs.c

     . i dont know where is USB_OTG_Core_dev defined 

    Tesla DeLorean
    Guru
    August 26, 2014
    Posted on August 26, 2014 at 15:53

    Stop using DISKIO.C isn't not part of the project, I told you this last week. The functions declared in diskio.H are implemented in another file.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    rajrahulonline
    Visitor II
    August 27, 2014
    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.