On this page 1. Prepare your board and SDK2. Add the SDK to your FreeRTOS project3. Provide hardware callbacks4. Configure and start the SDK5. Check it with your phone
SDK / FreeRTOS

First connection

Connect your FreeRTOS project to the APP.

Start with one working result: add your board in the APP, then make the instrument follow the APP’s day/night theme. Add navigation and vehicle controls after connecting.

This guide uses SDK 0.1.0’s FreeRTOS interface, without assuming a chip vendor. First confirm a package matching your chip, FreeRTOS configuration and toolchain.

1. Prepare your board and SDK

You need a board running FreeRTOS with BLE connectivity, a screen for the pairing code, a phone with Infinite Ride installed, and the matching SDK package.

Each device also needs its own .motolic license, the hardware ID used at issuance, and a trusted public key. Your load_license callback reads these items. See device setup.

2. Add the SDK to your FreeRTOS project

Add the package’s headers to your include path, then link its target-platform static libraries and dependencies as described in the package. Keep your board’s existing build and flashing tools.

Connect two parts of the application:

Part Your work
SDK startup and event task Configure and start the SDK; continuously read and dispatch events
Board drivers Provide license loading, storage, Bluetooth, clock, random generation and display integration

A successful build still needs working drivers before a phone can connect.

3. Provide hardware callbacks

Fill moto_terminal_config.port, the callback table the SDK uses to access your hardware:

Callback Your implementation
load_license Read this device’s license, hardware ID and public key; return 0 on success
read_pairing / write_pairing Read and durably store unchanged pairing records; output length 0 if absent
random Fill the requested number of secure random bytes
now_ms Provide a thread-safe monotonic millisecond clock
ble_send Copy bytes into the Bluetooth send queue; return the accepted count, or 0 when busy
ble_close Request closure of the specified Bluetooth connection

Your Bluetooth driver also creates the service, advertises, and forwards connection and receive events. See UUIDs and transfer rules. The display driver shows and clears the four-digit pairing code and switches day/night appearance.

4. Configure and start the SDK

This is a configuration fragment. board_fill_port is a helper you implement to populate the callbacks above, not an SDK API:

#include <moto_freertos/terminal.h>

moto_terminal_config c;
moto_terminal_config_init(&c);
board_fill_port(&c.port);
c.hardware_revision = "BOARD-REV1";
c.firmware_version = "1.0.0";
c.width = 1024;
c.height = 600;

Use your screen’s actual pixel dimensions. Leave h264 and mjpeg disabled for the initial connection check. When integrating large-screen navigation, enable video and retain HUD handling.

Start from a FreeRTOS application task in this order:

  1. Initialize storage, secure random generation, the clock and hardware drivers.
  2. Call moto_terminal_create(&c, &terminal, &error), then moto_terminal_start(terminal) after success. Check each return value.
  3. Obtain the SDK advertisement and start BLE to accept phone connections.
  4. Continuously call moto_terminal_next_event from one task to handle pairing codes and phone state. Send slow work to the appropriate driver tasks.

Build, flash and read logs with your board’s existing tools. For startup failures, see Troubleshooting.

5. Check it with your phone

  1. Sign in to the APP, open device setup and search for the board.
  2. Enter the instrument’s four-digit PIN, including leading zeros.
  3. After pairing, switch the APP’s day/night appearance.
  4. On MOTO_EVENT_PHONE_STATE, switch your display using e.data.phone.theme.
  5. Restart the board and confirm the existing pairing still connects.

Continue with vehicle controls, navigation video and HUD, or notifications and calls as needed.