5 years, 7 months ago.

ST USBDEVICE USBMSD

I am trying to use the ST USBDEVICE Library (Revision 3:d9c7334) on NUCLEO L476:

USBMSD Example

#include "mbed.h"
#include "USBMSD.h"
 
USBMSD sd(PA_7, PA_6, PA_5, PB_6); // MOSI, MISO, SCLK, CS

// Now just blink a LED to see if the board is alive.
DigitalOut led1(LED1);

int main() {
    while (true) {
        led1 = !led1;
        wait(0.5);
    }
}

But all I get is following error when compiling (mbedOS: REVISION 4464:f8b140f):

Error: Identifier "USBHAL_Private_t" is undefined in "USBDEVICE/USBDevice/TARGET_STM/USBHAL_STM32.cpp", Line: 36, Col: 6

Is this a bug or am I doing something wrong?

USBHAL_STM32.cpp

/*  this call at device reception completion on a Out Enpoint  */
void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
{
    // why is this variable USBHAL_Private_t not declared ???
    USBHAL_Private_t *priv=((USBHAL_Private_t *)(hpcd->pData)); // ???
    USBHAL *obj= priv->inst;
    uint8_t endpoint = ADDR_EPOUT(epnum);
    priv->epComplete[endpoint] = 1;
    /* -2 endpoint 0 In out are not in call back list */
    if (epnum) {
        bool (USBHAL::*func)(void) = priv->epCallback[endpoint-2];
        (obj->*func)();
    } else {
        void (USBHAL::*func)(void) = priv->ep0_out;
        (obj->*func)();
    }
}

Thanks for all your help!

1 Answer

5 years, 5 months ago.

Hi,

you have to implement a usbhal_stm32L476RG.h file in target of the usbdevice lib (the st one...). Basically you just have to copy the discost_l776vg folder, rename all "stm32l476vg" by stm32l476rg, file name and inside file also, and it works...

For me it works for all stuff regarding to usbdevice lib (mouse, serial...) but not USBMSD...

Do you succeed to do something ?

Best regards.