December 07, 2021, 11:07:29 am

Begin with STM32-H407 and USB OTG

Started by lhcsnelm, October 05, 2013, 04:27:10 pm

Previous topic - Next topic


I want to start but stuck.  I have H407, USB-OTG cable and PC.  My final goal is to interface with my own board but I am trying to set H407 up for now.

Can I program H407 using USB-OTG cable?  I am confused which IDE, debugger, whatever are necessary for me.
I installed Crossworks.  Crossworks does not seem to recognize my H407 when USB cable connected.

What steps should I take?

I would appreciate tutorial links for each step.  Thanks.


The H407 doesn't have a builtin programmer (like, say, the STM32F4 Discovery board with builtin ST/Link V2), so you will need a programmer.  I use Crossworks with the fairly cheap Segger-J-Link EDU. There are other Open Source methods and devices to do this.
Look at the Crossworks Help for Target Interfaces.  Olimex also has a supported OCD programmer for ARM.

There are other IDEs also, and most of them use the same programmers. Which one you pick is mostly just a personal choice. Some are free, some have a large support community, etc.


Hello lhcsnelm,

You need to conduct a bit of research to make a good choice that suits you and your needs. The most important question is whether you are going to follow the open-source (cheaper but harder for a beginner) approach or the commercial (expensive but much faster and easier) approach.

If you use the first one you would save all the money for software since the community effort project OpenOCD is open-source. You would need an OpenOCD debugger like OLIMEX ARM-USB-TINY-H( We also have a free IDE (which is far from perfect but gives some sort of a start for people encountering OpenOCD + Eclipse + open-source compiler for first time).

Another cheap option is ARM-JTAG-COOCOX ( and then using the free COOCOX IDE ( CooCox IDE is very popular in Asia.

If you go for commercial approach you would need to purchase license for IAR EW for ARM or Rowley Crossworks or another commercial IDE. OLIMEX ARM-USB-TINY-H can also be used with both IAR EW for ARM and Rowley Corssworks.

Of course, there are a lot of other variants - if you are going the professional way check Segger's J-Link debuggers.

About the bootloader (the way of programming the board via USB): yes, there is an embedded bootloader in the board which can be accessed on the USB_HOST connector and requires USB type A to USB type A cable. You also need to change the state of the SMT jumpers B1_1/B1_0 and B0_1/B0_0 as explained in the user's manual page 21. You would also need a dfu software program by ST (to install on your PC). More info on the DFU bootloader might be found here:

One thing to note about USB programming though is that it is not a very good approach for the beginner or for active development - you can't debug and it takes a lot of time to create binary file from your code, enter bootloader mode on the board, start the bootloader application, find the binary file, upload it to the board. Then change one character of code and do the same again... It has an use though - if you need to program the board just once and you have to do this for a lot of boards you won't have to purchase a lot of debuggers. Very useful if you are implementing STM32F407 in a consumer product.

Best regards,
Technical support and documentation manager at Olimex