Skip to content

Blinky Tutorial

Contributors: Owntech team in 2021 Loic Quéval, 2021.11.04 Antoine Boche, 2021.11.09

Required hardware

  • O2 v_1_1_2
  • STLinkV3
  • PC (windows or linux)
  • power supply (40 V, 2 A).

Required software

To use OwnTech's system, it is necessary to download:

  • Visual Studio Code - The platform we will use to write code
  • PlatformIO - A Visual Studio Code plugin we will need to send code to the micro-controller

Step-by-step implementation

  1. Visual Studio Code: Download Visual Studio Code, either from https://code.visualstudio.com/ or from the repository manager of your OS. Install it.

step1 - Download VSCode

  1. PlatformIO: Launch Visual Studio Code. On the left side menu, click on the extension icon extension_icon. In the search engine, type "PlatformIO IDE", and click install. Finally, restart Visual Studio Code when you are prompted to do so.

step2 - PlatformIO installation

Now we will download the “blink led” code from Git to Visual Studio, and compile it.

  1. In Visual Studio code, on the left side menu, click on PlatformIO icon platformio_icon. Pro tip: if the alien icon does not show up spontaneously, press F1 key and type platformio home.

  2. In Platform.io, select "Clone Git Project ". In the search engine, type https://gitlab.laas.fr/owntech/hackathons.git. A pop up appears, select Add to Workspace.

step4 - clone the git repository

⚠ Make sure that the name of the cloned project has no space in its path as it would create issues. ⚠ Make sure that you have enough space on your hard drive so that PlatformIO can download all the required files without issues. ⚠ Make sure that you have administrator priviledges on the folder where you clone your repository. ⚠ Make sure that you have git installed on your machine.

  1. Make sure you are on the main branch of the Git project. You should see the following file tree.

step5 - File tree and main branch

  1. On the bottom menu, click on the Build icon 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. When the compilation is completed, you should see [SUCCESS] in the terminal.

Now we will connect OwnTech’s O2 to the power supply and to the PC.

  1. Connect the pins Vhigh and GND of the O2 to the 40 V power supply (set the current limitation at 1 A).

  2. Connect the micro-JTAG connector of the O2 to the PC thanks to the STLinkV3. The leds PWR and COM should be ON.

  3. Switch on the power supply. The led2 of the O2 should be ON.

step6 - physical connection

  1. On the bottom menu, click on the Upload icon flash_icon. This will flash the compiled code on the microcontroller of the O2. When the process is completed, you should see [SUCCESS] in the terminal.

  2. The led1 of the O2 should blink. You can change the blinking frequency by modifying the input of the k_msleep() function in the file src/main.cpp.

  3. On the bottom menu, click on the Serial Monitor icon serial_icon. The O2 is printing “Hello world” in the terminal.

That’s it!