Arm Mbed OS support forum

Basic system with Serial support?

I am new with MBED, so please try to excuse my lack of knowledge.

My goal is to create a system (on a black pill STM32f411) that has Serial support and can emulate a HID joystick/gamepad. I don’t need anything else.

So far, the examples I have tries don’t work … they all do not know about “Serial”.

So … how do I create a program that has Serial support using MBED studio?

And, are there any libraries that can get me started on creating a HID joystick?

Please, help, thanks.

Hello,

how this is related to the MbedStudio ? :slight_smile:

Some clarification is needed I think.

BR, Jan

Thank you for responding. I just installed the MBED Studio yesterday, Before then, I was using the online compiler. In it, the examples used “Serial”, not “BufferedSerial”. With that (the online compiler), I had also recently started using it, and it gave me the impression that it was using the latest everything. Apparently though, it was not. I’ll try BufferedSerial, and let you know how it goes.

BufferedSerial is not backward compatible.
So you need rework the exmaple/library or you must to downgrade MbedOS to 5.15 - Managing libraries - Checking out a specific library version

BR, Jan

Hello Chris,

In the targets.json configuration file Mbed doesn’t define USBDEVICE for the NUCLEO_F411RE. In addition, the blackpill board is equipped with a 25 MHz external crystal which is not directly supported by Mbed (they use 16 MHz clock source). That’s why I created and published a BLACKPILL custom target which can be used for USB connectivity too. You can find a USBSerial example here.

The following links may help you with USBHID joystick/gamepad:

https://os.mbed.com/users/wim/notebook/usb-joystick-device/

https://os.mbed.com/users/thetazzbot/code/Nucleo_Gamepad/

NOTE: If you need the Serial connection only for sending some strings or binary data to the PC then the global printf function could be sufficient.

Best regards, Zoltan

My advice would be to abandon mBed completely and use ST’s CubeMX and CubeIDE. Makes Serial a whole lot easier and it works, is all free and opensource.

Check out my project on github GitHub - dennyem/Black_STM32F407ve: Black_STM32F407ve board project generated from STM32CubeMX

Thanks. I have been considering abandoning mBed, for other reasons anyway, mostly because I have found it very difficult to find working examples and good clear documentation.

My experience has been that the learning curve for mBed is very steep; much steeper that I am willing to endure.

I actually just purchased a Teensy 4.0 and the examples and software for it are straightforward and just work.

I guess I’ll see if CubeMX/IDE is any easier to use.