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.

24 thoughts on “UDP Between STM32-F4 Discovery Boards

    1. 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.

      1. 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.

        1. 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.

          1. 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.

          2. 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.

  1. 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.


      1. 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?

        1. 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.

    1. 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.

  2. hi
    i used two stm32f429 eval board’s as udp server that connected to one pc client and use STM32Cube_FW_F4_V1.3.0(LwIP_UDP_Echo_Server) code

    pc(as client)(ethernet hub switch)|server-1(stm32f429 as udp server)

    |server-2(stm32f429 as udp server)
    i set pc ip as
    server-1(stm32f429) ip =
    server-2(stm32f429) ip =
    and Gateway Address for 2 severs
    #define GW_ADDR0 192
    #define GW_ADDR1 168
    #define GW_ADDR2 0
    #define GW_ADDR3 1
    when i connect all them to a ethernet hub switch .server-1 & server-2 not work correct but when i connect them to router with gateway address ( ).two servers work Properly

    pc(as client)( router “”)|server-1(stm32f429 as udp server)
    |server-2(stm32f429 as udp server)

    do need ethernet communication between 2 STMf429 devices to router modem?
    why lwip don’t work with hub switch.set Gateway Address for servers in lwip code mean them need to connect router with ip = ??????

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.