UDP between STM32-F4 Discovery boards


[The Backwoods Engineer] tested out a new accessory kit for the STM32-F4 Discovery board. The image above shows two boards communicating with the UDP protocol. Notice the extra PCB into which each Discovery board has been plugged. This is a third-party add-on which adds Ethernet, RS-232, SD card slot, and a connector for LCD or Camera. We’ve had one of these F4 Discovery boards on hand for a while and haven’t figured out a good way to connect external hardware to the huge dual pin-headers. This doesn’t solve the problem — the base board also includes dual headers to break-out all the pins — but having Ethernet, serial, and SD certainly reduces the need to add all that much more. The other drawback to the hardware is that the sample firmware is targeted at the IAR Embedded Workbench which is neither free, nor in the realm of affordable for hobbyists.

The NIC used on the baseboard has auto-crossover capabilities so the boards were connected using a regular Cat6 patch cable. This example has the boards constantly sending UDP packets with the module on the right reporting status information to a terminal via the serial connection.


  1. Thanks for posting this. I am planning on doing more posts on this new baseboard for the STM32F4-DISCOVERY.

    I’m also planning on converting at least some of the example projects to ARM gcc, so stay tuned.

    • jpnorair says:

      Nice work! If you want to take it up a notch, try getting ChibiOS or Contiki built. FreeRTOS is not, in my opinion, the best choice for networking. It comes with the Discovery, which is nice, but with those other two you get a lot more networking integrated. On a personal note, at the moment I’m sending some UDP data via some STM32L devices, in a wireless network, using average power = 120uW :P. I use OpenTag to get this low-power, but it is miles away from plug-and-play and it doesn’t support STM32F4. ChibiOS and Contiki are much closer to plug and play, and I believe that at least ChibiOS supports the Discovery F4. So, if I were in your shoes I would be trying to install one of those.

      • jeff_c says:

        I just finished up the initial port of Contiki to the F1 and am awaiting some feedback from the maintainers (it’s sitting as a pull request right now). After that, a base F4 port is on my list as well as some expansion of libopencm3 to support ethernet and USB on the F4x.

      • Thanks. I have not worked with ChibiOS before; will have to take a look.

        • Justin says:

          ChibiOS is a cool RTOS but the documentation is a joke. There’s been several requests on the forum and elsewhere for a decent tutorial or guideline but they keep pointing to a stack of useless short tutorials covering several architectures and versions of their os. I found myself wading through sourcecode or other projects for hints on how to do basic tasks. I’m now rolling my own on top of CMSIS and it’s a doddle compared to chibi.

          Contiki is the way to go for projects that rely heavily on networking.

          • jpa says:

            I never found a problem with ChibiOS documentation (having done a few projects with it). In my opinion it is quite clear and easy to follow. Not quite as good as FreeRTOS’ documentation, but on the other hand there are much more features in ChibiOS.

          • jpnorair says:

            ChibiOS has great support for STM32. It also uses lwIP, so for the networking part you can just read the lwIP documentation on the Contiki site. :) Here is a link to a walkthrough to demo ChibiOS on F4-Discovery. I tend to agree that Contiki has more networking built in, but ChibiOS is pretty good, and it is here now. http://www.chibios.org/dokuwiki/doku.php?id=chibios:articles:stm32f4_discovery

          • Justin says:

            Replying to self to correct things.

            I restarted with ChibiOS on STM32F1 and STM32F4 and I have to admit that I was wrong. Once you get the setup right (halconf, mcuconf,chconf) it’s a breeze. Takes about an afternoon of browsing the demos and taking notes, after only 4 days it has become my favorite.

  2. Wretch says:

    Damn you HaD! I received an email a few days ago from STM about this board (and the LCD and the camera boards) and have been talking myself out of getting it. Quite successfully, too, I might add. Now, thanks to you I’ll *have to* spend $40 on one.


  3. Sobh says:

    Intresting… Have anyone checked the solution of WaveShare?
    They have a 100-136 $ solution.


  4. biozz says:

    when i first got mine i must have spent days playing around with this thing … im in no way surprised! is a powerful little fucker!

  5. HC says:

    >haven’t figured out a good way to connect external hardware to the huge dual pin-headers.

    An old PATA cable might do the trick.

  6. mikeselectricstuff says:

    There is a free version of IAR embedded Workbench, with a code size limit (32K for ARM). It’s a very efficient compiler so you an get a lot into 32K!

    • hans says:

      There have been plenty of GCC toolchain for STM32 on HaD. No need to turn to crippleware.

      • hans,

        I turned to “crippleware” because I needed to get something up and running for a project. The IAR projects provided with the STM32F4-BB baseboards “just work”, without any fiddling with dependencies, libraries, etc. In my post at the link, I have asked for guys like you to create makefiles and project files for the open-source ARM compilers, so others can enjoy these projects? Give us a hand?

        • hans says:

          I’m working on a telescope mount controller with an STM32F4 discovery board, using GCC and the ST libs. I’ll be committing that Real Soon Now ™. Got your blog bookmarked, so I’ll keep you informed.

    • mike, in my tutorial at the link, I discuss the various compiler options. The 32K limited version of IAR will not compile most of the STM32F4-BB demos– I checked. The 30-day version will compile all of them

  7. Galane says:

    Where are all the goodies like this for the F3 board?

  8. FreeRTOS has its own tiny fully reentrant and thread aware UDP stack.


    • Embest has FreeRTOS versionw of the UDP, TCP, and webserver demos, that are included with the distribution for the STM32F4-BB board. I had no need for an RTOS of any kind, since my project will use simple ISRs and a timer executive. If readers are interested in an RTOS, I recommend they download the distribution for the STM32F4-BB, which is linked from my project blog at http://www.backwoodsengineer.com, which HaD was so link to link with this post.

  9. Manish Tembhurkar says:

    hello Mike…
    I went through the link:


    I am really astonished by your work and i’m working on the same.
    I would like to ask you if you could assist me on the same
    My mail id is:

    Informatik 8,
    Department of Aerospace Engineering,
    University of Wuerzburg 970072,

    Awaiting your response.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,615 other followers