Example of using Xbus library to communicate with an MTi-1 series device using a full-duplex UART connection.

Dependencies:   mbed-rtos mbed Xbus

Fork of MTi-1_example by Alex Young

Important Information

This example is deprecated and no longer maintained. There are new embedded examples available in the MT SDK folder of the MT Software Suite. For more information please visit: https://xsenstechnologies.force.com/knowledgebase/s/article/Introduction-to-the-MT-SDK-programming-examples-for-MTi-devices

Overview

The example program demonstrates connecting to an MTi-1 series device, restoring communications settings to default if necessary, and configuring the MTi to send data. For an MTi-1 the device is configured to send inertial sensor data, while MTi-2 and MTi-3 devices are configured to output orientation data using the onboard XKF3i filter.

Communication with the MTi-1 series device is implemented using a either a full-duplex UART, I2C or SPI bus. A reset line is used to reset the MTi during initialization. Data is output to a host PC terminal using a second UART.

For more information on the MTi-1 series communication protocol please refer to the datasheet: https://www.xsens.com/download/pdf/documentation/mti-1/mti-1-series_datasheet.pdf

Supported Platforms

The program has been tested on the following mbed platforms:

Using the Example

  1. To use the example program connect one of the supported mbed boards to the host PC and download the application from the mbed online compiler to the target device.
  2. With the mbed board unpowered (USB disconnected) wire the mbed board to the MTi-1 development board. The following connections are required:
    • In all cases:
      • 5V (or 3V3) main supply to VDD (P300-1)
      • MCU IO voltage (IORef) to VDDIO (P300-2)
      • GND to GND (P300-3)
      • MT_NRESET to nRST (P300-5)
    • For I2C communication:
      • MT_SCL to I2C_SCL (P300-9)
      • MT_SDA to I2C_SDA (P300-11)
      • MT_DRDY to DRDY (P300-15)
      • MT_ADD0 to ADD0 (P300-17)
      • MT_ADD1 to ADD1 (P300-19)
      • MT_ADD2 to ADD2 (P300-21)
    • For SPI communication:
      • MT_DRDY to DRDY (P300-15)
      • MT_SCLK to SPI_SCK (P300-17)
      • MT_MISO to SPI_MISO (P300-19)
      • MT_MOSI to SPI_MOSI (P300-21)
      • MT_nCS to SPI_nCS (P300-23)
    • For UART communication:
      • MT_RX to UART_TX (P300-9)
      • MT_TX to UART_RX (P300-11)

For more information on the MTi-1 development board please refer to the MTi-1 series user manual: https://www.xsens.com/download/pdf/documentation/mti-1/mti-1-series_dk_user_manual.pdf

Information

Check the defines at the top of main.cpp to determine which IO pins are used for the MT_xxx connections on each mbed platform.

Information

The active peripheral (I2C, SPI or UART) is selected on the MTi-1 development board through the PSEL0 and PSEL1 switches. Look on the bottom of the development board for the correct settings.

  1. Connect to the target using a serial terminal. The application is configured for:
    • Baudrate = 921600
    • Stop bits = 1
    • No parity bits
    • No flow control
  2. Reset the mbed board.
  3. You should be presented with a simple user interface as shown below:
MTi-1 series embedded example firmware.
Device ready for operation.
Found device with ID: 03880011.
Device is an MTi-3: Attitude Heading Reference System.
Output configuration set to:
        Packet counter: 65535 Hz
        Sample time fine: 65535 Hz
        Quaternion: 100 Hz
        Status word: 65535 Hz

Press 'm' to start measuring and 'c' to return to config mode.

Revisions of main.cpp

Revision Date Message Actions
70:ff3afeaa31be 2018-05-03 Added some function documentation File  Diff  Annotate
68:6d6dbeefd196 2016-12-05 Adding support for the F401RE Nucleo board; File  Diff  Annotate
66:f12dec1c0c3d 2015-10-06 Added support for I2C/SPI on EA-LP4088 platform. File  Diff  Annotate
65:38c908d1b515 2015-10-05 Added support for I2C/SPI on FRDM-KL46Z platform. File  Diff  Annotate
64:8a0f00a064bb 2015-10-02 MTi 1-series example is updated with support for I2C and SPI interfaces File  Diff  Annotate
63:138c196f0b88 2015-06-26 Update documentation for header pins to connect to on final development board. File  Diff  Annotate
61:b9d3e7e5ba0c 2015-06-12 Change to Apache license File  Diff  Annotate
60:ab9dad3560d3 2015-06-12 Add support for EA LPC4088 QuickStart Board File  Diff  Annotate
59:f9166c19451f 2015-06-12 Add support for Freescale FRDM-KL46Z development board File  Diff  Annotate
58:db60ef0a0d16 2015-06-12 Use RawSerial port for communication with MTi. File  Diff  Annotate
57:c3c85ebb7375 2015-06-11 Use platform defines to setup GPIO/UARTs File  Diff  Annotate
56:041d3d9c300a 2015-05-26 -fixed: typos in names of mti-2 and mti-3 File  Diff  Annotate
55:9a2d6f947f0d 2015-05-26 Only need to use 1 stop bit for UARTS. File  Diff  Annotate
54:2e9bb1390c9c 2015-05-22 Add some introduction text to main.cpp File  Diff  Annotate
53:3891f4259901 2015-05-22 Make PC serial baudrate a define File  Diff  Annotate
52:e2197b38c029 2015-05-22 Replace \n with \r\n File  Diff  Annotate
49:38ecfbff5391 2015-05-22 Fix typos in documentation comments. File  Diff  Annotate
44:b3980e8ac074 2015-05-21 Add doxygen comments for main.cpp File  Diff  Annotate
43:470c019246e4 2015-05-21 Move printing of message data to main thread. File  Diff  Annotate
42:e70756d2d8bc 2015-05-21 Add support for printing acc/gyr/mag data File  Diff  Annotate
41:504b6821a96f 2015-05-21 Add wait in main loop. File  Diff  Annotate
40:b77a8c10c76d 2015-05-21 Add utility module for processing device ids File  Diff  Annotate
39:9014c5236864 2015-05-21 Remove 'd' and 'o' PC commands. File  Diff  Annotate
38:d8d410d1662c 2015-05-21 Add some friendly usage messages on startup. File  Diff  Annotate
37:3e87bf647c68 2015-05-21 Implement support for restoring communication with the MTi File  Diff  Annotate
36:21198d933917 2015-05-21 Add file header for main.cpp File  Diff  Annotate
35:7e519b88c610 2015-05-21 Reset MT on startup. File  Diff  Annotate
34:3d7a6519a256 2015-05-21 Split out sending message from a full transaction. File  Diff  Annotate
32:fafe0f42d82b 2015-05-21 Extract function for setting output configuration. File  Diff  Annotate
31:ce1ea9ae861e 2015-05-21 Use a simple object to handle xbus memory cleanup File  Diff  Annotate
29:d9310e7b58b5 2015-05-20 Set output config based on device type. File  Diff  Annotate
26:665d3624f9ab 2015-05-20 Move PC command handling to a thread. File  Diff  Annotate
25:01356fb59467 2015-05-20 Use rtos memory pool for message reception File  Diff  Annotate
24:2cc49dc854e3 2015-05-20 Extract data handling from other xbus messages. File  Diff  Annotate
22:3eab999c5076 2015-05-19 Add support for reading back output configuration. File  Diff  Annotate
20:38560fa3d2eb 2015-05-19 Add simple command to read device Id File  Diff  Annotate
16:4bdcdac223d8 2015-05-19 Move MtData2 parsing to xbus message module File  Diff  Annotate
15:558d279addd9 2015-05-19 Make the MtData2_getItem function use XbusMessage struct File  Diff  Annotate
14:155f9a55ec51 2015-05-19 Use XbusMessage struct in parser. File  Diff  Annotate
11:8593ba137917 2015-05-13 Simple support for going to config/measurement File  Diff  Annotate
8:77cd45916596 2015-05-13 Clean up formatting of output data. File  Diff  Annotate
7:c913a7cd5231 2015-05-13 Decode data packets and write to PC File  Diff  Annotate
5:abc52dd88be2 2015-05-13 Prevent main from exiting by looping for ever File  Diff  Annotate
4:98f063b2e6da 2015-05-13 Use Xbus parser to handle data from MT. File  Diff  Annotate
2:b3e402dc11ca 2015-05-13 Main has to be a cpp to work with mbed File  Diff  Annotate