Description

The ShockSegmentStream command is used to enable or disable the event-based streaming of 6-axis accelerometer and gyroscope data, conditional to the occurrence of a shock (high-g) event. Whenever a high-g event is detected at say time t, and if the streaming is ON, a segment of 6-axis sensor data consisting of 200 samples will be streamed to the host, where t will be the center of the segment. For instance, if the shock event occurs at the sample index n, the samples from the index of n-100 to the index of n+99 will be streamed to the host.

The 200 number of samples could represent different periods of time depending on the fusion data rate. For instance, if the fusion data rate is set to 200Hz, the segment will represent one second of data, i.e., 0.5 seconds before and 0.5 seconds after the shock. For a fusion data rate of 50Hz, the segment will represent four seconds of data, i.e., 2 seconds before and 2 seconds after the shock.

The high-g threshold can also be configured by the user, when we issue this command. The threshold is defined as a percentage of the full-scale range for the accelerometer sensor. The percentage can be selected as one of the following values: 56%, 62%, 69%, 75%, 81%, 87% or 94%. As an example, if the accelerometer range is set to 16g, and the threshold is 75%, then the threshold for shock detection will 0.75x16g = 12g. If the accelerometer range is set to 16g, the user can also configure the threshold to be 4g, 5g, 6g, 7g or 8g.

Protocol

This command uses the Command-Ack-Response-Data protocol.

Command

Byte Name C Type Value
0 Control Byte ( Packet Type (7:5) / SubSystem (4:0) ) uint8_t 0x41 ( 0b010 / 0b00001 )
1 Payload Length uint8_t 2
2 CRC uint8_t Calculated
3 Command uint8_t 0x1F

Payload

Byte Name C Type Value
4 State uint8_t 0x00 (Disable) or 0x01 (Enable)
5 Threshold uint8_t See Below

The following list shows the available shock segment threshold:

Identifier Threshold
0x04 4G in 16G range (only works in 16G range)
0x05 5G in 16G range (only works in 16G range)
0x06 6G in 16G range (only works in 16G range)
0x07 7G in 16G range (only works in 16G range)
0x08 8G in 16G range (only works in 16G range)
0x09 56% fullscale
0x0A 62% fullscale
0x0B 69% fullscale
0x0C 75% fullscale
0x0D 81% fullscale
0x0E 87% fullscale
0x0F 94% fullscale

Response

Header

Byte Name C Type Value
0 Control Byte ( Packet Type (7:5) / SubSystem (4:0) ) uint8_t 0x01 ( 0b000 / 0b00001 )
1 Payload Length uint8_t 4
2 CRC uint8_t Calculated
3 Command uint8_t 0x1F

Payload

Byte Name C Type Value
4 - 5 Downsample uint16_t Varies
6 - 7 Rate uint16_t Varies

Data

Header

Byte Name C Type Value
0 Control Byte ( Packet Type (7:5) / SubSystem (4:0) ) uint8_t 0x61 ( 0b011 / 0b00001 )
1 Payload Length uint8_t 16
2 CRC uint8_t Calculated
3 Command uint8_t 0x1F

Payload

Byte Name C Type Value
4 - 7 Timestamp uint32_t Varies
8 - 9 Accelerometer (X) int16_t Varies
10 - 11 Accelerometer (Y) int16_t Varies
12 - 13 Accelerometer (Z) int16_t Varies
14 - 15 Gyroscope (X) int16_t Varies
16 - 17 Gyroscope (Y) int16_t Varies
18 - 19 Gyroscope (Z) int16_t Varies