Boilerplate to create a project with: STM32 + Ethernet + micro-ROS + FreeRTOS + Arduino + PlatformIO

Overview

micro_ros_stm32_template

Boilerplate to create a project with:

STM32 + Ethernet + micro-ROS + FreeRTOS + Arduino + PlatformIO

Default config

STM32F407 + Ethernet (eg. STM32-E407 Olimex board) directly connected with Ethernet cable to a computer.

device IP:PORT
Client (STM32F407 + Ethernet) 192.168.1.177
Agent (user's laptop) 192.168.1.176:8888

Please set a static IP address on your laptop, eg. with netplan:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp7s0:
      dhcp4: no
      dhcp6: no
      addresses:           
        - 192.168.1.176/24

Flashing STM32

Click Use this template button, and clone your own copy of this repo.

Open the project with a Visual Studio Code with PlatformIO extension.

# Build project
$ pio run

# Upload firmware
$ pio run --target upload

# Clean build files
$ pio run --target clean

ST-Link

uncomment:

upload_protocol = stlink

and click PlatformIO: Upload button.

Serial

uncomment:

upload_protocol = serial

Set BOOT0 pin to HIGH and click RESET button, to enter the programming mode.

Click PlatformIO: Upload button.

Set BOOT0 pin to LOW and click RESET to start newly flashed firmware.

Running a demo

System architecture:

system architecture

Now to test Micro-ROS with a default ROS 2 listener/talker example just execute:

$ cd demo
$ docker-compose up

$ docker ps
CONTAINER ID   IMAGE                               COMMAND                  CREATED          STATUS          PORTS                                       NAMES
f2c457f245bf   osrf/ros:galactic-desktop           "/ros_entrypoint.sh …"   48 minutes ago   Up 17 seconds                                               agent_listener_1
bdabd7761b4c   microros/micro-ros-agent:galactic   "/bin/sh /micro-ros_…"   51 minutes ago   Up 17 seconds   0.0.0.0:8888->8888/udp, :::8888->8888/udp   agent_talker_1

$ docker exec -it bda bash

[email protected]:/# source /opt/ros/$ROS_DISTRO/setup.bash
[email protected]:/# ros2 node list
/listener
/stm32_node
[email protected]:/# ros2 node info /stm32_node 
/stm32_node
  Subscribers:

  Publishers:
    /chatter: std_msgs/msg/String
  Service Servers:

  Service Clients:

  Action Servers:

  Action Clients:

[email protected]:/# ros2 topic echo /chatter 
data: 'Hello World: 6, sys_clk: 9000'
---
data: 'Hello World: 7, sys_clk: 9000'
---
data: 'Hello World: 8, sys_clk: 9000'
---
data: 'Hello World: 9, sys_clk: 9000'
---

Troubleshooting

Access rights to ST-LINK

Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: open failed
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

Solution:

sudo apt -y install stlink-tools
sudo systemctl restart udev

After that, unplug your stlink (or development board) for 5 seconds and plugin it in again. This will cause the new device permissions to take effect.

Now you can retry uploading the firmware from PlatformIO.

*Source

Owner
Husarion
Autonomous Mobile Robots Made Simple
Husarion
Simple template project to build a firmware for the STM32F4 Discovery board with FreeRTOS and libopencm3

STM32F4 Discovery FreeRTOS Makfile This is a simple template project to build a firmware for the STM32F4 Discovery board with FreeRTOS and libopencm3

Andrea Colla 6 Oct 21, 2021
ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

esp32-internet-ota ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

Husarnet 18 Nov 27, 2021
Firmware for Pinetime smartwatch written in C/C++ and based on FreeRTOS

InfiniTime The goal of this project is to design an open-source firmware for the Pinetime smartwatch : Code written in modern C++; Build system based

InfiniTime 1.1k Dec 4, 2021
debug esp32-c3 Ai-thinker board in platformio

Platformio Ai-thinker esp32-c3 project template with ability to debug using builtin USB JTAG. To be able to view periph regs while debugging, you need

null 2 Dec 6, 2021
TTGO GPS lock fix with platformio

TTGO_T-beam_GPS-reset converted for easy upload with platformio Based on Fork by ErikThevking https://github.com/eriktheV-king/TTGO_T-beam_GPS-reset T

null 2 Nov 23, 2021
image_projection is a ROS package to create various projections from multiple calibrated cameras.

image_projection Overview image_projection is a ROS package to create various projections from multiple calibrated cameras. Use cases involve: Rectify

Technische Universität Darmstadt ROS Packages 89 Nov 25, 2021
Firmware for the Boson Ethernet Adapter

Boson Ethernet Firmware This project contains firmware and gateware required to adapt the FLIR boson into an ethernet connection Directory Structure f

Gregory Davill 6 Oct 15, 2021
QNEthernet, an lwIP-Based Ethernet Library For Teensy 4.1

QNEthernet, an lwIP-Based Ethernet Library For Teensy 4.1 Version: 0.10.0-snapshot The QNEthernet library provides Arduino-like Ethernet functionality

Shawn Silverman 5 Nov 22, 2021
Arduino Interface for cheap 2.4ghz RF enabled Solar Micro Inverters

NETSGPClient Arduino Interface for cheap 2.4ghz RF enabled Solar Micro Inverters using the so-called NETSGP protocol for communication. Here is a YouT

null 17 Dec 3, 2021
Timed reminder lights using Adafruit NeoPixels and Arduino Micro (3.3v ATMEGA 32U4)

SmartCoaster When I'm working, I get so focused that I forget to drink water. It's not that I'm not thirsty—oh, I am—but I'll get a glass of water, pu

Steven M. Caruso 16 Aug 12, 2021
A simple example for 'Arduino' compatible boards to interface with I2C to the MPU-6050, a 6-axis micro-electromechanical IC

Arduino-MPU-6050 A simple example for 'Arduino' compatible boards to interface with I2C to the MPU-6050, a 6-axis micro-electromechanical IC ==About==

Ivan 1 Oct 19, 2021
Use cmake with your stm32 project.

cmake bare metal (cbm) Overview This Repo is project using cmake to develop stm32fxx projects under the same repo. And thereby sharing commmon functio

null 5 Nov 25, 2021
Create a calculator of any kind in any language, create a pr.

calculators Create a calculator of any kind in any language, create a pr. Create a calculator of any type using the programming language of your choic

Akshay Gautam 2 Dec 1, 2021
32blit SDK boilerplate for the PicoSystem RP2040-based handheld

PicoSystem 32blit Boilerplate This is a basic template for starting 32blit projects for the Pimoroni PicoSystem. It shows a minimal code layout and as

32blit 5 Oct 23, 2021
Boilerplate-free YAML parsing for C++

AutoYAML AutoYAML is a Clang/LLVM/LibTooling-based program that automatically generates yaml-cpp conversion code for C++ record types. Usage As a moti

Timo Nicolai 10 Nov 12, 2021
This project contains the main ROS 2 packages of Xiaomi CyberDog®.

Xiaomi CyberDog ROS 2 文档包含简体中文和English 简介 - Introduction 本项目包含小米铁蛋®的ROS 2主要功能包. This project contains the main ROS 2 packages of Xiaomi CyberDog®. 基本信

null 197 Dec 1, 2021
STM32 firmware for a physical switch to set the GRUB boot selection

STM32 firmware for a physical switch to set the GRUB boot selection

Stephen Holdaway 243 Nov 6, 2021
A place to collaborate on code for the Embedded.fm book club. Currently reading "STM32 ARM Programming for Embedded Systems".

Welcome to the Book Club Code site! This is a place for the Embedded.fm book club to collaborate and learn together. Repo Structure Guide Top-level fo

Peter Griffin 10 Jun 4, 2021