STMicroelectronics STEVAL-MKI121V1 Discovery-M1 Evaluation board User manual
விளம்பரம்
விளம்பரம்
UM1744
User manual
STEVAL- MKI121V1 communication protocol
Introduction
The scope of this user manual is to present the communication protocol used between the
STEVAL-MKI121V1 product evaluation board (Discovery-M1) and the iNEMO SDK
(Software Development Kit). This communication protocol runs upon a physical communication channel based on USB virtual COM, which represents the physical channel used in the communication between the STEVAL-MKI121V1 and the PC.
The first chapter explains the general frame format and main rules used in the protocol.
The second chapter explains all the frames used in the actual release of the embedded firmware and Software Development Kit (SDK).
May 2014 DocID026205 Rev 1 1/37
www.st.com
Contents
Contents
2/37
UM1744
General frame format and protocol rules . . . . . . . . . . . . . . . . . . . . . . . . 4
STEVAL-MKI121V1 frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
STEVAL-MKI121V1 frame types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Communication control frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
iNEMO_Enter_DFU_Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
iNEMO_Set_Sensor_Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
iNEMO_Save_to_Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
iNEMO_Load_from_Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Accelerometer "Sensor_Parameter" field . . . . . . . . . . . . . . . . . . . . . . . 20
Accelerometer Output_Data_rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Accelerometer high-pass filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
DocID026205 Rev 1
UM1744
Contents
Accelerometer scale factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Accelerometer sensor name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Magnetometer "Sensor_Parameter" field . . . . . . . . . . . . . . . . . . . . . . . 22
Magnetometer Output_Data_rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Magnetometer full scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Magnetometer operating mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Magnetometer offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Magnetometer scale factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Magnetometer sensor name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Calibration sensor frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
iNEMO_Start_HIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
iNEMO_Abort_HIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Gyroscope "Sensor_Parameter" field . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Gyroscope output data rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Gyroscope scale factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Gyroscope sensor name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Pressure "Sensor_Parameter" field . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Pressure sensor output data rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Pressure sensor name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Temperature "Sensor_Parameter" field . . . . . . . . . . . . . . . . . . . . . . . . . 28
Temperature sensor offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Temperature sensor scale factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Temperature sensor name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Acquisition sensor data frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
iNEMO_Set_Output_Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
DocID026205 Rev 1 3/37
37
General frame format and protocol rules
1 General frame format and protocol rules
UM1744
This paragraph explains the format of the frame used in the STEVAL-MKI121V1 communication protocol. Because, the STEVAL-MKI121V1 exchanges data and commands with the PC GUI through a physical communication channel based on a USB Virtual COM, each frame, described below, represents the payload of a USB frame.
Figure 1. STEVAL-MKI121V1 communication architecture
The frames are described as a sequence of fields in a specific order. All frame formats are depicted in the order in which they are passed to the USB driver, from left to right. Bits within each field are numbered from k-1 (leftmost and most significant) to 0 (rightmost and least significant), where the length of the field is k bits.
The frame format is composed of a header and an optional payload. The general frame
shall be formatted as illustrated in
. The header is composed of three mandatory
(M) fields, each of which is 1 byte in length, while the payload is an optional field whose maximum length is 61 bytes. See LF/MF field in the following section to overcome this limit.
Figure 2. General frame format
1.1.1 Frame control field
The frame control field is 1 byte in length and contains information defining the frame type
and other control flags. The frame control field shall be formatted as illustrated in
.
Figure 3. Frame control field
4/37 DocID026205 Rev 1
UM1744 General frame format and protocol rules
The frame type subfield is 2 bits in length and shall be set to one of the values listed in
Table 1. Frame type list
Value
00
01
10
11
Frame type
CONTROL
DATA
ACK
NACK
The Ack subfield is 1 bit in length and specifies whether an acknowledgment is required from the recipient on receipt of a DATA or CONTROL frame. If this subfield is set to one, the recipient shall send an acknowledgment frame only if, upon reception, the frame passes all the needed levels of filtering. If this subfield is set to zero, the recipient device shall not send an acknowledgment frame. It is possible to embed a payload in an acknowledgment frame
(piggybacking) to send useful information to the transmitter and avoiding further transactions. When the Ack field is set to one and upon reception the frame doesn't pass the needed level of filtering, the recipient shall send a not-acknowledgment frame (NACK), whose payload is an error code (e.g. unsupported command, value out of range,…). In the
ACK and/or NACK frames the Ack field shall be set to zero and ignored on reception.
The LF/MF (Last Fragment / More Fragment) subfield is 1 bit in length and it is used for fragmentation and reassembling. This field is set to zero to indicate a single frame or the last frame of a multiple-frame transaction. This field is set to 1 to indicate that other frames will follow all those belonging to the same transaction. In the ACK and NACK frames (with or without payload) fragmentation is not supported and this subfield shall be set to zero in transmission of ACK and NACK frames and ignored on reception.
The frame version subfield is 2 bits in length and shall be set to the non-reserved for future
Value
00
01
10
11
Table 2. Frame version list
Frame version
Version 1
RFU
The QoS (Quality of Service) subfield is 2 bits in length and shall be set to one of the values listed in
. This subfield allows the application to exchange and process data and
control frames with different priorities.
DocID026205 Rev 1 5/37
37
General frame format and protocol rules UM1744
Value
00
01
10
11
Table 3. QoS list
Frame version
Normal Priority
Medium Priority
High Priority
RFU
The length field is 1 byte in length and contains the number of bytes that follow the length field. Admitted values are in the range 1 ÷ 62.
The message ID is 1 byte in length and contains an identifier of the user application
and the following sections for further details.
There are two types of transactions: acknowledgment or non-acknowledgment of the DATA or CONTROL frame.
A DATA or CONTROL frame with the Ack subfield of its frame control field set to zero shall not be acknowledged by its intended recipient. The originating device (PC or Discovery-M1 board) shall assume that the transmission of the frame was successful. The message sequence chart in
shows the scenario for transmitting a single DATA or CONTROL
frame from an originator to a recipient without requiring an acknowledgment.
Figure 4. Data or control frame transmission without an acknowledgment
6/37
A DATA or CONTROL frame transmitted with the Ack subfield of its frame control field set to one shall be acknowledged by the recipient. If the intended recipient correctly receives the frame, it shall generate and send an ACK frame containing the same message ID from the
DATA or CONTROL frame that is being acknowledged. It is possible also to include a payload in the ACK frame to transfer useful data from the recipient to the originator. The
shows the scenario for transmitting a single DATA or
CONTROL frame from an originator to a recipient with an acknowledgment.
DocID026205 Rev 1
UM1744 General frame format and protocol rules
Figure 5. Data or control frame transmission with an acknowledgment
If the frame received does not conform to all the required filtering rules, the recipient shall generate and send a NACK frame containing the same message ID from the DATA or
CONTROL frame that is being acknowledged and containing the error code. The message
shows the scenario for transmitting a single "bad" DATA or
CONTROL frame from an originator to a recipient with a not-acknowledgment.
Figure 6. "Bad" data or control frame transmission with not-acknowledgment
DocID026205 Rev 1 7/37
37
STEVAL-MKI121V1 frames UM1744
2.1 STEVAL-MKI121V1 frame types
The frames used in the STEVAL-MKI121V1 are classified in five types:
1.
Communication control frames
2. Board information frames
3. Sensor setting frames
4. Acquisition sensor data frames
2.2 Communication control frames
Communication control frames are frames originated by the software PC (SDK or GUI) and used to send specific commands to the Discovery-M1 board. All the communication control frames are listed in
.
Commands
iNEMO _Connect iNEMO _Connect_Response iNEMO _Disconnect iNEMO_Disconnect_Response
CONTROL
ACK
NACK
CONTROL
ACK
NACK iNEMO_Reset_Board iNEMO_Reset_Board_Response
CONTROL
ACK
NACK iNEMO_Enter_DFU_Mode iNEMO_Enter_DFU_Mode_
Response
CONTROL
ACK
NACK iNEMO_Trace iNEMO_Trace_Response
CONTROL
ACK
NACK iNEMO_Trace_Data iNEMO_Led_Control iNEMO_Led_Control_Response
Table 4. Communication control frames
Frame
Type
Ack required
Message
ID
QoS
Payload
Length
(in bytes)
Payload
DATA
CONTROL
ACK
NACK
Y
N
N
Y
N
N
Y
N
N
Y
N
N
Y
N
N
N
Y
N
N
0x03
0x03
0x03
0x07
0x07
0x07
0x00
0x00
0x00
0x01
0x01
0x01
0x02
0x02
0x02
0x07
0x08
0x08
0x08
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
M
N
Originator
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
Error Code
Error Code
Error Code
Error Code
PC
Discovery-M1
PC
Discovery-M1
PC
Discovery-M1
PC
Discovery-M1
PC
Variable
1
Error Code
Discovery-M1
String for debug purpose
0x00 OFF
0x01 ON
PC
0
1 Error Code
Discovery-M1
8/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
2.2.1 iNEMO_Connect
The iNEMO_Connect command shall be the first command sent from the GUI or SDK to the
Discovery-M1 board. Any other command sent before the iNEMO_Connect will not be processed by Discovery-M1. It works like a "ping" and opens the communication between the GUI or SDK and the Discovery-M1 board at the application level.
shows the frames involved in the iNEMO_Connect transaction.
Figure 7. iNEMO_Connect frames
2.2.2 iNEMO_Disconnect
The iNEMO_Disconnect command closes the communication between the PC and the
shows the frames involved in the iNEMO_Disconnect transaction.
Figure 8. iNEMO_Disconnect frames
The GUI (or SDK), after receiving the ACK frame, shall close the USB Virtual Com. To reopen the communication only the iNEMO_Connect command shall be used.
2.2.3 iNEMO_Reset
The iNEMO_Reset command implies a software reset of the Discovery-M1 board. After receiving the iNEMO_Reset command, the Discovery-M1 board replies with the ACK frame; then waits for 5 seconds before disconnecting the USB cable in software mode and invokes a software reset. The GUI (or SDK), after receiving the ACK frame, shall close the USB
DocID026205 Rev 1 9/37
37
STEVAL-MKI121V1 frames UM1744
Virtual Com. To re-open the communication only the iNEMO_Connect command shall be used.
shows the frames involved in the iNEMO_Reset transaction.
Figure 9. iNEMO_Reset frames
2.2.4 iNEMO_Enter_DFU_Mode
The iNEMO_Enter_DFU_Mode command allows the Discovery-M1 board to enter in DFU mode in software mode. After receiving the iNEMO_Enter_DFU_Mode command, the
Discovery-M1 board replies with an ACK frame. Then it will set the Option Byte Data0 (at address 0x1FFFF804) to one, will disconnect the USB cable in software mode, and it will invoke a software reset. After reset, the Discovery-M1 will enter in DFU mode. After entering in DFU mode in software, the Discovery-M1 will change the Option Byte Data0 to zero. The user can leave the DFU mode in two ways: by unplugging and plugging in the USB cable
(hardware mode), or by using the Leave_DFU_Mode command available in the DfuSe
Demo PC application or in the GUI or SDK. The GUI (or SDK) shall close the USB Virtual
Com after receiving the ACK frame.
shows the frames involved in the iNEMO_Enter_DFU_Mode transaction
Figure 10. iNEMO_Enter_DFU_Mode frames
10/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
2.2.5 iNEMO_Trace
The iNEMO_Trace command allows the user to enable or disable "trace data". Trace data are used for debugging purposes and they will be string displayed in a debug window. The frames are asynchronous and shall have medium priority (QoS sub-field of frame control field).
shows the frames involved in the iNEMO_Trace transaction
Figure 11. iNEMO_Trace frames
2.2.6 iNEMO_Led_Control
The iNEMO_Led_Control command allows turning on and off the LED available on the iNEMO board.
shows the frames involved in the iNEMO_Led_Control transaction.
Figure 12. iNEMO_Led_Control frames
Board information frames are frames originated by the software PC (SDK or GUI) and used to retrieve information about firmware and hardware features of the Discovery-M1 board. All the board information frames are listed in
.
DocID026205 Rev 1 11/37
37
STEVAL-MKI121V1 frames UM1744
Commands
iNEMO_Get_Device_Mode iNEMO_Get_Device_Mode_
Response iNEMO_Get_MCU_ID iNEMO_Get_MCU_ID_Response iNEMO_Get_FW_Version iNEMO_Get_FW_Version_
Response iNEMO_Get_HW_Version iNEMO_Get_HW_Version_
Response iNEMO_Identify iNEMO_Identify_Response iNEMO_Get_AHRS_Library iNEMO_Get_AHRS_Library_
Response iNEMO_Get_Libraries iNEMO_Get_Libraries_Response
Table 5. Board information frames
Frame
Type
Ack required
Message
ID
QoS
Payload
Length
(in bytes)
CONTROL Y 0x10 N
ACK
NACK
CONTROL
ACK
NACK
CONTROL
ACK
NACK
CONTROL
ACK
NACK
CONTROL
ACK
NACK
CONTROL
ACK
NACK
CONTROL
ACK
NACK iNEMO_Get_Available_Sensors CONTROL
N
N
Y
N
N
Y
N
N
Y
N
N
Y
N
N
Y
N
N
Y
N
N
Y
0x10
0x10
0x12
0x12
0x12
0x13
0x13
0x13
0x14
0x14
0x14
0x15
0x15
0x15
0x17
0x17
0x17
0x18
0x18
0x18
0x19
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
Payload Originator
0
1
1
0
12
1
0
Variable
1
0
Variable
1
0
12
1
0
Variable
1
0
0
1
0
PC
0x00
Sensor
Mode
0x01
Master
Mode
Error Code
Discovery-M1
PC
Unique
Device ID
Discovery-M1
Error Code
PC
String
Firmware
Version
Discovery-M1
Error Code
Date, Time PC
String
Hardware
Version
Discovery-M1
Error Code
PC
Unique
Device ID
Discovery-M1
Error Code
PC
AHRS enable/dis able string Discovery-M1
Error Code
PC
List of supported libraries
Discovery-M1
Error Code
PC
12/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
Commands
Table 5. Board information frames (continued)
Frame
Type
Ack required
Message
ID
QoS
Payload
Length
(in bytes)
Payload Originator
iNEMO_Get_Available_Sensors_
Response
ACK
NACK
N
N
0x19
0x19
N
N
1
1
List of available sensors
Discovery-M1
Error Code
2.3.1 iNEMO_Get_MCU_ID
The iNEMO_Get_MCU_ID command allows retrieving from the Discovery-M1 board the
96-bit unique device identifier of the STM32F103 microcontroller.
frames involved in the iNEMO_Get_MCU_ID transaction.
Figure 13. iNEMO_Get_MCU_ID frames
2.3.2 iNEMO_Get_FW_Version
The iNEMO_Get_FW_Version command allows retrieving the board firmware version.
shows the frames involved in the iNEMO_Get_FW_Version transaction
Figure 14. : iNEMO_Get_FW_Version frames
DocID026205 Rev 1 13/37
37
STEVAL-MKI121V1 frames UM1744
2.3.3 iNEMO_Get_HW_Version
The iNEMO_Get_HW_Version command allows retrieving the board hardware version.
shows the frames involved in the iNEMO_Get_HW_Version transaction.
Figure 15. iNEMO_Get_HW_Version frames
2.3.4 iNEMO_Identify
The iNEMO_Identify command can be used to identify a Discovery-M1 board. Upon reception of the iNEMO_Identify command the Discovery-M1 board replies with an ACK containing the MCU Unique Device ID. Then the LED available on the board will blink 3
shows the frames involved in the iNEMO_Identify transaction
Figure 16. iNEMO_Identify frames
2.3.5 iNEMO_Get_AHRS_Library
The iNEMO_Get_AHRS_Library command allows knowing the version of the Discovery-M1 firmware Attitude Heading Reference System (AHRS) algorithm. The returned value is in string format.
shows the frames involved in the iNEMO_Get_AHRS_Library
transaction.
14/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
Figure 17. iNEMO_Get_AHRS_Library frames
2.3.6 iNEMO_Get_Libraries
The iNEMO_Get_Libraries command allows knowing which specific libraries are supported by the Discovery-M1 firmware.
shows the frames involved in the
iNEMO_Get_Libraries transaction.
Figure 18. iNEMO_Get_Libraries frames
2.3.7 iNEMO_Get_Available_Sensors
The iNEMO_Get_Available_Sensors command allows knowing which specific sensors are
supported by the Discovery-M1 firmware.
shows the frames involved in the
iNEMO_Get_Available_Sensors transaction
DocID026205 Rev 1 15/37
37
STEVAL-MKI121V1 frames
Figure 19. iNEMO_Get_Available_Sensors frames
UM1744
2.4 Sensor setting frames
Sensor setting frames are frames originated by the software PC (SDK or GUI) and used to set sensor parameters or to retrieve information about them. All the sensor setting frames are listed in
.
Commands
Table 6. Sensor setting frames
Frame
Type
Ack required
Message
ID
QoS
Payload
Length
(in bytes)
Payload Originator
Commands iNEMO_Set_Sensor_Parameter CONTROL iNEMO_Set_Sensor_Parameter_
Response iNEMO_Get_Sensor_Parameter_
Response
Frame
Type
ACK
NACK iNEMO_Get_Sensor_Parameter CONTROL
ACK
NACK
Ack required
Message
ID
QoS
Payload
Length
(in bytes)
Y
N
N
Y
N
N
0x20
0x20
0x20
0x21
0x21
0x21
Payload Originator
N
N
N variable
Sensor_
Type,
Sensor_
Parameter,
Parameter_
Value
0
1 Error Code
PC
Discovery-M1
N
N variable
N
2
1
Sensor_
Type,
Sensor_
Parameter,
PC
Sensor_
Type,
Sensor_
Parameter,
Parameter_
Value
Discovery-M1
Error Code
16/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
Commands
iNEMO_Restore_Default_
Parameter iNEMO_Restore_Default_
Parameter_Response iNEMO_Save_to_Flash iNEMO_Save_to_Flash_
Response iNEMO_Load_from_Flash iNEMO_Load_from_Flash_
Response
Table 6. Sensor setting frames (continued)
Frame
Type
Ack required
Message
ID
QoS
Payload
Length
(in bytes)
Payload
CONTROL
ACK
NACK
CONTROL
ACK
NACK
CONTROL
ACK
NACK
Y
N
N
N
N
Y
N
Y
N
0x22
0x22
0x22
0x23
0x23
0x23
0x24
0x24
0x24
Originator
N
N
N
N
N
N 2
N variable
N
N
1
0
Sensor_
Type,
Sensor_
Parameter
Error Code
PC
Sensor_
Type,
Sensor_
Parameter,
Parameter_
Value
Discovery-M1
PC
0
1 Error Code
Discovery-M1
PC
1 Error Code
Discovery-M1
2.4.1 iNEMO_Set_Sensor_Parameter
The iNEMO_Set_Sensor_Parameter command allows setting a specific sensor parameter.
shows the frames involved in the iNEMO_Set_Sensor_Parameter transaction.
Figure 20. iNEMO_Set_Sensor_Parameter frames
describes the "Sensor_Type" field.
DocID026205 Rev 1 17/37
37
STEVAL-MKI121V1 frames UM1744
2.4.2 iNEMO_Get_Sensor_Parameter
The iNEMO_Get_Sensor_Parameter command allows retrieving from the Discovery-M1 a specific sensor parameter.
shows the frames involved in the iNEMO_Get_Sensor_Parameter transaction.
Figure 21. iNEMO_Get_Sensor_Parameter frames
describes the "Sensor_Type" field.
2.4.3 iNEMO_Restore_Default_Parameter
The iNEMO_Restore_Default_Parameter command allows restoring a default, specific sensor parameter.
shows the frames involved in the iNEMO_Restore_Default_Parameter transaction.
18/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
Figure 22. iNEMO_Restore_Default_Parameter frames
describes the "Sensor_Type" list.
Sensor_Type Field
0x00
0x01
0x02
0x03
0x04
0x05
0x06 – 0xFF
Table 7. Sensor_Type list
Sensor
3-axis accelerometer
3-axis magnetometer
3-axis gyroscope
-
Pressure
Temperature
Reserved for Future Use
2.4.4 iNEMO_Save_to_Flash
The iNEMO_Save_to_Flash command allows storing the settings of the sensor parameters in Discovery-M1 flash.
shows the frames involved in the iNEMO_Save_to_Flash
transaction.
DocID026205 Rev 1 19/37
37
STEVAL-MKI121V1 frames
Figure 23. iNEMO_Save_to_Flash frames
UM1744
2.4.5 iNEMO_Load_from_Flash
The iNEMO_Load_from_Flash command allows loading from Discovery-M1 flash the sensors parameters stored in it.
shows the frames involved in the iNEMO_Load_from_Flash transaction.
Figure 24. iNEMO_Load_from_Flash frames
20/37
describes the parameters of the accelerometer sensor and the values of the
"Sensor_Parameter" field.
Table 8. Accelerometer Sensor_Parameter list
Sensor_Parameter field Sensor
0x00
0x01
0x02
0x03
0x04
0x05
0x06
Output data rate
Full scale
Acc_HPF
Offset_X
Offset_Y
Offset_Z
Scale factor X
DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
Table 8. Accelerometer Sensor_Parameter list (continued)
Sensor_Parameter field Sensor
0x07
0x08
0xFF
0x09 – 0xFE
Scale factor Y
Scale factor Z
Sensor name (read only)
Reserved for Future Use
The "Parameter_Value" field for the output data rate setting is 1 byte in length.
describes the supported output data rate for the accelerometer.
Table 9. Accelerometer output data rate field
Parameter_Value field for accelerometer ODR Output data rate (Hz)
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07– 0xFF
1
10
25
50
100
200
400
RFU
The "Parameter_Value" field for the full-scale setting is 1 byte in length.
describes the supported full scale for the accelerometer.
Table 10. Accelerometer full scale field
Parameter_Value field for accelerometer FS Full scale (g)
0x00
0x01
0x02
0x03
0x04 – 0xFF
±2g
±4g
±8g
±16g
RFU
DocID026205 Rev 1 21/37
37
STEVAL-MKI121V1 frames UM1744
The "Parameter_Value" field for the high-pass filter setting is 2 bytes in length as described in
describes the possible cutoff frequencies.
Figure 25. "Parameter_Value" fields for accelerometer HPF setting
HP1 HP0
1
1
0
0
0
1
0
1
Table 11. Accelerometer high-pass filter setting f t
[HZ]
Data rate =
1 Hz f t
[HZ]
Data rate =
10 Hz f t
[HZ]
Data rate =
25 Hz f t
[HZ]
Data rate =
50 Hz f t
[HZ]
Data rate =
100 Hz f t
[HZ]
Data rate =
200 Hz f t
[HZ]
Data rate =
400 Hz
0.02
0.01
0.005
0.0026
0.2
0.1
0.05
0.026
0.052
0.26
0.13
0.065
1.04
0.52
0.26
0.13
2.08
1.04
0.52
0.26
4.16
2.08
1.04
0.52
8.33
4.16
2.08
1.04
For further details please refer to the LSM303DLHC datasheet .
The "Parameter_Value" field for the offset (X-, Y- or Z-axis) setting is 2 bytes in length and expressed in milli-g (thousandth of gravitational force) as signed short (16-bit), with the most significant byte first.
2.4.11 Accelerometer scale factor
The "Parameter_Value" field for the scale factor (X-, Y- or Z-axis) setting is 2 bytes in length
(abstract number not mg) as signed short (16-bit) multiplied x1000 and with the most significant byte first. For example, if in the setting view scale factor x is 1.230, it will be multiplied x1000 and sent as 1230 (signed short 16-bit) in this case.
2.4.12 Accelerometer sensor name
The "Parameter_Value" of the sensor name is a read-only field and it returns the name of accelerometer (LSM303DLHC) from Discovery-M1.
describes the parameters of the magnetometer sensor and the values of the
"Sensor_Parameter" field.
22/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
Table 12. Accelerometer Sensor_Parameter list
Sensor_Parameter field Parameter
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0xFF
0x09 – 0xFE
Output data rate
Full scale
Operating mode
Offset_X
Offset_Y
Offset_Z
Scale factor X
Scale factor Y
Scale factor Z
Sensor name (read only)
RFU
The "Parameter_Value" field for the output data rate setting is 1 byte in length.
describes the output data rate supported for the magnetometer.
Table 13. Magnetometer output data rate field
Parameter_Value field for magnetometer ODR Output data rate (Hz)
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08 – 0xFF
0.75
1.5
3
7.5
15
30
75
220
RFU
The "Parameter_Value" field for the full-scale setting is 1 byte in length.
describes the full scale supported for the magnetometer.
DocID026205 Rev 1 23/37
37
STEVAL-MKI121V1 frames
Table 14. Magnetometer full-scale field
Parameter_Value field for magnetometer FS Full scale (gauss)
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x00, 0x08 – 0xFF
±1.3
±1.9
±2.5
±4.0
±4.7
±5.6
±8.1
Forbidden-RFU
UM1744
The "Parameter_Value" field for the operating mode setting is 1 byte in length as described in
describes the possible magnetometer operating modes.
Figure 26. "Parameter_Value" fields for magnetometer operating mode setting
Mode1
Table 15. Magnetometer operating mode setting
Mode0
Magnetic sensor operating mode
0
0
1
1
0
1
0
1
Normal
Positive bias
Negative bias
Forbidden
For further details please refer to the LSM303DLHC datasheet.
The "Parameter_Value" field for the offset (X-, Y- or Z-axis) setting is 2 bytes in length and expressed in milli-gauss (thousandth of gauss) as signed short (16-bit), with the most significant byte first.
2.4.18 Magnetometer scale factor
The "Parameter_Value" field for the scale factor (X-, Y- or Z-axis) setting is 2 bytes in length
(abstract number not mgauss) as signed short (16-bit) multiplied x1000.
24/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
2.4.19 Magnetometer sensor name
The "Parameter_Value" of sensor name is a read-only field and it returns the name of magnetometer (LSM303DLHC) from Discovery-M1.
2.4.20 Calibration sensor frames
Calibration sensor frames are frames originated by the software PC (SDK or GUI) used to calibrate sensors. The calibration sensor frames implemented in this version of the protocol are related to the magnetometer hard-iron calibration (HIC) as described below.
2.4.21 iNEMO_Start_HIC
The iNEMO_Start_HIC command is used to start the magnetic sensor HIC procedure.
shows the frames involved in the iNEMO_Start_HIC transaction.
Figure 27. iNEMO_Start_HIC frames
2.4.22 iNEMO_Abort_HIC
The iNEMO_Abort_HIC command is used to abort the magnetic sensor HIC procedure.
shows the frames involved in the iNEMO_Abort_HIC transaction.
Figure 28. iNEMO_Abort_HIC frames
DocID026205 Rev 1 25/37
37
STEVAL-MKI121V1 frames UM1744
describes the parameters of the gyroscope sensor and the values of the
"Sensor_Parameter" field.
Table 16. Gyroscope Sensor_Parameter list
Sensor_Parameter field Parameter
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0xFF
0x09 – 0xFE
Output data rate – LPF cutoff
Full scale
Gyro_HPF
Offset X
Offset Y
Offset Z
Scale factor X
Scale factor Y
Scale factor Z
Sensor name (read only)
RFU
2.4.24 Gyroscope output data rate
The "Parameter_Value" field for the output data rate setting is 1 byte in length.
describes the output data rate supported for the gyroscope.
Table 17. Gyroscope output data rate
Parameter_Value field for gyroscope ODR
Output data rate (Hz) LP filter cutoff (Hz)
0x07
0x08
0x09
0x0A
0x0B
0x00
0x01
0x02
0x03
0x04
0x05
0x06
95
190
380
70
20
25
50
110
12.5
25
25
25
12.5
25
50
26/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
Table 17. Gyroscope output data rate (continued)
Parameter_Value field for gyroscope ODR
Output data rate (Hz) LP filter cutoff (Hz)
0x0C
0x0D
0x0E
0x0F
760
30
35
50
110
2.4.25 Gyroscope full scale
The "Parameter_Value" field for the full scale setting is 1 byte in length.
describes the full scale supported for the gyroscope.
Table 18. Gyroscope Full Scale field
Parameter_Value field for gyroscope FS Full scale (dps)
0x00
0x01
0x02
0x03 – 0xFF
±250 dps
±500 dps
±2000 dps
Forbidden - RFU
The "Parameter_Value" field for the Offset (X-,Y- and Z-axis) setting is 2 bytes in length and expressed in dps (degrees per second) as signed short (16-bit) with the most significant byte first.
The "Parameter_Value" field for the scale factor (X-, Y- and Z-axis) setting is 2 bytes in length (abstract number not dps) as signed short (16-bit) multiplied x1000.
2.4.28 Gyroscope sensor name
The "Parameter_Value" of the sensor name is a read-only field and it returns the gyroscope part number (L3GD20) present on the Discovery-M1.
describes the parameters of the pressure sensor and the values of the
"Sensor_Parameter" field.
Table 19. Pressure Sensor_Parameter list
Sensor_Parameter field Parameter
0x00
0x01
0x02
Output data rate
Offset
Scale factor
DocID026205 Rev 1 27/37
37
STEVAL-MKI121V1 frames
Table 19. Pressure Sensor_Parameter list (continued)
Sensor_Parameter field Parameter
0xFF
0x02 – 0xFF
Sensor name (read only)
Forbidden - RFU
UM1744
2.4.30 Pressure sensor output data rate
The "Parameter_Value" field for the output data rate setting is 1 byte in length.
describes the output data rate supported for the pressure sensor.
Table 20. Pressure sensor output data rate field
“Parameter_Value” field for pressure sensor ODR Output data rate (Hz)
0x00
0x01
0x02
0x03
0x04 – 0xFF
1
7
12.5
25
Forbidden - RFU
2.4.31 Pressure sensor offset
The "Parameter_Value" field for the offset setting is 2 bytes in length and expressed in millibar as signed short (16-bit) with the most significant byte first.
2.4.32 Pressure scale factor
The "Parameter_Value" field for the scale factor setting is 2 bytes in length as signed short
(16-bit) multiplied x1000.
2.4.33 Pressure sensor name
The "Parameter_Value" of the sensor name is a read-only field and it returns the pressure sensor part number (LPS331AP) present on the Discovery-M1.
describes the parameters of the temperature sensor and the values of the
"Sensor_Parameter" field.
Table 21. Temperature Sensor_Parameter list
Sensor_Parameter field Parameter
0x00
0x01
0xFF
0x02 – 0xFE
Offset
Scale factor
Sensor name (read only)
RFU
28/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
2.4.35 Temperature sensor offset
The "Parameter_Value" field for the offset setting is 2 bytes in length and expressed in dºC
(tenth of Celsius degrees) as signed short (16-bit) with the most significant byte first.
The "Parameter_Value" field for the scale factor setting is 2 bytes in length (abstract number) as signed short (16-bit) multiplied x1000.
2.4.37 Temperature sensor name
The "Parameter_Value" of the sensor name is a read-only field and it returns the part number sensor, which is the source of the temperature value, present in Discovery-M1.
2.5 Acquisition sensor data frames
Acquisition sensor data frames are frames originated by the software PC (SDK or GUI) to set how to retrieve sensor data from Discovery-M1 and data frames originated by
Discovery-M1 to send sensor data. Acquisition sensor data frames are listed in
.
Commands
iNEMO_Set_Output_Mode iNEMO_Set_Output_Mode_
Response iNEMO_Get_Output_Mode iNEMO_Get_Output_Mode_
Response iNEMO_Acquisition_Data
Table 22. Acquisition sensor data frames
Frame
Type
Ack required
Message
ID
QoS
Payload
Length
(in bytes)
CONTROL
ACK
NACK
CONTROL
ACK iNEMO_Start_Acquisition iNEMO_Start_Acquisition_Respo nse
NACK
CONTROL
ACK
NACK
DATA
Y
N
N
Y
N
N
N
N
Y
N
0x50
0x50
0x50
0x51
0x51
0x51
0x52
0x52
0x52
0x52
N
N
N
N
N
N
N
N
N
N
Payload Originator
4
Sensors, acquisition frequency, output type, number of samples
PC
0
1
0
4
Error code
Discovery-M1
PC
Sensors, acquisition frequency, output type, number of samples
Discovery-M1
Error code
PC
0
1
1
0 variable
Error Code
Discovery-M1
Sensor
Data
DocID026205 Rev 1 29/37
37
STEVAL-MKI121V1 frames UM1744
Commands
Table 22. Acquisition sensor data frames (continued)
Frame
Type
Ack required
Message
ID
QoS
Payload
Length
(in bytes)
Payload Originator
PC iNEMO_Stop_Acquisition iNEMO_Stop_Acquisition_Respo nse
CONTROL
ACK
NACK iNEMO_Get_Acq_Data iNEMO_Get_Acq_Data_Respons e
CONTROL
ACK
NACK
Y
N
N
Y
N
N
0x53
0x53
0x53
0x54
0x54
0x54
N
N
N
N
N
N
0
0
1
0
0
1 Error Code
Discovery-M1
PC
Error Code
Discovery-M1
2.5.1 iNEMO_Set_Output_Mode
The iNEMO_Set_Output_Mode command allows setting which sensors shall be enabled, in which format the data sensor shall be sent from Discovery-M1 to SDK, and other parameters.
shows the frames involved in the iNEMO_Set_Output_Mode transaction.
Figure 29. iNEMO_Set_Output_Mode frames
30/37
When the "AHRS" bit is set to "1", the Discovery-M1 will run the AHRS algorithm, and the
AHRS data (quaternion and roll, pitch, yaw angles) will be sent in the data frame.
When the "COMPASS" field is set to "1", the Discovery-M1 will runs the compass demo, and the compass data (heading, roll and pitch angles) will be sent in the data frames.
The "Cal/Raw" field is used to define how to send sensor data, according to
Table 23. Calibrated and raw fields
Cal/Raw field Output Data Type
0
1
Calibrated Data
Raw data [LSB]
DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
The "ACC", "GYRO", "MAG", "PRESS" and "TEMP" fields are used to enable or disable the acquisition of the respective sensors.
The "ASK_DATA" field enables/disables the ask data mode. If this field is set to 1, data will not be sent if not requested by the iNEMO_Get_Acq_Data frame.
The FQx fields are used to set the acquisition rate, according to
FQ2
1
1
0
1
1
0
0
0
Table 24. Acquisition rate
FQ1 FQ0
0
1
1
0
1
0
0
1
1
0
1
0
1
0
1
0
Acquisition rate (Hz)
1
10
25
50
30
100
400
Synchronized to sensor
If the selected frequency is one of the above values from 1 Hz to 400 Hz, the data acquisition is based on a timer running at the selected frequency and it is not synchronized with any sensors. Otherwise, if the "Acquisition Rate" field is "Synchronized to sensor"
(FQ[2:0] set to ‘111’), the acquisition frequency is synchronized with the ODR (output data rate) of one sensor. In this last case only the selected sensor will run and the other ones will be automatically disabled.
The OTx fields are used to set the interface through which the Discovery-M1 shall send the data. The only interface supported by the actual version of Discovery-M1 is the USB
.
OT2
0
1
1
1
1
0
0
0
Table 25. Output interface
OT1 OT0
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
Output Interface
USB
RFU
The "Number of Samples" bytes specify how many sensor data samples shall be acquired.
When set to zero (continuous mode), the Discovery-M1 will acquire and send sensor data to the PC until it receives the "iNEMO_Stop_Acquisition" command.
DocID026205 Rev 1 31/37
37
STEVAL-MKI121V1 frames UM1744
2.5.2 iNEMO_Get_Output_Mode
The iNEMO_Get_Output_Mode command allows retrieving information from Discovery-M1 about its acquisition settings.
shows the frames involved in the
iNEMO_Get_Output_Mode transaction.
Figure 30. iNEMO_Get_Output_Mode frames
The "Output Mode" fields are described in
2.5.3 iNEMO_Start_Acquisition
The iNEMO_Start_Acquisition command allows starting the acquisition of sensor data according to the output settings.
shows the frames involved in the
iNEMO_Start_Acquisition transaction.
Figure 31. iNEMO_Start_Acquisition frames
32/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
The frame counter is an unsigned int (16-bit) incremented every time a new data frame is sent to the PC.
"ACC(X,Y,Z)" represents the accelerometer data field. This data field will be available only if the accelerometer sensor has been enabled ("ACC" field in the "iNEMO_Set_Output_Mode" frame is set to 1). If the "Raw" option is not enabled ("Raw" field in
"iNEMO_Set_Output_Mode" frame is 0), each accelerometer axis value is expressed in mg
(thousandth of gravitational force) in one of the possible ranges defined in
, as a signed short value (2 bytes). If the "Raw" option is enabled, each axis value represents the raw sensor data (LSB value).
"GYRO(X,Y,Z)" represents the gyroscope data field. This data field will be available only if the gyroscope sensor has been enabled ("GYRO" field in the "iNEMO_Set_Output_Mode" frame is set to 1). If the "Raw" option is not enabled, each gyroscope axis value is expressed in dps (degrees per second) in one of the possible ranges defined in
a signed short value (2 bytes). If the "Raw" option is enabled, each axis represents the raw sensor data (LSB value).
"MAG(X,Y,Z)" represents the magnetometer data field. This data field will be available only if the magnetometer sensor has been enabled ('MAG" field in the
"iNEMO_Set_Output_Mode" frame is set to 1). If the "Raw" option is not enabled, each magnetometer axis value is expressed in mG (thousandth of Gauss) in one of the possible ranges defined in
, as a signed short value (2 bytes). If the "Raw" option is enabled,
each axis value represents the raw sensor data (LSB value).
"PRESS" represents the pressure data field. This data field will be available only if the pressure sensor has been enabled ("PRESS" field in the "iNEMO_Set_Output_Mode" frame is 1). If the "Raw" option is not enabled, the pressure value is expressed in c-mbar
(centi-mbar ie. one hundredth of a millibar) in the range [+26000 c-mbar, +126000 c-mbar], as a signed int value (4 bytes). If the "Raw" option is enabled, the pressure data field represents the raw sensor data (LSB value).
"TEMP" represents the temperature data field. This data field will be available only if the temperature sensor has been enabled ("TEMP" field in the "iNEMO_Set_Output_Mode" frame is set to 1). If the "Raw" option is not enabled, the temperature value is expressed in dºC (tenth of Celsius degrees) in the range [-400 dºC, + 1250 dºC], as a signed short value
(2 bytes). If the "Raw" option is enabled, the temperature data field represents the raw sensor data (LSB value).
"RPY" represents the roll, pitch, yaw data field. This data field will be available only if the
"AHRS" option has been enabled ("AHRS" field in the "iNEMO_Set_Output_Mode" frame is
1).
The Roll data is expressed as a floating point value (4 bytes) in the range of ±180 degrees.
The Pitch data is expressed as a floating point value (4 bytes) in the range of ±90 degrees.
The Yaw data is expressed as a floating point value (4 bytes) in the range of ±180 degrees.
"Quaternion" represents the quaternion data field. This data field will be available only if the
"AHRS" option has been enabled ("AHRS" field in the "iNEMO_Set_Output_Mode" frame is
1). Each quaternion data is expressed as a floating point value (4 bytes) in the range ±1.
The Q0 field represents the scalar part of the quaternion, while the Q1, Q2 and Q3 fields represent the vector part of the quaternion.
The "COMPASS" data will be available only if the user enables the "Compass" option
("COMPASS" field in the "iNEMO_Set_Output_Mode" frame is set to 1).
DocID026205 Rev 1 33/37
37
STEVAL-MKI121V1 frames UM1744
The compass Roll data is expressed as a floating point value (4 bytes) in the range ±90 degree.
The compass Pitch data is expressed as a floating point value (4 bytes) in the range ±90 degree.
The compass Heading data is expressed as a floating point value (4 bytes) in the range
±180 degree.
During the acquisition and data transmission phase it is not possible to use commands that change the sensor settings or the output mode. It is necessary to stop the acquisition before sending these commands.
2.5.4 iNEMO_Stop_Acquisition
The iNEMO_Stop_Acquisition command stops the acquisition and data transmission.
shows the frames involved in the iNEMO_Stop_Acquisition transaction.
Figure 32. iNEMO_Stop_Acquisition frames
2.5.5 iNEMO_Get_Acquired_Data
The iNEMO_Get_Acquired_Data command is used to send the acquired data.
shows the frames involved in iNEMO_Get_Acquired_Data transaction.
Figure 33. iNEMO_Get_Acq_Data frames
34/37 DocID026205 Rev 1
UM1744 STEVAL-MKI121V1 frames
All the error codes used in the NACK frames are listed in
Table 26. Calibrated and raw fields
“Error Code” field Error
0x00
0x01
0x02
0x03
0x04
0x05
0x06 – 0xFF
Forbidden
Unsupported command
Out-of-range value
Not executable command
Wrong syntax
Discovery-M1 not connected
RFU
DocID026205 Rev 1 35/37
37
Revision history
Date
23-May-2014
Table 27. Document revision history
Revision Changes
1 Initial release.
UM1744
36/37 DocID026205 Rev 1
UM1744
Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH AS LIFE
SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS; (B)
AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS, AND/OR (D) AEROSPACE APPLICATIONS
OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT
PURCHASER’S SOLE RISK, EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS
EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR “AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL” INDUSTRY
DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE
DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
© 2014 STMicroelectronics - All rights reserved
STMicroelectronics group of companies
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan -
Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America
www.st.com
DocID026205 Rev 1 37/37
37
பதிவிறக்கு
விளம்பரம்