Introducing SPIKE-RT: the C Language Software Platform for LEGO SPIKE Prime

by sunata-s0907 in Circuits > Robots

45 Views, 1 Favorites, 0 Comments

Introducing SPIKE-RT: the C Language Software Platform for LEGO SPIKE Prime

cover.png

This article introduces SPIKE-RT, a software platform that enables C language programming for LEGO SPIKE Prime.

Supplies

1 PC with Windows 10 or 11 operating system.

Overview

Unlike existing platforms that primarily use MicroPython, SPIKE-RT provides a real-time operating system (RTOS) environment based on TOPPERS/ASP3, allowing for real-time programming and efficient hardware control. This makes it a valuable option for developers who require high performance and precise control in their SPIKE Prime projects.

What Is SPIKE-RT?

spike-rt.png

SPIKE-RT is a real-time operating system (RTOS) based software platform designed for LEGO SPIKE Prime, developed as the successor to EV3RT. It is built on TOPPERS/ASP3 RTOS, providing a C language programming environment under the MIT license. SPIKE-RT aims to enable real-time programming and enhance control applications' reliability and performance on LEGO SPIKE Prime.

What Is TOPPERS/ASP3?

Pybricks.png

TOPPERS/ASP3 is an open-source RTOS targeting embedded systems that require high reliability, safety, and real-time performance. It extends the μITRON 4.0 specification and supports preemptive multitasking with priority-based scheduling. Its architecture is designed to maintain real-time properties while facilitating complex application development.


Comparison with Existing Software Platforms

  1. LEGO Education SPIKE App: The official platform that provides a programming environment using MicroPython and Scratch. It appears to be based on a MicroPython runtime.
  2. Pybricks: An open-source platform for LEGO devices that supports programming using MicroPython.


Both are based on the MicroPython runtime. Compared to SPIKE-RT, the following issues can be considered:

  1. Limitations in Language Extensibility: Existing software assets written in C cannot be reused.
  2. Constraints in Real-Time Performance: Issues such as garbage collection can affect real-time behavior.

SPIKE-RT enables real-time programming with C, allowing the reuse of existing C software assets and supporting the development of applications with real-time requirements.

Device Support

SPIKE-RT supports a wide range of devices in the LEGO SPIKE Prime ecosystem:

  1. Hub Internal Devices: Matrix LED, Single LED, Buttons, Accelerometer/Gyroscope (IMU), and Speaker. While external flash memory is not supported.
  2. PUP (Powered Up) Devices: Color Sensor, Distance Sensor, Force Sensor, and Motors.


User Interface of SPIKE-RT

  1. API Support:
  2. TOPPERS/ASP3 API for real-time control
  3. C Standard Library (Newlib)
  4. SPIKE API for controlling LEGO SPIKE Prime devices
  5. Communication Interfaces:
  6. Serial communication through PUP Port F (USART), USB Virtual COM Port, and Bluetooth Serial, all accessible via standard C I/O functions (fprintf()/fscanf()).
  7. Development Environment:
  8. Compiler: GCC
  9. Build System: GNU Make
  10. Programming Method: USB DFU

SPIKE-RT's user interface provides a flexible and familiar development environment for C programmers, supporting real-time device control and communication.

To See More

If you want to see a demonstration of SPIKE-RT in action, please refer to the following.

Enhancing LEGO SPIKE Prime Line Follower With C: Speed & Stability Comparison

Comparing LEGO SPIKE Prime Programming : Which is Best for Robotics Competitions ? -1

・Comparing LEGO SPIKE Prime Programming : Which is Best for Robotics Competitions? -2 (Coming Soon)

Reference