Beginner
10 min

Experience wireless freedom like never before with SP1ML and TM4C129ENCPDT

Simplify connectivity, amplify possibilities!

SPIRIT Click with Fusion for Tiva v8

Published Nov 02, 2023

Click board™

SPIRIT Click

Dev Board

Fusion for Tiva v8

Compiler

NECTO Studio

MCU

TM4C129ENCPDT

Our 868MHz ultra-low-power RF module makes long-distance wireless communication effortless, ensuring robust connections for remote monitoring and control systems.

A

A

Hardware Overview

How does it work?

Spirit Click is based on the SP1ML, a Spirit1 868MHz low-power RF module with an integrated microcontroller from STMicroelectronics. Besides the STM32L1 MCU, the module integrates a filter/balun and a chip antenna. Over the chip antenna, it achieves output power up to +11.6dBm and uses modulation schemes 2-FSK, GFSK, GMSK, OOK, and ASK. Its compact size, integrated design, all necessary FCC modular approvals, and CE compliance reduce time-to-market, making it an ideal choice for wireless applications. The data rates depend on the used modulation. The UART host interface allows simple connection to an external microcontroller with standard firmware, allowing AT commands to facilitate RF configuration, data transmission, and reception using simple point-to-point communication. It can also switch the module between the command and operating modes. In addition, the serial wire

debug interface (SWD) is also available, as the Spirit Click and the SP1ML module support custom module firmware. The 5-pin header, aside from the module, can also be used for debugging purposes. Additional RXTX LED status indicator shows when the data is sent or received. The command mode allows module configuration and status interrogation using an extended AT-style command set. In operating mode, the module serves its primary purpose as a wireless transceiver. Following power-up or reset, the module starts in operating mode with the current configuration loaded from EEPROM. In operating mode, data received from the host on the UART interface will be wirelessly transmitted by the Spirit1 radio using the current configuration settings for frequency, data rate, modulation, and output power. Conversely, any data received by Spirit1 that meets the configured filtering criteria

will be output to the UART interface. In command mode, the module will accept commands to configure module settings and interrogate module status. Spirit Click uses a standard UART interface to communicate with the host MCU, supporting baud rates from 9600 up to 250000bps, while 38400bps is the default value. You can reset the Spirit Click over the RST pin and shut it down over the SHD pin. To change the operating mode, there is the CMD pin. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the LOGIC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used for further development.

SPIRIT Click top side image
SPIRIT Click bottom side image

Features overview

Development board

Fusion for TIVA v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different 32-bit ARM® Cortex®-M based MCUs from Texas Instruments, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over a WiFi network. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, Fusion for TIVA v8 provides a fluid and immersive working experience, allowing access

anywhere and under any circumstances at any time. Each part of the Fusion for TIVA v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.

Communication options such as USB-UART, USB HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for TIVA v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

Fusion for Tiva v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

ARM Cortex-M4

MCU Memory (KB)

1024

Silicon Vendor

Texas Instruments

Pin count

128

RAM (Bytes)

262144

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Reset
PK3
RST
Command Mode
PH0
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Shutdown
PL4
PWM
NC
NC
INT
UART TX
PK1
TX
UART RX
PK0
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

SPIRIT Click Schematic schematic

Step by step

Project assembly

Fusion for PIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Fusion for Tiva v8 as your development board.

Fusion for PIC v8 front image hardware assembly
Buck 22 Click front image hardware assembly
SiBRAIN for PIC32MZ1024EFK144 front image hardware assembly
v8 SiBRAIN MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output via UART Mode

1. Once the code example is loaded, pressing the "FLASH" button initiates the build process, and programs it on the created setup.

2. After the programming is completed, click on the Tools icon in the upper-right panel, and select the UART Terminal.

3. After opening the UART Terminal tab, first check the baud rate setting in the Options menu (default is 115200). If this parameter is correct, activate the terminal by clicking the "CONNECT" button.

4. Now terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.

UART_Application_Output

Software Support

Library Description

This library contains API for SPIRIT Click driver.

Key functions:

  • spirit_power_module - Function for power mode of SPIRIT click.

  • spirit_reset - Function for reseting SPIRIT click.

  • spirit_set_mode - Function for setting mode of SPIRIT click.

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * @file main.c
 * @brief SPIRIT Click Example.
 *
 * # Description
 * This example reads and processes data from SPIRIT click.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and configures the click board.
 *
 * ## Application Task
 * Depending on the selected mode, it reads all the received data or sends the desired message 
 * every 2 seconds.
 *
 * ## Additional Function
 * - static err_t spirit_process ( void ) - The general process of collecting the received data.
 *
 * @author Jelena Milosavljevic
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "spirit.h"

#define PROCESS_BUFFER_SIZE 500
#define PROCESS_COUNTER     20

#define TEXT_TO_SEND           "MikroE - SPIRIT click board\r\n"

#define DEMO_APP_RECEIVER
//#define DEMO_APP_TRANSMITTER

static spirit_t spirit;
static log_t logger;

static char app_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;
static int32_t app_buf_cnt = 0;

/**
 * @brief SPIRIT data reading function.
 * @details This function reads data from device and concatenates data to application buffer.
 *
 * @return @li @c  0 - Read some data.
 *         @li @c -1 - Nothing is read.
 *         @li @c -2 - Application buffer overflow.
 *
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static void spirit_process ( void );

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void ) 
{
    log_cfg_t log_cfg;
    spirit_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );

    //  Click initialization.

    spirit_cfg_setup( &cfg );
    SPIRIT_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    spirit_init( &spirit, &cfg );
    Delay_ms( 1000 );

    log_info( &logger, "---- Configuring the module ----" );
    spirit_power_module( &spirit, SPIRIT_MODULE_WAKE_UP );
    spirit_reset( &spirit );
    spirit_set_mode( &spirit, SPIRIT_OPERATING_MODE );
    Delay_ms( 1000 );
    log_printf( &logger, "COMMAND MODE\r\n" );
    spirit_send_cmd( &spirit, SPIRIT_CMD_ENTER_COMMAND_MODE );
    spirit_process( );
    log_printf( &logger, "FIRMWARE VERSION\r\n" );
    spirit_send_cmd( &spirit, SPIRIT_CMD_READ_MODULE_VERSION );
    spirit_process( );
    log_printf( &logger, "TXRX LED - OPEN DRAIN OUTPUT\r\n" );
    spirit_send_cmd_with_parameter( &spirit, SPIRIT_CMD_CFG_TXRX_LED, SPIRIT_PCFG_TXRXLED_OPEN_DRAIN );
    spirit_process( );
    log_printf( &logger, "STORE CONFIG\r\n" );
    spirit_send_cmd( &spirit, SPIRIT_CMD_STORE_CURRENT_CONFIG );
    spirit_process( );
    log_printf( &logger, "OPERATING MODE\r\n" );
    spirit_send_cmd( &spirit, SPIRIT_CMD_ENTER_OPERATING_MODE );
    spirit_process( );
    log_info( &logger, "---- The module has been configured ----" );
#ifdef DEMO_APP_RECEIVER
    log_info( &logger, "---- RECEIVER MODE ----" );
#endif 
#ifdef DEMO_APP_TRANSMITTER
    log_info( &logger, "---- TRANSMITTER MODE ----" );
#endif 
    Delay_ms( 1000 );
}

void application_task ( void ) {
#ifdef DEMO_APP_RECEIVER
    spirit_process( );
#endif   
    
#ifdef DEMO_APP_TRANSMITTER 
    spirit_generic_write( &spirit, TEXT_TO_SEND, strlen( TEXT_TO_SEND ) );
    log_info( &logger, "---- The message has been sent ----" );
    Delay_ms( 2000 );
#endif
}

void main ( void ) {
   
    application_init( );

    for ( ; ; ) {
        
        application_task( );
    }
}

static void spirit_process ( void ) {
    int32_t rsp_size;
    
    char uart_rx_buffer[ PROCESS_BUFFER_SIZE ] = { 0 };
    uint8_t process_cnt = PROCESS_COUNTER;

    while( process_cnt != 0 ) {
       
        rsp_size = spirit_generic_read( &spirit, &uart_rx_buffer, PROCESS_BUFFER_SIZE );
        
        if ( rsp_size > 0 ) {  
            
            for ( uint8_t cnt = 0; cnt < rsp_size; cnt++ ) {
               
                log_printf( &logger, "%c", uart_rx_buffer[ cnt ] );
                if ( uart_rx_buffer[ cnt ] == '\n' ) {
                   
                    log_printf( &logger, "-----------------------------\r\n" );
                }
            }
        } 
        else {
           
            process_cnt--;
            
            // Process delay 
            Delay_100ms( );
        }
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.