swc_error.h
SPARK Wireless Core error codes.
- Copyright
Copyright (C) 2026 SPARK Microsystems International Inc. All rights reserved.
- License
This source code is proprietary and subject to the SPARK Microsystems Software EULA found in this package in file EULA.txt.
- Author
SPARK FW Team.
Defines
-
ASSERT_SWC_STATUS(swc_status)
do { \
if ((swc_status) ==
SWC_ERR_NONE) { \
/* Exit early. */ \
break; \
} \
\
if ((swc_status) > 0) { \
/* Handle warning */ \
swc_warning_handler(swc_status); \
break; \
} \
\
/* Handle error */ \
swc_error_handler(swc_status); \
} while (0)
ASSERT the return status of a SWC function.
-
SWC_COUNTER (__COUNTER__ - SWC_COUNTER_BASE)
Create a local counter macro.
-
SWC_GENERATE_ERR_CODE (-SWC_COUNTER)
Automatically increase error count each time invoked. Starts at -1.
Enums
-
enum [anonymous]
Values:
-
enumerator SWC_COUNTER_BASE = __COUNTER__
-
enumerator SWC_COUNTER_BASE = __COUNTER__
-
enum swc_error
Wireless API error structure.
Values:
-
enumerator SWC_ERR_NONE = 0
No error nor warning occurred.
-
enumerator SWC_WARN_TX_PULSE_COUNT
Warnings (positive values).
The configured TX pulse count could potentially cause unexpected behavior. Use at your own risk.
-
enumerator SWC_WARN_TX_PULSE_COUNT_OFFSET
The configured TX pulse count offset could potentially cause unexpected behavior. Use at your own risk.
-
enumerator SWC_WARN_RX_PULSE_COUNT
The configured RX pulse count could potentially cause unexpected behavior. Use at your own risk.
-
enumerator SWC_WARN_NO_BUFFER_AVAILABLE
There is no more payload buffer available from the queue.
-
enumerator SWC_WARN_ALREADY_CONNECTED
The Wireless Core is already connected.
-
enumerator SWC_WARN_SEND_QUEUE_FULL
The queue of the sender is full.
-
enumerator SWC_WARN_RX_OVERRUN
New payload received and dropped because the RX queue is full.
-
enumerator SWC_WARN_ALREADY_DISCONNECTED
The Wireless Core is already disconnected.
-
enumerator SWC_WARN_DEST_ADDR_ALREADY_PENDING
A destination address change request is already pending for this remote node.
-
enumerator SWC_WARN_DEST_ADDR_NO_CHANGE
The current and new addresses are identical, nothing to do.
-
enumerator SWC_ERR_NOT_INITIALIZED = SWC_GENERATE_ERR_CODE
Errors (negative values).
The Wireless Core is not initialized.
-
enumerator SWC_ERR_NOT_ENOUGH_MEMORY = SWC_GENERATE_ERR_CODE
Not enough memory is allocated by the application for a full Wireless Core initialization.
-
enumerator SWC_ERR_NULL_PTR = SWC_GENERATE_ERR_CODE
A NULL pointer is passed as argument.
-
enumerator SWC_ERR_FAST_SYNC_WITH_DUAL_RADIO = SWC_GENERATE_ERR_CODE
Fast sync and dual radio are enabled but are incompatible.
-
enumerator SWC_ERR_PAN_ID = SWC_GENERATE_ERR_CODE
The configured PAN ID is invalid.
-
enumerator SWC_ERR_NETWORK_ROLE = SWC_GENERATE_ERR_CODE
The configured network role is invalid.
-
enumerator SWC_ERR_SLEEP_LEVEL = SWC_GENERATE_ERR_CODE
The configured sleep level is invalid.
-
enumerator SWC_ERR_IRQ_POLARITY = SWC_GENERATE_ERR_CODE
The configured IRQ polarity is invalid.
-
enumerator SWC_ERR_SPI_MODE = SWC_GENERATE_ERR_CODE
The configured SPI mode is invalid.
-
enumerator SWC_ERR_MODULATION = SWC_GENERATE_ERR_CODE
The configured modulation is invalid.
-
enumerator SWC_ERR_FEC_RATIO = SWC_GENERATE_ERR_CODE
The configured FEC ratio is invalid.
-
enumerator SWC_ERR_CCA_RETRY_TIME = SWC_GENERATE_ERR_CODE
The configured CCA retry time is bigger than the maximum allowed.
-
enumerator SWC_ERR_CCA_TRY_COUNT = SWC_GENERATE_ERR_CODE
The configured CCA try count is bigger than the maximum allowed.
-
enumerator SWC_ERR_CCA_FAIL_ACTION = SWC_GENERATE_ERR_CODE
The configured CCA fail action is invalid.
-
enumerator SWC_ERR_CCA_INVALID_PARAMETERS = SWC_GENERATE_ERR_CODE
The configured CCA parameters are invalid.
-
enumerator SWC_ERR_LOCAL_ADDRESS = SWC_GENERATE_ERR_CODE
The configured local address is invalid.
-
enumerator SWC_ERR_SOURCE_ADDRESS = SWC_GENERATE_ERR_CODE
The configured source address is invalid.
-
enumerator SWC_ERR_DESTINATION_ADDRESS = SWC_GENERATE_ERR_CODE
The configured destination address is invalid.
-
enumerator SWC_ERR_CONNECTION_ADDRESS = SWC_GENERATE_ERR_CODE
None of the connection’s addresses match with the local device’s address.
-
enumerator SWC_ERR_ARQ_WITH_ACK_DISABLED = SWC_GENERATE_ERR_CODE
ARQ is enabled while ACK is not.
-
enumerator SWC_ERR_THROTTLING_NOT_SUPPORTED = SWC_GENERATE_ERR_CODE
Link throttling is disabled on this connection.
-
enumerator SWC_ERR_TX_PULSE_WIDTH = SWC_GENERATE_ERR_CODE
The configured TX pulse width is invalid.
-
enumerator SWC_ERR_TX_PULSE_WIDTH_OFFSET = SWC_GENERATE_ERR_CODE
The configured TX pulse width offset is invalid.
-
enumerator SWC_ERR_TX_PULSE_GAIN = SWC_GENERATE_ERR_CODE
The configured TX pulse gain is invalid.
-
enumerator SWC_ERR_TX_GAIN_OFFSET = SWC_GENERATE_ERR_CODE
The configured TX pulse gain offset is invalid.
-
enumerator SWC_ERR_ADD_CHANNEL_ON_INVALID_CONNECTION = SWC_GENERATE_ERR_CODE
A channel is added on a connection using only auto-reply timeslots.
-
enumerator SWC_ERR_INTERNAL = SWC_GENERATE_ERR_CODE
There is an internal Wireless Core error.
-
enumerator SWC_ERR_NOT_CONNECTED = SWC_GENERATE_ERR_CODE
The Wireless Core is not connected.
-
enumerator SWC_ERR_DISCONNECT_TIMEOUT = SWC_GENERATE_ERR_CODE
The Wireless Core failed to disconnect within the timeout value.
-
enumerator SWC_ERR_PAYLOAD_TOO_BIG = SWC_GENERATE_ERR_CODE
The configured payload size exceeds the maximum value for the current connection configuration.
-
enumerator SWC_ERR_SECOND_RADIO_NOT_INIT = SWC_GENERATE_ERR_CODE
Dual radio is used but swc_node_radio_add() is not called twice.
-
enumerator SWC_ERR_FRAGMENTATION_NOT_SUPPORTED = SWC_GENERATE_ERR_CODE
The function call is not supported when the frame fragmentation is enabled on the connection. swc_connection_receive_to_buffer() should be used instead.
-
enumerator SWC_ERR_OUTIMPED = SWC_GENERATE_ERR_CODE
The configured output driver impedance is invalid.
-
enumerator SWC_ERR_TX_CONN_ACTION_ON_RX_CONN = SWC_GENERATE_ERR_CODE
User tried to call a TX connection function on a RX connection.
-
enumerator SWC_ERR_ZERO_TIMESLOT_SEQ_LEN = SWC_GENERATE_ERR_CODE
Input parameter is out of acceptable value.
-
enumerator SWC_ERR_ZERO_CHAN_SEQ_LEN = SWC_GENERATE_ERR_CODE
Zero value was given to channel sequence length.
-
enumerator SWC_ERR_MIN_QUEUE_SIZE = SWC_GENERATE_ERR_CODE
Minimum queue size requirement not met.
-
enumerator SWC_ERR_ZERO_TIMESLOT_COUNT = SWC_GENERATE_ERR_CODE
Zero was given to timeslot count.
-
enumerator SWC_ERR_NULL_TIMESLOT_DURATION = SWC_GENERATE_ERR_CODE
Zero was given as timeslot duration for 1 or more timeslots.
-
enumerator SWC_ERR_CHANGING_CONFIG_WHILE_RUNNING = SWC_GENERATE_ERR_CODE
User tried to change configuration while the SWC is running.
-
enumerator SWC_ERR_SIZE_TOO_BIG = SWC_GENERATE_ERR_CODE
The payload sent is greater than the available space.
-
enumerator SWC_ERR_RECEIVE_QUEUE_EMPTY = SWC_GENERATE_ERR_CODE
The queue of the receiver is empty.
-
enumerator SWC_ERR_TIMESLOT_CONN_LIMIT_REACHED = SWC_GENERATE_ERR_CODE
The maximum number of connections assigned to the time slot was already reached.
-
enumerator SWC_ERR_NON_MATCHING_SAME_TIMESLOT_CONN_FIELD = SWC_GENERATE_ERR_CODE
Some connection fields must be identical in order for these connections to be used on the same time slot using the connection priority feature.
-
enumerator SWC_ERR_MAX_CONN_PRIORITY = SWC_GENERATE_ERR_CODE
The priority of the connection is higher than the maximum priority.
-
enumerator SWC_ERR_BUFFER_SIZE_TOO_SMALL = SWC_GENERATE_ERR_CODE
The provided buffer size is too small to execute the operation.
-
enumerator SWC_ERR_INVALID_PARAMETER = SWC_GENERATE_ERR_CODE
The one of the specified parameter/s has an invalid value.
-
enumerator SWC_ERR_NOT_ALLOWED_CONN_PRIORITY_CONFIGURATION = SWC_GENERATE_ERR_CODE
The priority configuration of the connection is not allowed.
-
enumerator SWC_ERR_PRIO_NOT_ENABLE_ON_ALL_CONN = SWC_GENERATE_ERR_CODE
Connection priority feature is not enabled on each connection sharing the same timeslot.
-
enumerator SWC_ERR_OPTIMIZATION_DELAY_TO_HIGH = SWC_GENERATE_ERR_CODE
The computed delay for the latency optimization feature is too high.
-
enumerator SWC_ERR_CHIP_RATE = SWC_GENERATE_ERR_CODE
The configured chip rate is invalid.
-
enumerator SWC_ERR_CREDIT_FLOW_CTRL_WITH_ACK_DISABLED = SWC_GENERATE_ERR_CODE
Credit flow control is enabled while ACK is not.
-
enumerator SWC_ERR_CONTEXT_SWITCH_TRIGGER_IS_NULL = SWC_GENERATE_ERR_CODE
The context switch trigger has not been initialized.
-
enumerator SWC_ERR_ACK_NOT_SUPPORTED_IN_AUTO_REPLY_CONNECTION = SWC_GENERATE_ERR_CODE
The Wireless core doesn’t support acknowledge on an auto-reply connection.
-
enumerator SWC_ERR_RADIO_ID_INVALID = SWC_GENERATE_ERR_CODE
The radio ID provided is out of range.
-
enumerator SWC_ERR_CALIBRATION_MISSING = SWC_GENERATE_ERR_CODE
No saved calibration data found in HEAP; calibration required.
-
enumerator SWC_ERR_CALIBRATION_CRC_INVALID = SWC_GENERATE_ERR_CODE
Invalid calibration data; CRC mismatch.
-
enumerator SWC_ERR_CALIBRATION_DATA_SIZE_INVALID = SWC_GENERATE_ERR_CODE
Invalid calibration data size.
-
enumerator SWC_ERR_RADIO_NOT_FOUND = SWC_GENERATE_ERR_CODE
Radio model not found.
-
enumerator SWC_ERR_INVALID_TIMESLOT_SLEEP_LEVEL = SWC_GENERATE_ERR_CODE
Sleep level for one of the time slots is incorrect.
-
enumerator SWC_ERR_INVALID_OPERATION_AFTER_SETUP = SWC_GENERATE_ERR_CODE
Operation must be done before SWC setup.
-
enumerator SWC_ERR_NO_CHANNEL_INIT = SWC_GENERATE_ERR_CODE
No channels are initialized in one of the connections.
-
enumerator SWC_ERR_CHANNEL_OUT_OF_RANGE = SWC_GENERATE_ERR_CODE
Selected channel is out of range for the current radio model.
-
enumerator SWC_ERR_MAX_CHANNELS_EXCEEDED = SWC_GENERATE_ERR_CODE
The number of channels added to the connection exceeds the maximum.
-
enumerator SWC_ERR_CHANNELS_ALREADY_SET = SWC_GENERATE_ERR_CODE
Channels have already been set for this connection.
-
enumerator SWC_ERR_DYNAMIC_PHY_MODE_DISABLED = SWC_GENERATE_ERR_CODE
PHY mode was requested while the feature is disabled.
-
enumerator SWC_ERR_UNINITIALIZED_CONNECTION = SWC_GENERATE_ERR_CODE
Connection hasn’t been allocated and the pointer is null.
-
enumerator SWC_ERR_CONNECTION_CREATION_FAILED = SWC_GENERATE_ERR_CODE
Failed to create connection due to internal error.
-
enumerator SWC_ERR_FRAME_CONFIGURATION_FAILED = SWC_GENERATE_ERR_CODE
Failed to configure frame due to internal error.
-
enumerator SWC_ERR_FAILED_TO_SET_CALLBACK = SWC_GENERATE_ERR_CODE
Failed to set callback due to internal error.
-
enumerator SWC_ERR_NODE_NOT_INITIALIZED = SWC_GENERATE_ERR_CODE
The node instance hasn’t been initialized before.
-
enumerator SWC_ERR_NOT_MATCHING_NETWORK_ID = SWC_GENERATE_ERR_CODE
Network ID doesn’t match the Network ID set during node init.
-
enumerator SWC_ERR_FLUSH_QUEUE_WHILE_RUNNING = SWC_GENERATE_ERR_CODE
User tried to flush a connection’s queue while the SWC is running.
-
enumerator SWC_ERR_INVALID_OPERATION_AFTER_SWC_LOCK = SWC_GENERATE_ERR_CODE
Connection settings cannot be modified after the connection priority or slot priority has been initialized. Ensure that these feature API calls are the last ones made when configuring a connection.
-
enumerator SWC_ERR_INVALID_OPERATION_CONN_PRIO_ENABLED = SWC_GENERATE_ERR_CODE
Slot priority feature cannot be used if connection priority is enabled.
-
enumerator SWC_ERR_INVALID_OPERATION_SLOT_PRIO_ENABLED = SWC_GENERATE_ERR_CODE
Connection priority feature cannot be used if slot priority is enabled.
-
enumerator SWC_ERR_RX_CONN_ACTION_ON_TX_CONN = SWC_GENERATE_ERR_CODE
User tried to call an RX connection function on a TX connection.
-
enumerator SWC_ERR_FALLBACK_NOT_ENABLED = SWC_GENERATE_ERR_CODE
Fallback configuration was not enabled before the operation.
-
enumerator SWC_ERR_DEST_ADDR_ALREADY_IN_USE = SWC_GENERATE_ERR_CODE
The new address is already in use by another remote node.
-
enumerator SWC_ERR_NONE = 0
Functions
-
void swc_error_handler(swc_error_t swc_status)
Handle an SWC error.
Note
This function has a weak definition in swc_error.c. The function can be redifined in the application to change the error handling behaviour.
- Parameters:
swc_status – [in] SWC status code.
-
void swc_warning_handler(swc_error_t swc_status)
Handle an SWC warning.
Note
This function has a weak definition in swc_error.c. The function can be redifined in the application to change the warning handling behaviour.
- Parameters:
swc_status – [in] SWC status code.