Skip to content

3. Hello, World! Example Tutorial

This example demonstrates the basic Libtropic API and can be used to verify that the chip works correctly. In this example, you will learn about the following functions:

  • lt_init(): function used to initialize context for communication with the TROPIC01,
  • lt_verify_chip_and_start_secure_session(): helper function to start Secure Session and allow L3 communication,
  • lt_ping(): L3 command to verify communication with the TROPIC01,
  • lt_session_abort(): L3 command to abort Secure Session,
  • lt_deinit(): function used to deinitialize context.

Build and Run

Building and running the example

Go to the example's project directory:

cd examples/linux/spi/hello_world/

Create a build/ directory and switch to it:

mkdir build/
cd build/

And finally, build and run the example:

cmake ..
make
./libtropic_hello_world

TBA

TBA

After this, you should see an output in your terminal.

Configuration

In addition to the Libtropic CMake options used to configure Libtropic, this example provides the following CMake options:

  • LT_SPI_DEV_PATH (default: "/dev/spidev0.0") specifies the path to the SPI device to which the TROPIC01 is connected:

    Configuring SPI device path
    cmake -DLT_SPI_DEV_PATH=<spi_dev_path> ..
    make
    ./libtropic_hello_world
    

    TBA

    TBA

  • LT_GPIO_DEV_PATH (default: "/dev/gpiochip0") specifies the path to the GPIO device to which TROPIC01's interrupt (INT) and Chip Select (CS) lines are connected:

    Configuring GPIO device path
    cmake -DLT_GPIO_DEV_PATH=<gpio_dev_path> ..
    make
    ./libtropic_hello_world
    

    TBA

    TBA

  • LT_SH0_KEYS (default: "prod0") selects which pairing keys in slot 0 are used. Switch to engineering-sample pairing keys if your TROPIC01 is provisioned with them:

    Switching to engineering sample pairing keys
    cmake -DLT_SH0_KEYS="eng_sample" ..
    make
    ./libtropic_hello_world
    

    TBA

    TBA

    Additionally, see Default Pairing Keys for a Secure Channel Handshake for more information.

Next example