blob: 65b181bf01d9046820aabd09e9e6319cd2fb068c [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001namespace frc971;
Brian Silverman5f17a972016-02-28 01:49:32 -05002
Brian Silverman7be68ba2020-01-08 22:08:40 -08003// The values in the DIAG_STAT register for the ADIS16470.
4table ADIS16470DiagStat {
5 // True indicates that the internal data sampling clock (fSM, see Figure 15
6 // and Figure 16) does not synchronize with the external clock, which only
7 // applies when using scale sync mode (Register MSC_CTRL, Bits[4:2] = 010, see
8 // Table 101). When this occurs, adjust the frequency of the clock signal on
9 // the SYNC pin to operate within the appropriate range.
10 clock_error:bool;
11
12 // True indicates a failure in the flash memory test (Register GLOB_CMD, Bit
13 // 4, see Table 109), which involves a comparison between a cyclic redundancy
14 // check (CRC) computation of the present flash memory and a CRC computation
15 // from the same memory locations at the time of initial programming (during
16 // production process). If this occurs, repeat the same test. If this error
17 // persists, replace the ADIS16470 device.
18 memory_failure:bool;
19
20 // True indicates failure of at least one sensor, at the conclusion of the
21 // self test (Register GLOB_CMD, Bit 2, see Table 109). If this occurs, repeat
22 // the same test. If this error persists, replace the ADIS16470. Motion,
23 // during the execution of this test, can cause a false failure.
24 sensor_failure:bool;
25
26 // True indicates that the voltage across VDD and GND is <2.8 V, which causes
27 // data processing to stop. When VDD ≥ 2.8 V for 250 ms, the ADIS16470
28 // reinitializes itself and starts producing data again.
29 standby_mode:bool;
30
31 // True indicates that the total number of SCLK cycles is not equal to an
32 // integer multiple of 16. When this occurs, repeat the previous communication
33 // sequence. Persistence in this error may indicate a weakness in the SPI
34 // service that the ADIS16470 is receiving from the system it is supporting.
35 spi_communication_error:bool;
36
37 // True indicates that the most recent flash memory update (Register GLOB_CMD,
38 // Bit 3, see Table 109) failed. If this occurs, ensure that VDD ≥ 3 V and
39 // repeat the update attempt. If this error persists, replace the ADIS16470.
40 flash_memory_update_error:bool;
41
42 // True indicates that one of the data paths have experienced an overrun
43 // condition. If this occurs, initiate a reset, using the RST pin (see Table
44 // 5, Pin F3) or Register GLOB_CMD, Bit 7 (see Table 109). See the Serial Port
45 // Operation section for more details on conditions that may cause this bit to
46 // be set to 1.
47 data_path_overrun:bool;
48}
49
Brian Silverman5f17a972016-02-28 01:49:32 -050050// Values returned from an IMU.
Brian Silverman7be68ba2020-01-08 22:08:40 -080051// All of these are raw from the hardware, without any form of zeroing or
52// temperature compensation applied.
Alex Perrycb7da4b2019-08-28 19:35:56 -070053table IMUValues {
Brian Silverman5f17a972016-02-28 01:49:32 -050054 // Gyro readings in radians/second.
55 // Positive is clockwise looking at the connector.
Alex Perrycb7da4b2019-08-28 19:35:56 -070056 gyro_x:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050057 // Positive is clockwise looking at the right side (from the connector).
Alex Perrycb7da4b2019-08-28 19:35:56 -070058 gyro_y:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050059 // Positive is counterclockwise looking at the top.
Alex Perrycb7da4b2019-08-28 19:35:56 -070060 gyro_z:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050061
62 // Accelerometer readings in Gs.
63 // Positive is up.
Alex Perrycb7da4b2019-08-28 19:35:56 -070064 accelerometer_x:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050065 // Positive is away from the right side (from the connector).
Alex Perrycb7da4b2019-08-28 19:35:56 -070066 accelerometer_y:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050067 // Positive is away from the connector.
Alex Perrycb7da4b2019-08-28 19:35:56 -070068 accelerometer_z:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050069
70 // Magnetometer readings in gauss.
71 // Positive is up.
Alex Perrycb7da4b2019-08-28 19:35:56 -070072 magnetometer_x:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050073 // Positive is away from the right side (from the connector).
Alex Perrycb7da4b2019-08-28 19:35:56 -070074 magnetometer_y:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050075 // Positive is away from the connector.
Alex Perrycb7da4b2019-08-28 19:35:56 -070076 magnetometer_z:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050077
78 // Barometer readings in pascals.
Alex Perrycb7da4b2019-08-28 19:35:56 -070079 barometer:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050080
81 // Temperature readings in degrees Celsius.
Alex Perrycb7da4b2019-08-28 19:35:56 -070082 temperature:float;
Brian Silverman5f17a972016-02-28 01:49:32 -050083
84 // FPGA timestamp when the values were captured.
Alex Perrycb7da4b2019-08-28 19:35:56 -070085 fpga_timestamp:double;
Brian Silverman7be68ba2020-01-08 22:08:40 -080086 // CLOCK_MONOTONIC time in nanoseconds when the values were captured,
87 // converted from fpga_timestamp.
Alex Perrycb7da4b2019-08-28 19:35:56 -070088 monotonic_timestamp_ns:long;
Brian Silverman7be68ba2020-01-08 22:08:40 -080089
90 // For an ADIS16470, the DIAG_STAT value immediately after reset.
91 start_diag_stat:ADIS16470DiagStat;
92 // For an ADIS16470, the DIAG_STAT value after the initial sensor self test we
93 // trigger is finished.
94 self_test_diag_stat:ADIS16470DiagStat;
95 // For an ADIS16470, the DIAG_STAT value associated with the previous set of
96 // readings. This will never change during normal operation, so being 1 cycle
97 // state is OK.
98 previous_reading_diag_stat:ADIS16470DiagStat;
99
100 // The value read from the PROD_ID register.
101 product_id:uint16;
Alex Perrycb7da4b2019-08-28 19:35:56 -0700102}
103
104root_type IMUValues;