Getting Started

This section describes how to install the SPARK Software Development Kit (SDK) virtual environment on a user’s personal computer. Virtual environments are isolated environments that use specific versions of software packages without affecting the rest of the system. They work by creating a separate directory where all the necessary files for the environment are installed. The specific virtual environment is activated by modifying the system’s PATH variable to point to that directory so that commands are executed using the packages installed there rather than the system’s default packages.

The SPARK SDK development environment dependencies are all contained within this virtual environment and can be easily bootstrapped by running a single script.

After following the steps outlined below to install and set up the virtual environment, the user will be ready to start building their own applications. Let’s get started!

Preferred Integrated Development Environment (IDE)

SPARK’s SDK is designed to work with Visual Studio Code (VS Code). This IDE is used internally and can be considered as tested and supported. Other IDEs or source code editors can be utilized provided that they support CMake and Pixi virtual environments.

The use of CMake files and the Pixi virtual environment allows for a more flexible and scalable development process and enables users to access a variety of tools and platforms to build and develop applications using the SPARK SDK.

Warning

Users of a different source code editor or IDE assume the responsibilities of ensuring that it supports CMake and that the necessary plugins or extensions are installed. They will also need to set up a virtual environment using the provided scripts. Refer to the Pixi documentation to learn how to integrate the environment with your IDE.

If you need to create or activate the virtual environment outside of VS Code, refer to the Getting Started with SPARK: Advanced Setup section.

Prerequisites

  • A 64-bit PC running Windows or Linux

  • A pair of either:

    • An EVK1.4 equipped with a SR10xx module

    • A QUASAR EVK equipped with a SR10xx or SR11xx radio module.

  • USB Cable for terminal display and flashing with DFU.

  • VS Code IDE

  • STM32 STLink programmer for flashing (Optional).

Warning

Make sure to avoid space characters in the SDK’s project path.

Warning

To avoid potential issues with Windows’ maximum path length restriction, it is recommended to unzip the package as close to the root directory (C:\) as possible. Extracting the files too deeply nested may result in errors., you may also refer to the Windows Long Path Support section to enable long path support in Windows.

VS Code Extensions

To use the SPARK SDK and its virtual environment with VS Code, certain VS Code extensions need to be installed.

Follow these steps to install the recommended VS Code extensions:

  1. Open the VS Code command palette by pressing Ctrl+Shift+P.

  2. Type Extensions: Show Recommended Extensions and select it from the list.

  3. Install Workspace Recommendations.

Note

This will automatically trigger the virtual environment creation process.

Hardware

The example applications provided with the SPARK SDK are written specifically for the SPARK Evaluation Kit (EVK) boards. This means that to run these applications, the user will need at least two EVKs and one ST-Link debug probe (for debugging).

If access to two EVKs is not possible, the user may still use the example applications as a reference for building their own applications. The code will need to be modified for specific hardware configurations, but the overall structure and functionality of the applications are still useful starting points.

In any case, it is recommended to carefully review the documentation and code provided with the SPARK SDK to ensure a clear understanding of how the example applications work and how to adapt them for specific needs.

Create the Virtual Environment with VS Code

To initiate the virtual environment and download all dependencies, it’s necessary to create it once. The environment will be automatically created upon the installation of the extension.

If the extension is installed correctly and the virtual environment is created successfully, the user should now be able to select an application for compilation and any terminal opened within VS Code will have the environment automatically activated.

Attention

If you have restricted or no internet access, refer to the Offline Environment section for alternative setup instructions.

Note

If you need to create or activate the virtual environment outside of VS Code, refer to the Getting Started with SPARK: Advanced Setup section.

Building Applications

With the SPARK Virtual Environment created, the next step is to build the applications. Follow these steps.

  1. Open the VS Code command palette by pressing Ctrl+Shift+P.

  2. Type CMake: Select Configure Preset and press Enter.

  3. Select the desired preset.

  4. Open the VS Code command palette again and choose CMake: Delete Cache and Reconfigure..

  5. Open the VS Code command pallete a final time and choose CMake: Clean Rebuild.

The applications will build as binaries and the progress can be viewed in the Output terminal.

Flashing an EVK

Once a binary is built through VS Code, it can be flashed onto an EVK in DFU mode.

Setting up an EVK’s DFU Mode driver

On Windows, the bootstrap will install the STM32 USB DFU driver automatically.

On Linux, permission to access STM32 USB devices in DFU mode from user space must be explicitly granted via udev rules.

  1. Create /etc/udev/rules.d/50-usb-conf.rules, and copy the following in it.

    SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", GROUP="users", MODE="0666"
    
  2. Reload udev system.

    sudo udevadm control --reload-rules
    

Putting an EVK in DFU Mode

  1. With the Power Switch turned ON, press and hold the Bootloader button.

  2. Press and release the MCU Reset button.

  3. Release the Bootloader button.

Flashing

  1. Connect an EVK to the host computer through USB. Make sure to only connect one EVK in DFU mode at a time.

  2. Open the VS Code command palette by pressing Ctrl+Shift+P.

  3. Type Tasks: Run Task and press Enter.

  4. Select [DFU/STM32] Flash binary.

  5. Select which binary to flash on the EVK and wait for completion.

Viewing the Terminal

Every application features a terminal output that displays important information such as real-time SWC link and application statistics. Live statistics viewed through a terminal emulator allow developers to monitor the behavior and performance of the application during runtime. Once an application is built and flashed on the target device, follow these steps depending on the operating system to view the terminal output.

PuTTY is recommended for Windows users.

  1. Install PuTTY from the official website.

  2. Identify the device’s serial port and open it with PuTTY.

Hint

To help identify the device’s COM port number:

  1. Unplug the device (if already connected).

  2. Open the Device Manager and view the Ports (COM & LPT) device category. Note which devices are already listed.

  3. Plug the device and wait for the Device Manager to refresh the list.

  4. The device and its COM port should be added to the previously viewed list.

Minicom is recommended for Linux users. Here is the procedure for Debian-based distributions:

  1. In a terminal, install Minicom.

    $ sudo apt update
    $ sudo apt install minicom
    
  2. Identify the device’s serial port and run minicom.

    $ sudo dmesg
    $ sudo minicom -D /dev/<serial_port>
    

    Hint

    Superuser privileges are not required to run minicom if appropriate udev rules have been added to grant the necessary permissions to access the devices.

Note

The EVKs use the USB Communication Device Class standard and do not require a particular configuration as opposed to UART for example.

Time to Explore

The user is ready to explore and build new applications or port the example applications onto new hardware. It is recommended to start by reviewing the documentation and code provided with the SPARK SDK as well as by experimenting with the example applications to gain a better understanding of how the platform works.

From there, the user can begin building their own applications using the SPARK SDK or modify the example applications to meet their specific needs.

The possibilities are endless, and we’re excited to see the creations that will emerge from our platform!