[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”
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.
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.
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.
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.
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.
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
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.
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.
Intresting… Have anyone checked the solution of WaveShare?
They have a 100-136 $ solution.
That looks pretty good in fact, much better that the expansion board mentioned by HaD. That one doesn’t even have a HS USB port…
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!
>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.
They’re 50 pin so use SCSI cables.
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!
There have been plenty of GCC toolchain for STM32 on HaD. No need to turn to crippleware.
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?
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
Where are all the goodies like this for the F3 board?
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.
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:
Department of Aerospace Engineering,
University of Wuerzburg 970072,
Awaiting your response.
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 192.168.0.11
server-1(stm32f429) ip = 192.168.0.2
server-2(stm32f429) ip = 192.168.0.3
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 (192.168.0.1 ).two servers work Properly
pc(as client)( router “192.168.0.1”)|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 =192.168.0.1 ??????
Please be kind and respectful to help make the comments section excellent. (Comment Policy)