Skip to content
This repository has been archived by the owner on Jun 3, 2019. It is now read-only.

STM32F4DiscoTalkerListenerDemo

Morgan Quigley edited this page Aug 25, 2015 · 2 revisions

NOTE: this text assumes that freertps is installed in ~/freertps .

Step 0: Attach a USB-UART converter to stdout of the STM32F4

This isn't strictly necessary, but it's useful for debugging and evaluation to see what the STM32F4 is printing to its stdout console. Any 3.3v USB-UART converter will bring this stream back to your workstation, but we have found that the TTL-232R-RPI cable from FTDI works great and already comes with 100-mil connectors crimped onto the wires. It is available from Mouser and Digikey, among others.

The current FreeRTPS STM32F4 library directs stdout to UART6, which uses pin PC6 for its TX line. This is convenient because there is a ground connection right next to it on the STM32F4-Discovery board, so it's easy to plug in the RX and GND pins of a USB-UART gadget, as shown in the lower-right of this photo. (Note that depending on which USB-UART cable you use, you may need to swap the yellow and orange wires.)

STM32F4 talker

First, let's program your STM32F4-Discovery board with the talker firmware:

cd ~/freertps
make program-talker-stm32f4_disco-metal

Then, let's start up a terminal so we can read the STM32F4 console. The text below assumes that your USB-UART cable shows up as /dev/ttyUSB0. Depending on the types of USB peripherals plugged into your system, this may be different.

cd ~/freertps/utils
bin/console /dev/ttyUSB0

If you push the reset button on the STM32F4-Discovery board at this point, you should see many lines of startup text printed by FreeRTPS.

Now, in another console, you can start the ROS2 Listener demo:

cd ~/ros2_ws
source install/setup.bash
listener__rmw_opensplice_cpp

and you should see "Hello, World" messages printing out in the ROS2 listener demo console. Hooray!

STM32F4 listener

Now we'll flip the roles of the talker and listener. Let's program the STM32F4-Discovery board with listener firmware:

cd ~/freertps
make program-listener-stm32f4_disco-metal

and let's run the ROS2 talker demo:

cd ~/ros2_ws
source install/setup.bash
talker__rmw_opensplice_cpp

you should see "Hello, World" messages printing out in the console program that is listening to the USB-UART converter that is, in turn, listening to the STM32F4 console (e.g., stdout of libc on the STM32). Hooray!