Time-of-Flight-SDK
adsd_errs.h
1 /*
2  * BSD 3-Clause License
3  *
4  * Copyright (c) 2023, Analog Devices, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef ADSD3500_DEFS
34 #define ADSD3500_DEFS
35 
36 #include <cstdint>
37 #include <string>
38 #include <unordered_map>
39 
40 namespace aditof {
41 
51 class ADSDErrors {
52  public:
53  ADSDErrors() {
54  m_ADSD3100ErrLookup = {
55  {ADSD3100_ERR_MODE_USECASE, "Invalid mode selection."},
56  {ADSD3100_ERR_MODE_MODE_DRIVER, "Invalid LD mode selection."},
57  {ADSD3100_ERR_PLLLOCK_LOCK1, "PLLLOCK error location 1."},
58  {ADSD3100_ERR_PLLLOCK_LOCK2, "PLLLOCK error location 2."},
59  {ADSD3100_ERR_PLLLOCK_LOCK3, "PLLLOCK error location 3."},
60  {ADSD3100_ERR_OVERHEAT_IMAGER, "Imager sensor overheat."},
61  {ADSD3100_ERR_OVERHEAT_LD, "Laser driver overheat."},
62  {ADSD3100_ERR_LASER_CHIPID, "Laser driver invalid chip ID."},
63  {ADSD3100_ERR_LASER_LPS, "Corrupted laser driver data."},
64  {ADSD3100_ERR_LASER_NO_DIFFUSER, "Laser diffuser problem."},
65  {ADSD3100_ERR_LASER_SHORT, "Laser driver shorted to GND."},
66  {ADSD3100_ERR_LVDS_HIGH_DC, "Laser driver duty cycle too large."},
68  "Laser driver active time too long."},
70  "Laser driver input open or short detected."},
72  "Laser driver enabled for too long of time."},
74  "Laser driver disabled for too short of time."},
75  {ADSD3100_ERR_LASER_LPS_READ, "Laser driver corrupted data."},
76  {ADSD3100_ERR_LASER_VLD_LOW, "Laser driver supply too low."},
77  {ADSD3100_ERR_LASER_VLD_HIGH, "Laser driver supply too high."}};
78 
79  m_ADSD3500StatusLookup = {
80  {ADSD3500_STATUS_INVALID_MODE, "Mode selected is invalid."},
82  "The JBLF filter size speficied is incorrect."},
84  "An unsupported command was sent to the ASDD3500."},
86  "A register write or read operation does not match any valid "
87  "region."},
89  "The ADSD3500 firmware CRC check failed."},
91  "The imager firmware is not valid."},
92  {ADSD3500_STATUS_INVALID_CCB, "The imager CCB file is not valid."},
93  {ADSD3500_STATUS_FLASH_HEADER_PARSE_ERROR, "Flash update error."},
94  {ADSD3500_STATUS_FLASH_FILE_PARSE_ERROR, "Flash update error."},
96  "SPI Master error occured, which this impacts the ADSD3500 - "
97  "image communication."},
98  {ADSD3500_STATUS_INVALID_CHIPID, "The image chip ID is invalid."},
100  "SPI Master error occured during communication between the "
101  "ASDSD3500 and the imager."},
102  {ADSD3500_STATUS_IMAGER_BOOT_FAILURE, "Unable to boot the imager."},
103  {ADSD3500_STATUS_IMAGER_ERROR, "The imager reported an error."},
105  "This is when timer is expired but ADSD3500 is not able to send "
106  "out frame due to some error."},
108  "Dynamic mode switching is being set, but it is not enabled."},
110  "The selected dyanamic mode configuration is not valid."},
112  "An incorrect phase invalid value specified."},
114  "Firmware update is complete."},
115  {ADSD3500_STATUS_NVM_WRITE_COMPLETE, "NVM update is complete."}};
116  }
117 
123  std::string GetStringADSD3500(uint16_t value) {
124 
125  std::string ret = "";
126 
127  auto it = m_ADSD3500StatusLookup.find(value);
128 
129  if (it != m_ADSD3500StatusLookup.end()) {
130  ret = m_ADSD3500StatusLookup[value];
131  }
132 
133  return ret;
134  }
135 
141  std::string GetStringADSD3100(uint16_t value) {
142 
143  std::string ret = "";
144 
145  auto it = m_ADSD3100ErrLookup.find(value);
146 
147  if (it != m_ADSD3100ErrLookup.end()) {
148  ret = m_ADSD3100ErrLookup[value];
149  }
150 
151  return ret;
152  }
153 
159  std::string GetStringADSD3030(uint16_t value) {
160 
161  std::string ret = "";
162 
163  return ret;
164  }
165 
166  public:
167  // ADSD3500 error codes read via the "Get Status" (0x0020) command
171  const uint16_t ADSD3500_STATUS_INVALID_MODE = 0x0001;
179  const uint16_t ADSD3500_STATUS_UNSUPPORTED_CMD = 0x0003;
183  const uint16_t ADSD3500_STATUS_INVALID_MEMORY_REGION = 0x0004;
187  const uint16_t ADSD3500_STATUS_INVALID_FIRMWARE_CRC = 0x0005;
191  const uint16_t ADSD3500_STATUS_INVALID_IMAGER = 0x0006;
195  const uint16_t ADSD3500_STATUS_INVALID_CCB = 0x0007;
203  const uint16_t ADSD3500_STATUS_FLASH_FILE_PARSE_ERROR = 0x0009;
207  const uint16_t ADSD3500_STATUS_SPIM_ERROR = 0x000A;
211  const uint16_t ADSD3500_STATUS_INVALID_CHIPID = 0x000B;
219  const uint16_t ADSD3500_STATUS_IMAGER_BOOT_FAILURE = 0x000D;
223  const uint16_t ADSD3500_STATUS_IMAGER_ERROR = 0x0010;
227  const uint16_t ADSD3500_STATUS_TIMEOUT_ERROR = 0x0011;
240 
241  // ADSD3500 status codes read via the "Get Status" (0x0020) command
249  const uint16_t ADSD3500_STATUS_NVM_WRITE_COMPLETE = 0x000F;
250 
256  const uint16_t ADSD3100_ERR_MODE_USECASE = 0x0001;
262  const uint16_t ADSD3100_ERR_MODE_MODE_DRIVER = 0x0002;
268  const uint16_t ADSD3100_ERR_PLLLOCK_LOCK1 = 0x0004;
274  const uint16_t ADSD3100_ERR_PLLLOCK_LOCK2 =
275  0x0008; // PLLLOCK error location 2.
281  const uint16_t ADSD3100_ERR_PLLLOCK_LOCK3 =
282  0x000C; // PLLLOCK error location 3.
288  const uint16_t ADSD3100_ERR_OVERHEAT_IMAGER = 0x0010;
294  const uint16_t ADSD3100_ERR_OVERHEAT_LD = 0x0020;
300  const uint16_t ADSD3100_ERR_LASER_CHIPID = 0x0040;
306  const uint16_t ADSD3100_ERR_LASER_LPS = 0x0080;
312  const uint16_t ADSD3100_ERR_LASER_NO_DIFFUSER = 0x0100;
318  const uint16_t ADSD3100_ERR_LASER_SHORT = 0x0140;
324  const uint16_t ADSD3100_ERR_LVDS_HIGH_DC = 0x0180;
330  const uint16_t ADSD3100_ERR_LVDS_PULSE_LONG = 0x01C0;
336  const uint16_t ADSD3100_ERR_LVDS_OPEN_SHORT = 0x0200;
342  const uint16_t ADSD3100_ERR_LASER_LONG_LEN_ON = 0x0240;
348  const uint16_t ADSD3100_ERR_LASER_SHORT_LEN_OFF = 0x0280;
354  const uint16_t ADSD3100_ERR_LASER_LPS_READ = 0x02C0;
360  const uint16_t ADSD3100_ERR_LASER_VLD_LOW = 0x0300;
366  const uint16_t ADSD3100_ERR_LASER_VLD_HIGH = 0x0340;
367 
368  private:
369  std::unordered_map<uint16_t, std::string> m_ADSD3500StatusLookup;
370  std::unordered_map<uint16_t, std::string> m_ADSD3100ErrLookup;
371 };
372 
373 } // namespace aditof
374 #endif //ADSD3500_DEFS
const uint16_t ADSD3500_STATUS_SPIM_ERROR
SPI Master error occured, which this impacts the ADSD3500 - image communication.
Definition: adsd_errs.h:207
const uint16_t ADSD3100_ERR_LASER_VLD_LOW
Laser driver supply too low. Imager error codes read via "Get Imager Error Code" (0x0038) command Not...
Definition: adsd_errs.h:360
const uint16_t ADSD3500_STATUS_INVALID_CCB
The imager CCB file is not valid.
Definition: adsd_errs.h:195
Namespace aditof.
Definition: frame.h:44
const uint16_t ADSD3500_STATUS_UNSUPPORTED_CMD
An unsupported command was sent to the ASDD3500.
Definition: adsd_errs.h:179
const uint16_t ADSD3100_ERR_LVDS_PULSE_LONG
Laser driver active time too long. Imager error codes read via "Get Imager Error Code" (0x0038) comma...
Definition: adsd_errs.h:330
const uint16_t ADSD3500_STATUS_INVALID_DYNAMIC_MODE_COMPOSITIONS
The selected dyanamic mode configuration is not valid.
Definition: adsd_errs.h:235
const uint16_t ADSD3100_ERR_LASER_CHIPID
Laser driver invalid chip ID. Imager error codes read via "Get Imager Error Code" (0x0038) command No...
Definition: adsd_errs.h:300
const uint16_t ADSD3500_STATUS_FIRMWARE_UPDATE_COMPLETE
Firmware update is complete.
Definition: adsd_errs.h:245
const uint16_t ADSD3500_STATUS_TIMEOUT_ERROR
This is when timer is expired but ADSD3500 is not able to send out frame due to some error.
Definition: adsd_errs.h:227
std::string GetStringADSD3030(uint16_t value)
Returns a string for a given target (adsdType) and error code for the ADSD3030.
Definition: adsd_errs.h:159
const uint16_t ADSD3500_STATUS_INVALID_FIRMWARE_CRC
The ADSD3500 firmware CRC check failed.
Definition: adsd_errs.h:187
std::string GetStringADSD3500(uint16_t value)
Returns a string for a given target (adsdType) and error code for the ADSD3500.
Definition: adsd_errs.h:123
const uint16_t ADSD3500_STATUS_INVALID_MEMORY_REGION
TODO.
Definition: adsd_errs.h:183
const uint16_t ADSD3500_STATUS_IMAGER_ERROR
The imager reported an error.
Definition: adsd_errs.h:223
const uint16_t ADSD3100_ERR_OVERHEAT_IMAGER
Imager sensor overheat. Imager error codes read via "Get Imager Error Code" (0x0038) command Note,...
Definition: adsd_errs.h:288
const uint16_t ADSD3500_STATUS_INVALID_PHASE_INVALID_VALUE
An incorrect phase invalid value specified.
Definition: adsd_errs.h:239
const uint16_t ADSD3500_STATUS_NVM_WRITE_COMPLETE
NVM update is complete.
Definition: adsd_errs.h:249
const uint16_t ADSD3100_ERR_LASER_SHORT_LEN_OFF
Laser driver disabled for too short of time. Imager error codes read via "Get Imager Error Code" (0x0...
Definition: adsd_errs.h:348
const uint16_t ADSD3100_ERR_LASER_NO_DIFFUSER
Laser diffuser problem. Imager error codes read via "Get Imager Error Code" (0x0038) command Note,...
Definition: adsd_errs.h:312
const uint16_t ADSD3100_ERR_OVERHEAT_LD
Laser driver overheat. Imager error codes read via "Get Imager Error Code" (0x0038) command Note,...
Definition: adsd_errs.h:294
const uint16_t ADSD3100_ERR_LVDS_HIGH_DC
Laser driver duty cycle too large. Imager error codes read via "Get Imager Error Code" (0x0038) comma...
Definition: adsd_errs.h:324
const uint16_t ADSD3500_STATUS_FLASH_FILE_PARSE_ERROR
Flash update error.
Definition: adsd_errs.h:203
const uint16_t ADSD3500_STATUS_INVALID_JBLF_FILTER_SIZE
The JBLF filter size speficied is incorrect.
Definition: adsd_errs.h:175
const uint16_t ADSD3100_ERR_LASER_LPS_READ
Laser driver corrupted data. Imager error codes read via "Get Imager Error Code" (0x0038) command Not...
Definition: adsd_errs.h:354
const uint16_t ADSD3100_ERR_LASER_LPS
Corrupted laser driver data. Imager error codes read via "Get Imager Error Code" (0x0038) command Not...
Definition: adsd_errs.h:306
const uint16_t ADSD3100_ERR_MODE_MODE_DRIVER
Invalid LD mode selection. Imager error codes read via "Get Imager Error Code" (0x0038) command Note,...
Definition: adsd_errs.h:262
const uint16_t ADSD3100_ERR_LVDS_OPEN_SHORT
Laser driver input open or short detected. Imager error codes read via "Get Imager Error Code" (0x003...
Definition: adsd_errs.h:336
const uint16_t ADSD3500_STATUS_INVALID_IMAGER
The imager firmware is not valid.
Definition: adsd_errs.h:191
const uint16_t ADSD3500_STATUS_IMAGER_BOOT_FAILURE
Unable to boot the imager.
Definition: adsd_errs.h:219
const uint16_t ADSD3100_ERR_LASER_VLD_HIGH
Laser driver supply too high. Imager error codes read via "Get Imager Error Code" (0x0038) command No...
Definition: adsd_errs.h:366
const uint16_t ADSD3500_STATUS_DYNAMIC_MODE_SWITCHING_NOT_ENABLED
Dynamic mode switching is being set, but it is not enabled.
Definition: adsd_errs.h:231
const uint16_t ADSD3100_ERR_LASER_SHORT
Laser driver shorted to GND. Imager error codes read via "Get Imager Error Code" (0x0038) command Not...
Definition: adsd_errs.h:318
const uint16_t ADSD3100_ERR_LASER_LONG_LEN_ON
Laser driver enabled for too long of time. Imager error codes read via "Get Imager Error Code" (0x003...
Definition: adsd_errs.h:342
const uint16_t ADSD3100_ERR_PLLLOCK_LOCK2
PLLLOCK error location 2. Imager error codes read via "Get Imager Error Code" (0x0038) command Note,...
Definition: adsd_errs.h:274
const uint16_t ADSD3500_STATUS_IMAGER_COMMUNICATION_ERROR
SPI Master error occured during communication between the ASDSD3500 and the imager.
Definition: adsd_errs.h:215
const uint16_t ADSD3100_ERR_MODE_USECASE
Invalid mode selection. Imager error codes read via "Get Imager Error Code" (0x0038) command Note,...
Definition: adsd_errs.h:256
const uint16_t ADSD3100_ERR_PLLLOCK_LOCK3
PLLLOCK error location 3. Imager error codes read via "Get Imager Error Code" (0x0038) command Note,...
Definition: adsd_errs.h:281
const uint16_t ADSD3500_STATUS_INVALID_MODE
Mode selected is invalid.
Definition: adsd_errs.h:171
Error codes from the ADSD3500, ADSD3100, ADSD3030 Usage: Included with aditof/camera....
Definition: adsd_errs.h:51
std::string GetStringADSD3100(uint16_t value)
Returns a string for a given target (adsdType) and error code for the ADSD3100.
Definition: adsd_errs.h:141
const uint16_t ADSD3500_STATUS_INVALID_CHIPID
The imager chip ID is invalid.
Definition: adsd_errs.h:211
const uint16_t ADSD3500_STATUS_FLASH_HEADER_PARSE_ERROR
Flash update error.
Definition: adsd_errs.h:199
const uint16_t ADSD3100_ERR_PLLLOCK_LOCK1
PLLLOCK error location 1. Imager error codes read via "Get Imager Error Code" (0x0038) command Note,...
Definition: adsd_errs.h:268