Go to the documentation of this file.00001
00012
00013 #define UM7_FIRMWARE_REVISION (('U' << 24) | ('7' << 16) | ('1' << 8) | 'C')
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #define CONFIG_ARRAY_SIZE 27
00025 #define DATA_ARRAY_SIZE 52
00026 #define COMMAND_COUNT 10
00027
00028 #define HIDDEN_ARRAY_SIZE 127
00029
00030
00031 #define CONFIG_REG_START_ADDRESS 0
00032 #define DATA_REG_START_ADDRESS 85
00033 #define COMMAND_START_ADDRESS 170
00034
00035
00036 #define CREG_COM_SETTINGS 0
00037 #define CREG_COM_RATES1 1
00038 #define CREG_COM_RATES2 2
00039 #define CREG_COM_RATES3 3
00040 #define CREG_COM_RATES4 4
00041 #define CREG_COM_RATES5 5
00042 #define CREG_COM_RATES6 6
00043 #define CREG_COM_RATES7 7
00044 #define CREG_MISC_SETTINGS 8
00045 #define CREG_HOME_NORTH 9
00046 #define CREG_HOME_EAST 10
00047 #define CREG_HOME_UP 11
00048 #define CREG_GYRO_TRIM_X 12 // Floating point trim (actual angular rate)
00049 #define CREG_GYRO_TRIM_Y 13
00050 #define CREG_GYRO_TRIM_Z 14
00051 #define CREG_MAG_CAL1_1 15
00052 #define CREG_MAG_CAL1_2 16
00053 #define CREG_MAG_CAL1_3 17
00054 #define CREG_MAG_CAL2_1 18
00055 #define CREG_MAG_CAL2_2 19
00056 #define CREG_MAG_CAL2_3 20
00057 #define CREG_MAG_CAL3_1 21
00058 #define CREG_MAG_CAL3_2 22
00059 #define CREG_MAG_CAL3_3 23
00060 #define CREG_MAG_BIAS_X 24
00061 #define CREG_MAG_BIAS_Y 25
00062 #define CREG_MAG_BIAS_Z 26
00063
00064
00065 #define COM_BAUD_MASK 0x0F // Uses 4 bits
00066 #define COM_BAUD_START 28 // Lowest-order bit on bit 28
00067
00068 #define COM_GPS_BAUD_MASK 0x0F
00069 #define COM_GPS_BAUD_START 24
00070
00071 #define COM_GPS_DATA_ENABLED (1 << 8)
00072 #define COM_GPS_SAT_DATA_ENABLED (1 << 4)
00073
00074
00075 #define BAUD_9600 0
00076 #define BAUD_14400 1
00077 #define BAUD_19200 2
00078 #define BAUD_38400 3
00079 #define BAUD_57600 4
00080 #define BAUD_115200 5
00081 #define BAUD_128000 6
00082 #define BAUD_153600 7
00083 #define BAUD_230400 8
00084 #define BAUD_256000 9
00085 #define BAUD_460800 10
00086 #define BAUD_921600 11
00087
00088
00089 #define RATE1_RAW_ACCEL_MASK 0x0FF
00090 #define RATE1_RAW_ACCEL_START 24
00091 #define RATE1_RAW_GYRO_MASK 0x0FF
00092 #define RATE1_RAW_GYRO_START 16
00093 #define RATE1_RAW_MAG_MASK 0x0FF
00094 #define RATE1_RAW_MAG_START 8
00095
00096 #define RATE2_TEMPERATURE_MASK 0x0FF
00097 #define RATE2_TEMPERATURE_START 24
00098 #define RATE2_ALL_RAW_MASK 0x0FF
00099 #define RATE2_ALL_RAW_START 0
00100
00101 #define RATE3_PROC_ACCEL_MASK 0x0FF
00102 #define RATE3_PROC_ACCEL_START 24
00103 #define RATE3_PROC_GYRO_MASK 0x0FF
00104 #define RATE3_PROC_GYRO_START 16
00105 #define RATE3_PROC_MAG_MASK 0x0FF
00106 #define RATE3_PROC_MAG_START 8
00107
00108 #define RATE4_ALL_PROC_MASK 0x0FF
00109 #define RATE4_ALL_PROC_START 0
00110
00111 #define RATE5_QUAT_MASK 0x0FF
00112 #define RATE5_QUAT_START 24
00113 #define RATE5_EULER_MASK 0x0FF
00114 #define RATE5_EULER_START 16
00115 #define RATE5_POSITION_MASK 0x0FF
00116 #define RATE5_POSITION_START 8
00117 #define RATE5_VELOCITY_MASK 0x0FF
00118 #define RATE5_VELOCITY_START 0
00119
00120 #define RATE6_POSE_MASK 0x0FF
00121 #define RATE6_POSE_START 24
00122 #define RATE6_HEALTH_MASK 0x0F
00123 #define RATE6_HEALTH_START 16
00124
00125 #define RATE7_NMEA_HEALTH_MASK 0x0F
00126 #define RATE7_NMEA_HEALTH_START 28
00127 #define RATE7_NMEA_POSE_MASK 0x0F
00128 #define RATE7_NMEA_POSE_START 24
00129 #define RATE7_NMEA_ATTITUDE_MASK 0x0F
00130 #define RATE7_NMEA_ATTITUDE_START 20
00131 #define RATE7_NMEA_SENSOR_MASK 0x0F
00132 #define RATE7_NMEA_SENSOR_START 16
00133 #define RATE7_NMEA_RATE_MASK 0x0F
00134 #define RATE7_NMEA_RATE_START 12
00135 #define RATE7_NMEA_GPS_POSE_MASK 0x0F
00136 #define RATE7_NMEA_GPS_POSE_START 8
00137 #define RATE7_NMEA_QUATERNION_MASK 0x0F
00138 #define RATE7_NMEA_QUATERNION_START 4
00139
00140
00141 #define MAG_UPDATES_ENABLED (1 << 0)
00142 #define QUATERNION_MODE_ENABLED (1 << 1)
00143 #define ZERO_GYROS_ON_STARTUP (1 << 2)
00144 #define USE_TX2_AS_PPS_INPUT (1 << 8)
00145
00146
00147 #define DREG_HEALTH 85
00148 #define DREG_GYRO_RAW_XY 86
00149 #define DREG_GYRO_RAW_Z 87
00150 #define DREG_GYRO_TIME 88
00151 #define DREG_ACCEL_RAW_XY 89
00152 #define DREG_ACCEL_RAW_Z 90
00153 #define DREG_ACCEL_TIME 91
00154 #define DREG_MAG_RAW_XY 92
00155 #define DREG_MAG_RAW_Z 93
00156 #define DREG_MAG_RAW_TIME 94
00157 #define DREG_TEMPERATURE 95
00158 #define DREG_TEMPERATURE_TIME 96
00159 #define DREG_GYRO_PROC_X 97
00160 #define DREG_GYRO_PROC_Y 98
00161 #define DREG_GYRO_PROC_Z 99
00162 #define DREG_GYRO_PROC_TIME 100
00163 #define DREG_ACCEL_PROC_X 101
00164 #define DREG_ACCEL_PROC_Y 102
00165 #define DREG_ACCEL_PROC_Z 103
00166 #define DREG_ACCEL_PROC_TIME 104
00167 #define DREG_MAG_PROC_X 105
00168 #define DREG_MAG_PROC_Y 106
00169 #define DREG_MAG_PROC_Z 107
00170 #define DREG_MAG_PROC_TIME 108
00171 #define DREG_QUAT_AB 109
00172 #define DREG_QUAT_CD 110
00173 #define DREG_QUAT_TIME 111
00174 #define DREG_EULER_PHI_THETA 112
00175 #define DREG_EULER_PSI 113
00176 #define DREG_EULER_PHI_THETA_DOT 114
00177 #define DREG_EULER_PSI_DOT 115
00178 #define DREG_EULER_TIME 116
00179 #define DREG_POSITION_NORTH 117
00180 #define DREG_POSITION_EAST 118
00181 #define DREG_POSITION_UP 119
00182 #define DREG_POSITION_TIME 120
00183 #define DREG_VELOCITY_NORTH 121
00184 #define DREG_VELOCITY_EAST 122
00185 #define DREG_VELOCITY_UP 123
00186 #define DREG_VELOCITY_TIME 124
00187 #define DREG_GPS_LATITUDE 125
00188 #define DREG_GPS_LONGITUDE 126
00189 #define DREG_GPS_ALTITUDE 127
00190 #define DREG_GPS_COURSE 128
00191 #define DREG_GPS_SPEED 129
00192 #define DREG_GPS_TIME 130
00193 #define DREG_GPS_SAT_1_2 131
00194 #define DREG_GPS_SAT_3_4 132
00195 #define DREG_GPS_SAT_5_6 133
00196 #define DREG_GPS_SAT_7_8 134
00197 #define DREG_GPS_SAT_9_10 135
00198 #define DREG_GPS_SAT_11_12 136
00199
00200
00201 #define HEALTH_SATS_USED_MASK 0x3F // Uses 6 bits
00202 #define HEALTH_SATS_USED_START 26 // Lowest-order bit starts at 26
00203 #define HEALTH_HDOP_MASK 0x3FF // Uses 10 bits
00204 #define HEALTH_HDOP_START 16 // Lowest-order bit starts at 16
00205 #define HEALTH_SATS_IN_VIEW_MASK 0x3F
00206 #define HEALTH_SATS_IN_VIEW_START 10
00207 #define HEALTH_COM_OVERFLOW (1 << 8) // Set when the sensor was unable to transmit all the requested data
00208 #define HEALTH_MAG_NORM (1 << 5)
00209 #define HEALTH_ACCEL_NORM (1 << 4)
00210 #define HEALTH_ACCEL (1 << 3)
00211 #define HEALTH_GYRO (1 << 2)
00212 #define HEALTH_MAG (1 << 1)
00213 #define HEALTH_GPS (1 << 0)
00214
00215
00216 #define CHR_BAD_CHECKSUM 253 // Sent if the module receives a packet with a bad checksum
00217 #define CHR_UNKNOWN_ADDRESS 254 // Sent if the module receives a packet with an unknown address
00218 #define CHR_INVALID_BATCH_SIZE 255 // Sent if a requested batch read or write operation would go beyond the bounds of the config or data array
00219
00220
00221 #define CHR_GET_FW_VERSION (COMMAND_START_ADDRESS + 0) // Causes the device to report the firmware revision
00222 #define CHR_FLASH_COMMIT (COMMAND_START_ADDRESS + 1) // Causes the device to write all configuration values to FLASH
00223 #define CHR_RESET_TO_FACTORY (COMMAND_START_ADDRESS + 2) // Causes the UM6 to load default factory settings
00224 #define CHR_ZERO_GYROS (COMMAND_START_ADDRESS + 3)
00225 #define CHR_SET_HOME_POSITION (COMMAND_START_ADDRESS + 4)
00226 #define CHR_FACTORY_COMMIT (COMMAND_START_ADDRESS + 5)
00227 #define CHR_SET_MAG_REFERENCE (COMMAND_START_ADDRESS + 6)
00228 #define CHR_RESET_EKF (COMMAND_START_ADDRESS + 9)
00229
00230
00231 #define NMEA_HEALTH_PACKET 0
00232 #define NMEA_POSE_PACKET 1
00233 #define NMEA_ATTITUDE_PACKET 2
00234 #define NMEA_SENSOR_PACKET 3
00235 #define NMEA_RATE_PACKET 4
00236 #define NMEA_GPS_POSE_PACKET 5
00237 #define NMEA_QUATERNION_PACKET 6
00238
00239
00240 #define GYRO_ZERO_SAMPLES 500
00241 #define GYRO_X_INDEX 0
00242 #define GYRO_Y_INDEX 1
00243 #define GYRO_Z_INDEX 2
00244 #define ANGLE_ZERO_SAMPLES 1000
00245 #define ACCEL_X_INDEX 0
00246 #define ACCEL_Y_INDEX 1
00247 #define ACCEL_Z_INDEX 2
00248 #define PRESSURE_ZERO_SAMPLES 250
00249 #define AIRSPEED_ZERO_SAMPLES 500
00250
00251 #define PI 3.14159265f
00252 #define PIx2 6.28318530f
00253 #define PId2 1.57079633f
00254 #define GRAVITY 9.80665f
00255 #define GRAVITYx2 19.6133f
00256 #define GRAVITYd2 4.903325f
00257 #define RAW_TO_MBAR (1.0f/4096.0f)
00258 #define KPA_PER_VOLT 1.0f
00259
00260 #define CHR_USE_CONFIG_ADDRESS 0
00261 #define CHR_USE_FACTORY_ADDRESS 1
00262
00263
00264 #define FLASH_START_ADDRESS (uint32_t)0x0800F000
00265
00266 #define FACTORY_FLASH_ADDRESS (uint32_t)0x0800E000
00267
00268
00269 #define FGET_FLASH_UNINITIALIZED() ((uint32_t)( *(__IO uint32_t*)(FLASH_START_ADDRESS) ) == 0xFFFFFFFF)
00270 #define FGET_FACTORY_UNINITIALIZED() ((uint32_t)( *(__IO uint32_t*)(FACTORY_FLASH_ADDRESS) ) == 0xFFFFFFFF)
00271
00272 #define GYRO_ZERO_SAMPLE_SIZE 500
00273
00274 typedef struct __CHR_config
00275 {
00276 union
00277 {
00278 uint32_t r[CONFIG_ARRAY_SIZE];
00279 float f[CONFIG_ARRAY_SIZE];
00280 };
00281 } CHR_config;
00282
00283 typedef struct __CHR_data
00284 {
00285 union
00286 {
00287 uint32_t r[DATA_ARRAY_SIZE];
00288 float f[DATA_ARRAY_SIZE];
00289 };
00290 } CHR_data;