Skip to content

Environment Setup

If you use or wish to use Visual Studio Code, follow this tutorial to set up your work environment.

Requirements

Before we start, make sure your machine meets all the requirements below.

Required software

  • Git: If you do not have git installed, get it here git for macOS
  • Python3: If you do not have python3 installed, get it here Python3 Installers
  • CMake: If you do not have CMake installed, get it here CMake Installer
  • Internet connection
  • Git: If you do not have git installed, get it here git for Linux
  • Python3: If you do not have python3 installed, get it here Python3 Installers
  • CMake: If you do not have CMake installed, get it here CMake Installer
  • 64 bit linux installation
  • Internet connection

Setup your work environment

To use OwnTech's system, we will use:

  • Visual Studio Code - The platform or Integrated Development Environment we will use to write code.
  • PlatformIO - A Visual Studio Code plugin that is a toolbox for microcontrollers

Required Memory Space

Make sure that you have more than 2GB on your hard drive so that PlatformIO can download all the required files without issues.

Here is how to setup the work environment:

Step 1 - Empty folder

Create an empty folder in which you will work throughout the tutorials.

Warning

  • Make sure that you have administrator privileges on the folder where you clone your repository.
  • Check that you are working on a path that is not liked to OneDrive
  • Check that you do not have any spaces in the path of your project
  • Check that the length of your project path is smaller than 256 characters.
  • You should preferably have your project folder as close as possible to the root

Step 2 - Intall VSCode

Download and install Visual Studio Code.

Step 3 - Install PlatformIO

Launch Visual Studio Code.

On the left side menu, click on the extension icon !(1)

  1. The icon looks like this: extension_icon

In the search engine, type "PlatformIO IDE", and click install. Finally, restart Visual Studio Code when you are prompted to do so.

PlatformIO installation

Step 4 - Open PlatformIO in VSCode

In Visual Studio code, on the left side menu, click on PlatformIO icon ! (1)

  1. The PlatformIO icon looks like this: platformio_icon

Pro tip

if the alien icon does not show up spontaneously, wait for a few more seconds, then press F1 key and type platformio home.

Info

If you are on linux and PlatformIO do not find the python path, you can launch the following command :

sudo apt install python3-venv

Step 5 - Clone our Core repository

In platformio, select "Clone Git Project ".

latformIO will automatically open a field in which you can copy and paste the path below :

https://github.com/owntech-foundation/Core

PlatformIO will ask you in which folder to clone the project.

Choose the folder you have created previously. A pop up will appear asking if you trust the authors.

You can trust us. 😄

Clone the git repository

Make sure you are on the main branch of the Git project.

You can see it on the bottom left of the VSCode window as shown in the image to the left.

View of the main branch

Step 6 - Build our core code

In the bottom menu, click on the Build icon. (1)

  1. The build icon looks like this: build_icon.

This will launch the compilation of the code.

If this is the first time that you compile, Visual Studio Code will download several extensions that are required to write the code onto OwnTech’s microprocessor.

Coffee Time

During your first build, PlatformIO will download all the necessary dependencies of our code. This may take several minutes depending on your machine and your internet connection.

Do not hesitate to go get yourself a coffee.

When the compilation is completed, you should see:

Compilation Complete

Note

In the unlikely event that you cannot compile, please refer to the troubleshooting section below.

Step 7 - Prepare your hardware

Before we start, make sure that you meet the requirements below

Hardware Requirements

  • Have your VSCode Environment already setup
  • Run your first compilation successfully.
  • Have an USB-C cable ready
  • Have a SPIN board ready (stand-alone or embedded on a TWIST)

USB Connection of a SPIN board embeeded onto a TWIST board

  • Connect the SPIN board to your computer via the USB.
  • Notice that the LED PWR must turn on.
  • Here you see the connection of a SPIN board embedded onto a TWIST board.

Step 8 - Upload our core code in your SPIN board

The code you compiled implements a Blinky example.

We will upload this code to the SPIN board. To do so press the flash icon. (1)

  1. The flash icon looks like this: flash icon

VSCode and PlatformIO will automatically download all the necessary libraries to flash the SPIN board.

If everything goes well, you will get a success as in the image below.

Success of your first upload

Coffee time 2

During your first upload PlatformIO will download the necessary depencies to send data to the SPIN board. Depending on your machine and your internet connection, this might take some time.

Time to pour another coffee.

Known bug - mcumgr

The upload requires a software called mcumgr.

As of the time of writing, we have experienced issues with some macOS devices in finding it.

Please refer to the ongoing issue to handle it if you have the error below.

macOS error

You will see the LED blink.

🎉 Success

Congratulations! You have uploaded your first code!

Troubleshooting

From our exeprience, there are multiple types of errors that can block your compilation.

Check the list below of possible issues

Troubleshooting
  • Git: If you do not have git installed, get it here git for Windows
  • Python3: If you do not have python3 installed, get it here Python3 Installers
  • CMake: If you do not have CMake installed, get it here CMake Installer
  • Make sure that you have administrator privileges on the folder where you clone your repository.
  • Check that you are working on a path that is not liked to OneDrive
  • Check that you do not have any spaces in the path of your project
  • Check that the length of your project path is smaller than 256 characters.
  • You should preferably have your project folder as close as possible to the root
  • Be sure the SPIN board PWR LED lights up correctly when connected to the USB
  • Check your USB-C cable is working and can handle data
  • Check your internet connectin is up and running
  • Git: If you do not have git installed, get it here git for macOS
  • Python3: If you do not have python3 installed, get it here Python3 Installers
  • CMake: If you do not have CMake installed, get it here CMake Installer
  • Be sure the SPIN board PWR LED lights up correctly when connected to the USB
  • Check your USB-C cable is working and can handle data
  • Check your internet connectin is up and running
  • If you have a problem with mcumgr, please refer to the ongoing issue to handle it.
  • Git: If you do not have git installed, get it here git for Linux
  • Python3: If you do not have python3 installed, get it here Python3 Installers
  • CMake: If you do not have CMake installed, get it here CMake Installer
  • Check that your Linux is 64bits
  • Be sure the SPIN board PWR LED lights up correctly when connected to the USB
  • Check your USB-C cable is working and can handle data
  • Check your internet connectin is up and running
List of contributors

Here is a short list of contributors to this page:

  • 2024.02.24: Ayoub Farah, Luiz Villa
  • 2021.11.04: Loïc Quéval, Romain Delpoux, Adrien Prévost
  • 2021.11.07: Luiz Villa, Antoine Boche
  • 2022.01.24: Luiz Villa, Adrien Prevost, Loïc Quéval
  • 2022.03.13: Luiz Villa
  • 2022.05.06: Luiz Villa
  • 2022.06.23: Loïc Quéval
  • 2022.01.16: Mathilde Longuet and Luiz Villa
  • 2023.07.10: Luiz Villa
  • 2023.09.02: Mathilde Longuet
  • 2023.09.25: Mathilde Longuet