7 years, 7 months ago.

USBSerial device, mbed os 5, It grabs 5 pins when it only needs 3. Can it use fewer pins?

I have a Nucleo_F401RE. I am working on setting up a custom board with the STM32F401RE as a usb serial device. This should only require 3 pins, D+,D- and Vbus (PA12,PA11,PA9). ST's Cube MX confirms this when you select USB device it only reserves three pins. In mbed os 5, the USB Serial constructor, ends up calling function USBHAL(), inside USBHAL_STM32F4.cpp where 5 pins (PA8 through PA12) are set to Alternate Function 10, USB mode. Essentially it grabs all 5 pins every time.

Is there a way to free up PA8 and PA10 for general purpose, so they are not locked to the USB? Will this mess up the USBSerial library at all? What is the correct way to do this within the mbed framework? Declare a DigitalOut(PA_8) after the USBSerial line? Or create a custom USBSerial library for my project?

Thanks.

Be the first to answer this question.