Max Chuquimia
Max Chuquimia

Reputation: 7854

mbed: compiling with USBDevice library results in error

I've been attempting to compile a simple example of a USB Keyboard for my STM32 Nucleo F303K8 (I've been following the examples at https://os.mbed.com/handbook/USBKeyboard and https://www.hackerspace-ntnu.no/wiki/tutorials/mbed/mbed-keyboard-en/)

Basically my entire main.cpp is:

#include "mbed.h"
#include "USBKeyboard.h"

USBKeyboard keyboard;

int main(void) {

    while (1) {
        wait(1);
        keyboard.printf("Test");
    }
}

However upon compiling, I get told

Error: Identifier "PCD_HandleTypeDef" is undefined in "USBDevice/USBDevice/USBHAL.h", Line: 134, Col: 6

That particular error is copied from my project on https://os.mbed.com/compiler - I also tried building from a local project in VSCode (using the PlatformIO plugin) and I get the same issue. Without mbed's USBDevice library, I am able to compile fine from both IDEs.

Does anyone know why this could be happening? Do I need to import something else?

Upvotes: 0

Views: 434

Answers (1)

yennster
yennster

Reputation: 75

You are encountering this error because the NUCLEO_F303K8 target is not supported in the USBDevice library. For Mbed 2 you can see how there is not a folder available for the F303K8 in this directory here, and for Mbed OS 5 you can see that the F303K8 target is not supported according to the USBHAL_STM32.h file.

Upvotes: 1

Related Questions