Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 1 | namespace frc971; |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 2 | |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 3 | // The values in the DIAG_STAT register for the ADIS16470. |
| 4 | table 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. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 10 | clock_error:bool (id: 0); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 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. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 18 | memory_failure:bool (id: 1); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 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. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 24 | sensor_failure:bool (id: 2); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 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. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 29 | standby_mode:bool (id: 3); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 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. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 35 | spi_communication_error:bool (id: 4); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 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. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 40 | flash_memory_update_error:bool (id: 5); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 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. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 47 | data_path_overrun:bool (id: 6); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 48 | } |
| 49 | |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 50 | // Values returned from an IMU. |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 51 | // All of these are raw from the hardware, without any form of zeroing or |
| 52 | // temperature compensation applied. |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 53 | table IMUValues { |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 54 | // Gyro readings in radians/second. |
| 55 | // Positive is clockwise looking at the connector. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 56 | gyro_x:float (id: 0); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 57 | // Positive is clockwise looking at the right side (from the connector). |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 58 | gyro_y:float (id: 1); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 59 | // Positive is counterclockwise looking at the top. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 60 | gyro_z:float (id: 2); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 61 | |
| 62 | // Accelerometer readings in Gs. |
| 63 | // Positive is up. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 64 | accelerometer_x:float (id: 3); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 65 | // Positive is away from the right side (from the connector). |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 66 | accelerometer_y:float (id: 4); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 67 | // Positive is away from the connector. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 68 | accelerometer_z:float (id: 5); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 69 | |
| 70 | // Magnetometer readings in gauss. |
| 71 | // Positive is up. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 72 | magnetometer_x:float (id: 6); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 73 | // Positive is away from the right side (from the connector). |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 74 | magnetometer_y:float (id: 7); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 75 | // Positive is away from the connector. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 76 | magnetometer_z:float (id: 8); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 77 | |
| 78 | // Barometer readings in pascals. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 79 | barometer:float (id: 9); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 80 | |
| 81 | // Temperature readings in degrees Celsius. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 82 | temperature:float (id: 10); |
Brian Silverman | 5f17a97 | 2016-02-28 01:49:32 -0500 | [diff] [blame] | 83 | |
| 84 | // FPGA timestamp when the values were captured. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 85 | fpga_timestamp:double (id: 11); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 86 | // CLOCK_MONOTONIC time in nanoseconds when the values were captured, |
| 87 | // converted from fpga_timestamp. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 88 | monotonic_timestamp_ns:long (id: 12); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 89 | |
| 90 | // For an ADIS16470, the DIAG_STAT value immediately after reset. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 91 | start_diag_stat:ADIS16470DiagStat (id: 13); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 92 | // For an ADIS16470, the DIAG_STAT value after the initial sensor self test we |
| 93 | // trigger is finished. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 94 | self_test_diag_stat:ADIS16470DiagStat (id: 14); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 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. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 98 | previous_reading_diag_stat:ADIS16470DiagStat (id: 15); |
Brian Silverman | 7be68ba | 2020-01-08 22:08:40 -0800 | [diff] [blame] | 99 | |
| 100 | // The value read from the PROD_ID register. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame^] | 101 | product_id:uint16 (id: 16); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | root_type IMUValues; |