Porting .NET MF to STM32F4 - changing the USB peripheral used by Tinybooter


while working on a custom .NET MF port to a custom board with STM32F4, I have run into a need to change the MCU’s USB peripheral being used by TinyBooter to communicate with the host PC&MFDeploy.

The original port from Oberon, Inc. (http://netmf4stm32.codeplex.com/) and all the other ports, including the FEZCerberus_Community use the USB_OTG_FS peripheral (pins PA11 and PA2). In my case, I would like to switch it to the USB_OTG_HS peripheral (MCU pins PB14 and PB15). The MCU being used is STM32F407ZG.

My source code is based on the original .NET MF PK 4.2 source linked above, but it is not much different from the above-mentioned FEZCerberus_Community port 4.3 when it comes to the files and data structures described below.

I tried to change the following defines in platform_selector.h from USB1 to USB2, however with no effect. The tinybooter still communicates with PC via USB_OTG_FS.

 #define DEBUG_TEXT_PORT                 USB2
 #define STDIO                           USB2
 #define DEBUGGER_PORT                   USB2
 #define MESSAGING_PORT                  USB2

What I traced so far, the constants get propagated and they get to the


file to the global variable HalSystemConfig. The HalSystemConfig structure is then used by various parts of the .NET MF – the Application/TinyBooter/TinyBooter.cpp seems important for my case. There I got stuck a bit with deciphering what happens next.

Could you hint me where to look next in order to make the USB working? Thank you for any help.

At first glance, nothing wrong with these settings.
I tried this with COM3 and it should work.
No one used USB FS, maybe it’s not tested…
You can debug with USB on a COM port using an USB COM adapter, it work for Cerberus. And USB FS is not faster than a COM port.

1 Like

I presume that in platform_selector.h you have:

 #define TOTAL_USB_CONTROLLER            2
 #define USB_MAX_QUEUES                  6  // 6 endpoints (EP0 + 5)

Not the Ceberus version:

What are your SPI configurations? The Oberon Discovery SW uses PB15 & 15 as an SPI port so perhaps on initialisation that resets the pins to SPI as opposed to USB_HS?

After that I think the next place to check is:

That seems to be where the actual pins used are set and which port, USBx, is FS or HS.

Not sure I’ve helped really.

1 Like

Hello Stephen61 and NicolasG, thx for your hints! I’ll check this out and let you know, however now I am a bit delayed by a problem with custom interop that I am discussing in another thread. As for the USB, for now I am able to get by using the “standard” USB_HS.