Skip to content

Error status and codes

Jeremy Hsieh edited this page Jun 26, 2020 · 11 revisions

Reading Error Status

There are multiple ways to get the error statusand codes from the device:

  1. UART/USB command:
    #define NNO_CMD_READ_ERROR_STATUS           CMD_KEY(0x04, 0x04, CMD1_READ,  0x00)
  1. BLE service

   Read from GATT General Information Service, Characteristic UUID 0x43484104-444C-5020-4E49-52204E616E6F

  1. ISC WinForm SDK:
    Device.ReadErrorStatusAndCode();

   The error status and codes are refreshed in Device.ErrStatus.

  1. iOS SDK:
    NIRScanSDK *nano = [NIRScanSDK manager];
    NSData *errData = nano.NIRScanSDKdeviceStatus[NIRScanSDKKeyErrorStatus];
  1. Android SDK:
    ISCNIRScanSDK.GetDeviceStatus();

   Register mStatusReceiver to get the device status and error status.


Error status and codes constructor

The following codes show the error status and codes constructor:

#define MAX_BLE_PKT_SIZE 20
#define RESERVED_SIZE    (MAX_BLE_PKT_SIZE - 4 - NNO_error_code_max -1)	/* -1 because ble uses two bytes */

typedef struct
{
    uint32_t status;
    NNO_error_codes_struct errorCodes;
} NNO_error_status_struct; // Size of struct should not exceed MTU size for BLE

typedef struct
{
    int8_t scan;
    int8_t adc;
    int8_t sd;
    int8_t eeprom;
    int16_t ble;
    int8_t spec_lib;
    int8_t hw;
    int8_t tmp;
    int8_t hdc;
    int8_t battery;
    int8_t memory;
    int8_t uart;
    int8_t system;
    int8_t reserved[RESERVED_SIZE];	// Future use
} NNO_error_codes_struct;

Error status definition

The error status is given by the first four bytes (uint32_t) of data payload:

/************ 		Error Status Defintions *****************/
#define NNO_ERROR_SCAN                              0x00000001
#define NNO_ERROR_ADC                               0x00000002
#define NNO_ERROR_SD_CARD                           0x00000004  // Not used by ISC's FW
#define NNO_ERROR_EEPROM                            0x00000008
#define NNO_ERROR_BLE                               0x00000010
#define NNO_ERROR_SPEC_LIB                          0x00000020
#define NNO_ERROR_HW                                0x00000040
#define NNO_ERROR_TMP006                            0x00000080  // Not used by ISC's FW
#define NNO_ERROR_HDC1000                           0x00000100
#define NNO_ERROR_BATTERY_EMPTY                     0x00000200
#define NNO_ERROR_INSUFFICIENT_MEMORY               0x00000400
#define NNO_ERROR_UART                              0x00000800
#define NNO_ERROR_SYSTEM                            0x00001000
#define NNO_ERROR_MAX                               NNO_ERROR_SYSTEM

Error codes definition by each status item

Following shows the definitions of each error in detail. Followed by the first four bytes of error status data.

/******************** 	Scan Error codes   **********************/
#define NNO_ERROR_SCAN_DLPC150_BOOT_ERROR           0x00000001
#define NNO_ERROR_SCAN_DLPC150_INIT_ERROR           0x00000002
#define	NNO_ERROR_SCAN_DLPC150_LAMP_DRIVER_ERROR    0x00000004
#define NNO_ERROR_SCAN_DLPC150_CROP_IMG_FAILED      0x00000008
#define NNO_ERROR_SCAN_ADC_DATA_ERROR               0x00000010
#define NNO_ERROR_SCAN_CFG_INVALID                  0x00000020
#define NNO_ERROR_SCAN_PATTERN_STREAMING            0x00000040
#define NNO_ERROR_SCAN_DLPC150_READ_ERROR           0x00000080

/******************** 	ADC Error codes   ***********************/
#define NNO_ERROR_ADC_START                         0x00000001
#define ADC_ERROR_TIMEOUT                           NNO_ERROR_ADC_START
#define ADC_ERROR_POWERDOWN                         (NNO_ERROR_ADC_START + 1)
#define ADC_ERROR_POWERUP                           (NNO_ERROR_ADC_START + 2)
#define ADC_ERROR_STANDBY                           (NNO_ERROR_ADC_START + 3)
#define ADC_ERROR_WAKEUP                            (NNO_ERROR_ADC_START + 4)
#define ADC_ERROR_READREGISTER                      (NNO_ERROR_ADC_START + 5)
#define ADC_ERROR_WRITEREGISTER                     (NNO_ERROR_ADC_START + 6)
#define ADC_ERROR_CONFIGURE                         (NNO_ERROR_ADC_START + 7)
#define ADC_ERROR_SETBUFFER                         (NNO_ERROR_ADC_START + 8)
#define ADC_ERROR_COMMAND                           (NNO_ERROR_ADC_START + 9)
#define ADC_ERROR_SET_PGA                           (NNO_ERROR_ADC_START + 10)

/********************     BLE Error codes   ***********************/
#define BLE_OPEN_STACK_FAILED                        -4
#define APPLICATION_TASK_CREATION_FAILED            (-1001)
#define APPLICATION_ERROR_NO_COMMAND                (-1002)
#define APPLICATION_ERROR_INVALID_COMMAND           (-1003)
#define APPLICATION_ERROR_EXIT_CODE                 (-1004)
#define APPLICATION_ERROR_FUNCTION                  (-1005)
#define APPLICATION_ERROR_TOO_MANY_PARAMS           (-1006)
#define APPLICATION_ERROR_INVALID_PARAMETERS        (-1007)
#define APPLICATION_ERROR_UNABLE_TO_OPEN_STACK      (-1008)
#define APPLICATION_ERROR_INVALID_STACK_ID          (-1009)
#define APPLICATION_ERROR_GATT_SERVICE_EXISTS       (-1010)
#define APPLICATION_ERROR_GAPS                      (-1011)

/********************   SPECLIB Error codes   ***********************/
#define ERR_DLPSPEC_FAIL                            -1
#define ERR_DLPSPEC_INVALID_INPUT                   -2
#define ERR_DLPSPEC_INSUFFICIENT_MEM                -3
#define ERR_DLPSPEC_TPL                             -4
#define ERR_DLPSPEC_ILLEGAL_SCAN_TYPE               -5
#define ERR_DLPSPEC_NULL_POINTER                    -6

/********************* 	HW Error codes   ************************/
#define NNO_ERROR_HW_START                          0x00000001
#define NNO_ERROR_HW_DLPC150                        (NNO_ERROR_HW_START)
#define NNO_ERROR_HW_UUID                           (NNO_ERROR_HW_START + 1)
#define NNO_ERROR_HW_FLASH_INIT                     (NNO_ERROR_HW_START + 2)
#define NNO_ERROR_HW_MAX                            (NNO_ERROR_HW_START + 3) // Modify this entry when new codes are added above

/******************** 	HDC1000 Error codes   *******************/
#define NNO_ERROR_HDC1000_START                     0x00000001
#define NNO_ERROR_HDC1000_MANUID                    (NNO_ERROR_HDC1000_START)
#define NNO_ERROR_HDC1000_DEVID                     (NNO_ERROR_HDC1000_START + 1)
#define NNO_ERROR_HDC1000_RESET                     (NNO_ERROR_HDC1000_START + 2)
#define NNO_ERROR_HDC1000_READREGISTER              (NNO_ERROR_HDC1000_START + 3)
#define NNO_ERROR_HDC1000_WRITEREGISTER             (NNO_ERROR_HDC1000_START + 4)
#define NNO_ERROR_HDC1000_TIMEOUT                   (NNO_ERROR_HDC1000_START + 5)
#define NNO_ERROR_HDC1000_I2C                       (NNO_ERROR_HDC1000_START + 6)
#define NNO_ERROR_HDC1000_MAX                       (NNO_ERROR_HDC1000_START + 7) // Modify this entry when new codes are added above

/********************   Battery Error codes   *******************/
#define NNO_ERROR_BATTERY_START                     0x00000001
#define NNO_ERROR_BATTERY_UNDER_VOL                 (NNO_ERROR_BATTERY_START)
#define NNO_ERROR_BATTERY_MAX                       (NNO_ERROR_BATTERY_START + 1) // Modify this entry when new codes are added above

/********************   UART Error codes   *******************/
#define UART_INCOMP_START_END_IND_RECD   -1
#define UART_INPUT_PKT_CHECKSUM_ERROR    -2
#define UART_WRITE_FAILED                -3

/********************   System Error codes   *******************/
#define NNO_ERROR_SYSTEM_START                      0x00000001
#define NNO_ERROR_SYSTEM_UNSTABLE_LAMP_ADC          (NNO_ERROR_SYSTEM_START)
#define NNO_ERROR_SYSTEM_UNSTABLE_PEAK_INTENSETY    (NNO_ERROR_SYSTEM_START << 1)
#define NNO_ERROR_SYSTEM_ADS1255                    (NNO_ERROR_SYSTEM_START << 2)
#define NNO_ERROR_SYSTEM_AUTOPGA                    (NNO_ERROR_SYSTEM_START << 3)
#define NNO_ERROR_SYSTEM_UNSTABLE_SCAN_IN_REPEATED  (NNO_ERROR_SYSTEM_START << 4)

*** You can get these error definition above from the header file - NNOStatusDefs.h.

*** Parser examples could be found in ISC's SDK:

Winform SDK

iOS SDK

Android SDK