Skip to main content

Common Error Codes

The ihwapi_err_code_t enumeration defines error codes returned by API functions. These error codes help identify issues that may occur during device operation.

Enum Definition

enum ihwapi_err_code_t
{
IHWAPI_OK = 0, ///< All is OK
IHWAPI_HW_ERRORS = 1000,
IHWAPI_NOT_SUPPORTED, ///< Unsupported command by this device
IHWAPI_DEVICE_NOT_OPEN, ///< Device is not open
IHWAPI_DEVICE_NOT_FOUND, ///< Device not found
IHWAPI_INVALID_SERIAL,
IHWAPI_INVALID_CONFIG,
IHWAPI_INVALID_ARGUMENT, ///< One or more invalid arguments were used when calling an API function
IHWAPI_BUSY, ///< Device is busy
IHWAPI_ABORTED,
IHWAPI_POWER_FAILURE, //9
IHWAPI_PLL_FAILURE, //10
IHWAPI_FLUSH_TIMEOUT, //11
IHWAPI_NOT_RESPONDING, //12
IHWAPI_NO_DATA, //13
IHWAPI_FIRMWARE_ERROR, ///< Firmware error (invalid version or corrupted image)
IHWAPI_FIRM_UPDT_FAILED,
IHWAPI_DATA_NOT_ALIGNED,
IHWAPI_DEVICE_FORGED,
IHWAPI_HARDWARE_FAULT = 1100,
IHWAPI_UNKNOWN_ERROR = 1999, ///< Unknown error
IHWAPI_USB_ERRORS = 2000,
IHWAPI_USB3_ERRORS = 3000,
IHWAPI_NOT_IMPLEMENTED = 99998,
};

Error Code Descriptions

Error CodeValueDescription
IHWAPI_OK0Operation completed successfully
IHWAPI_HW_ERRORS1000General hardware error
IHWAPI_NOT_SUPPORTED1001Command not supported by this device
IHWAPI_DEVICE_NOT_OPEN1002Device is not open
IHWAPI_DEVICE_NOT_FOUND1003No device detected
IHWAPI_INVALID_SERIAL1004Invalid device serial number
IHWAPI_INVALID_CONFIG1005Invalid configuration detected
IHWAPI_INVALID_ARGUMENT1006One or more invalid arguments used
IHWAPI_BUSY1007Device is currently busy processing another command
IHWAPI_ABORTED1008Operation was aborted before completion
IHWAPI_POWER_FAILURE1009Power failure detected
IHWAPI_PLL_FAILURE1010PLL synchronization failure
IHWAPI_FLUSH_TIMEOUT1011Timeout occurred while flushing data
IHWAPI_NOT_RESPONDING1012Device is not responding
IHWAPI_NO_DATA1013No data available for retrieval
IHWAPI_FIRMWARE_ERROR1014Firmware error detected (corrupted or incompatible version)
IHWAPI_FIRM_UPDT_FAILED1015Firmware update failed
IHWAPI_DATA_NOT_ALIGNED1016Data alignment issue detected
IHWAPI_DEVICE_FORGED1017Device authenticity verification failed
IHWAPI_HARDWARE_FAULT1100Hardware fault detected
IHWAPI_UNKNOWN_ERROR1999Unknown error occurred
IHWAPI_USB_ERRORS2000Generic USB communication error
IHWAPI_USB3_ERRORS3000USB 3.0 specific communication error
IHWAPI_NOT_IMPLEMENTED99998Feature or function is not implemented

Example: Handling Errors

Proper error handling ensures robust API usage. The following example demonstrates how to check for errors when performing an API call:

ihwapi_err_code_t status = sp209api_device_open(handle, device, SP209API_VARIANT_STD);

if (status != IHWAPI_OK) {
printf("Error occurred: %d\n", status);
}

Conclusion

The ihwapi_err_code_t enumeration provides a structured way to diagnose issues encountered while interacting with logic analyzers. Developers should use these error codes to implement proper exception handling and ensure smooth device operation.