Assertions#

Callbacks called by assertions.

The assertion framework was implemented to not only assert that certain conditions are true in a block of code, but also to handle them more appropriately. In previous implementations, the behavior upon a failed assert was to hang in a while(1) loop. However, with the callback, each assert is given a unique error code so that they can be handled on a more case-by-case basis. For documentation on each of the errors, see the rail_assert_error_codes.h file. RAIL_ASSERT_ERROR_MESSAGES[errorCode] gives the explanation of the error. With asserts built into the library, users can choose how to handle each error inside the callback.

Enumerations#

enum
RAIL_ASSERT_FAILED_APPENDED_INFO_MISSING = 0
RAIL_ASSERT_FAILED_RX_FIFO_BYTES = 1
RAIL_ASSERT_FAILED_RX_FIFO_ZERO_BYTES_READ = 2
RAIL_ASSERT_FAILED_ILLEGAL_RXLEN_ENTRY_STATUS = 3
RAIL_ASSERT_FAILED_BAD_PACKET_LENGTH = 4
RAIL_ASSERT_FAILED_SYNTH_DIVCTRL_ENUM_CONVERSION_ERROR = 5
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_RX_FIFO = 6
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_RXLEN_FIFO = 7
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_TX_FIFO = 8
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_TXACK_FIFO = 9
RAIL_ASSERT_FAILED_PBUFFER_NOT_DEFINED = 10
RAIL_ASSERT_FAILED_INSUFFICIENT_BYTES_IN_RX_PACKET = 11
RAIL_ASSERT_FAILED_CLOCK_PRESCALER = 12
RAIL_ASSERT_FAILED_RTCC_POST_WAKEUP = 13
RAIL_ASSERT_FAILED_SYNTH_VCO_FREQUENCY = 14
RAIL_ASSERT_FAILED_RAC_STATE = 15
RAIL_ASSERT_FAILED_SYNTH_INVALID_VCOCTRL = 16
RAIL_ASSERT_FAILED_NESTED_SEQUENCER_LOCK = 17
RAIL_ASSERT_FAILED_RSSI_AVERAGE_DONE = 18
RAIL_ASSERT_FAILED_DFL_BITS_SIZE = 19
RAIL_ASSERT_FAILED_PROTIMER_RANDOM_SEED = 20
RAIL_ASSERT_FAILED_EFR32XG1_REGISTER_SIZE = 21
RAIL_ASSERT_FAILED_PROTIMER_CHANNEL = 22
RAIL_ASSERT_FAILED_TIMER_REQUIRES_WRAP = 23
RAIL_ASSERT_FAILED_BASECNTTOP = 24
RAIL_ASSERT_FAILED_DEPRECATED_LBTRETRY = 25
RAIL_ASSERT_FAILED_RTCC_SYNC_MISSED = 26
RAIL_ASSERT_FAILED_CLOCK_SOURCE_NOT_READY = 27
RAIL_ASSERT_FAILED_TIMINGS_INVALID = 28
RAIL_ASSERT_NULL_HANDLE = 29
RAIL_ASSERT_FAILED_SCHED_TIMER_NOT_RUNNING = 30
RAIL_ASSERT_FAILED_NO_ACTIVE_CONFIG = 31
RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SWITCH = 32
RAIL_ASSERT_FAILED_RESERVED33 = 33
RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SCHEDRX = 34
RAIL_ASSERT_FAILED_INVALID_HANDLE_SCHEDTX = 35
RAIL_ASSERT_FAILED_INACTIVE_HANDLE_SCHEDTX = 36
RAIL_ASSERT_FAILED_CONFIG_INDEX_INVALID = 37
RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SINGLEPROTOCOL = 38
RAIL_ASSERT_DEPRECATED_FUNCTION = 39
RAIL_ASSERT_MULTIPROTOCOL_NO_EVENT = 40
RAIL_ASSERT_FAILED_INVALID_INTERRUPT_ENABLED = 41
RAIL_ASSERT_CONVERSION_CURVES_NOT_INITIALIZED = 42
RAIL_ASSERT_DIVISION_BY_ZERO = 43
RAIL_ASSERT_CANT_USE_HARDWARE = 44
RAIL_ASSERT_NULL_PARAMETER = 45
RAIL_ASSERT_INVALID_TASK_TYPE = 46
RAIL_ASSERT_SMALL_SYNTH_RADIO_CONFIG_BUFFER = 47
RAIL_ASSERT_CHANNEL_HOPPING_BUFFER_TOO_SHORT = 48
RAIL_ASSERT_INVALID_MODULE_ACTION = 49
RAIL_ASSERT_CHANNEL_HOPPING_INVALID_RADIO_CONFIG = 50
RAIL_ASSERT_CHANNEL_CHANGE_FAILED = 51
RAIL_ASSERT_INVALID_REGISTER = 52
RAIL_ASSERT_FAILED_LO_DIV_NULL_STATE = 53
RAIL_ASSERT_CACHE_CONFIG_FAILED = 54
RAIL_ASSERT_NULL_TRANSITIONS = 55
RAIL_ASSERT_BAD_LDMA_TRANSFER = 56
RAIL_ASSERT_INVALID_RTCC_SYNC_VALUES = 57
RAIL_ASSERT_SEQUENCER_FAULT = 58
RAIL_ASSERT_BUS_ERROR = 59
RAIL_ASSERT_INVALID_FILTERING_CONFIG = 60
RAIL_ASSERT_RETIMING_CONFIG = 61
RAIL_ASSERT_FAILED_TX_CRC_CONFIG = 62
RAIL_ASSERT_INVALID_PA_OPERATION = 63
RAIL_ASSERT_SEQ_INVALID_PA_SELECTED = 64
RAIL_ASSERT_FAILED_INVALID_CHANNEL_CONFIG = 65
RAIL_ASSERT_INVALID_DYNAMIC_FRAME_LENGTH = 66
RAIL_ASSERT_FAILED_EM1P_ENTRY = 67
RAIL_ASSERT_FAILED_EM1P_EXIT = 68
RAIL_ASSERT_FAILED_RTCC_SYNC_STOP = 69
RAIL_ASSERT_FAILED_MULTITIMER_CORRUPT = 70
RAIL_ASSERT_FAILED_TEMPCAL_ERROR = 71
RAIL_ASSERT_INVALID_EFF_CONFIGURATION = 72
RAIL_ASSERT_INVALID_RFFPLL_CONFIGURATION = 73
RAIL_ASSERT_SECURE_ACCESS_FAULT = 74
RAIL_ASSERT_FAILED_SYSRTC0_NOT_RUNNING = 75
RAIL_ASSERT_RADIO_CONFIG_NOT_UP_TO_DATE = 76
RAIL_ASSERT_FAILED_RSSI_THRESHOLD = 77
RAIL_ASSERT_INCORRECT_ZWAVE_REGION = 78
RAIL_ASSERT_FAILED_RTCC_SYNC_STALE_DATA = 79
RAIL_ASSERT_INVALID_LOG2X4_CLEAR_CONDITION = 80
RAIL_ASSERT_FAILED_DMA_WRITE_INCOMPLETE = 81
}

Enumeration of all possible error codes from RAIL_ASSERT.

Functions#

void
RAILCb_AssertFailed(RAIL_Handle_t railHandle, RAIL_AssertErrorCodes_t errorCode)

Callback called upon failed assertion.

Macros#

#define

Use this define to create an array of error messages that map to the codes in RAIL_AssertErrorCodes_t.

Enumeration Documentation#

RAIL_AssertErrorCodes_t#

RAIL_AssertErrorCodes_t

Enumeration of all possible error codes from RAIL_ASSERT.

Enumerator
RAIL_ASSERT_FAILED_APPENDED_INFO_MISSING

Appended info missing from Rx packet.

RAIL_ASSERT_FAILED_RX_FIFO_BYTES

Receive FIFO too small for IR calibration.

RAIL_ASSERT_FAILED_RX_FIFO_ZERO_BYTES_READ

Error reading back packet payload.

RAIL_ASSERT_FAILED_ILLEGAL_RXLEN_ENTRY_STATUS

Receive fifo entry has invalid status.

RAIL_ASSERT_FAILED_BAD_PACKET_LENGTH

Receive fifo entry bad packet length.

RAIL_ASSERT_FAILED_SYNTH_DIVCTRL_ENUM_CONVERSION_ERROR

Unable to configure radio for IR calibration.

RAIL_ASSERT_FAILED_UNEXPECTED_STATE_RX_FIFO

Reached unexpected state while handling Rx fifo events.

RAIL_ASSERT_FAILED_UNEXPECTED_STATE_RXLEN_FIFO

Reached unexpected state while handling RXLEN fifo events.

RAIL_ASSERT_FAILED_UNEXPECTED_STATE_TX_FIFO

Reached unexpected state while handling Tx fifo events.

RAIL_ASSERT_FAILED_UNEXPECTED_STATE_TXACK_FIFO

Reached unexpected state while handling Tx ACK fifo events.

RAIL_ASSERT_FAILED_PBUFFER_NOT_DEFINED

No memory to store receive packet.

RAIL_ASSERT_FAILED_INSUFFICIENT_BYTES_IN_RX_PACKET

Packet length longer than the receive FIFO size.

RAIL_ASSERT_FAILED_CLOCK_PRESCALER

Invalid radio clock prescaler.

RAIL_ASSERT_FAILED_RTCC_POST_WAKEUP

Error synchronizing the RAIL timebase after sleep.

RAIL_ASSERT_FAILED_SYNTH_VCO_FREQUENCY

VCO frequency outside supported range.

RAIL_ASSERT_FAILED_RAC_STATE

Radio active while changing channels.

RAIL_ASSERT_FAILED_SYNTH_INVALID_VCOCTRL

Invalid Synth VCOCTRL field calculation.

RAIL_ASSERT_FAILED_NESTED_SEQUENCER_LOCK

Nested attempt to lock the sequencer.

RAIL_ASSERT_FAILED_RSSI_AVERAGE_DONE

RSSI averaging enabled without a valid callback.

RAIL_ASSERT_FAILED_DFL_BITS_SIZE

Invalid dynamic frame length setting provided (dflBits).

RAIL_ASSERT_FAILED_PROTIMER_RANDOM_SEED

Unable to seed radio pseudo random number generator.

RAIL_ASSERT_FAILED_EFR32XG1_REGISTER_SIZE

Timeout exceeds EFR32XG1 register size.

RAIL_ASSERT_FAILED_PROTIMER_CHANNEL

Invalid timer channel specified.

RAIL_ASSERT_FAILED_TIMER_REQUIRES_WRAP

Timer value larger than RAIL timebase.

RAIL_ASSERT_FAILED_BASECNTTOP

LBT config exceeds EFR32XG1 register size.

RAIL_ASSERT_FAILED_DEPRECATED_LBTRETRY
RAIL_ASSERT_FAILED_RTCC_SYNC_MISSED

Could not synchronize RAIL timebase with the RTC.

RAIL_ASSERT_FAILED_CLOCK_SOURCE_NOT_READY

Clock source not ready.

RAIL_ASSERT_FAILED_TIMINGS_INVALID

Attempted to set RAIL timings to invalid value.

RAIL_ASSERT_NULL_HANDLE

NULL was supplied as a RAIL_Handle_t argument.

RAIL_ASSERT_FAILED_SCHED_TIMER_NOT_RUNNING

Scheduled timer not running.

RAIL_ASSERT_FAILED_NO_ACTIVE_CONFIG

API improperly called while protocol inactive.

RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SWITCH

No active handle after switch.

RAIL_ASSERT_FAILED_RESERVED33

Reserved for future use.

RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SCHEDRX

No active handle for scheduled rx.

RAIL_ASSERT_FAILED_INVALID_HANDLE_SCHEDTX

Invalid handle for scheduled tx.

RAIL_ASSERT_FAILED_INACTIVE_HANDLE_SCHEDTX

Inactive handle for scheduled tx.

RAIL_ASSERT_FAILED_CONFIG_INDEX_INVALID

Invalid config index to switch to.

RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SINGLEPROTOCOL

No active handle for single protocol.

RAIL_ASSERT_DEPRECATED_FUNCTION

This function is deprecated and must not be called.

RAIL_ASSERT_MULTIPROTOCOL_NO_EVENT

Multiprotocol task started with no event to run.

RAIL_ASSERT_FAILED_INVALID_INTERRUPT_ENABLED

Invalid interrupt enabled.

RAIL_ASSERT_CONVERSION_CURVES_NOT_INITIALIZED

Power conversion functions called before curves were initialized.

RAIL_ASSERT_DIVISION_BY_ZERO

Division by zero.

RAIL_ASSERT_CANT_USE_HARDWARE

Function cannot be called without access to the hardware.

RAIL_ASSERT_NULL_PARAMETER

Pointer parameter was passed as NULL.

RAIL_ASSERT_INVALID_TASK_TYPE

Invalid task type passed to RAIL_SetTaskPriority.

RAIL_ASSERT_SMALL_SYNTH_RADIO_CONFIG_BUFFER

Synth radio config buffer for channel hopping too small.

RAIL_ASSERT_CHANNEL_HOPPING_BUFFER_TOO_SHORT

Buffer provided for RX Channel Hopping is too small.

RAIL_ASSERT_INVALID_MODULE_ACTION

Invalid action was attempted on a module.

RAIL_ASSERT_CHANNEL_HOPPING_INVALID_RADIO_CONFIG

The radio config for this channel is not compatible with channel hopping.

RAIL_ASSERT_CHANNEL_CHANGE_FAILED

Channel change failed.

RAIL_ASSERT_INVALID_REGISTER

Attempted to read invalid register.

RAIL_ASSERT_FAILED_LO_DIV_NULL_STATE

Can't read register value from NULL state.

RAIL_ASSERT_CACHE_CONFIG_FAILED

DMP radio config caching failed.

RAIL_ASSERT_NULL_TRANSITIONS

NULL was supplied as a RAIL_StateTransitions_t argument.

RAIL_ASSERT_BAD_LDMA_TRANSFER

LDMA transfer failed.

RAIL_ASSERT_INVALID_RTCC_SYNC_VALUES

Attempted to wake up with invalid RTCC sync data.

RAIL_ASSERT_SEQUENCER_FAULT

Radio sequencer hit a fault condition.

RAIL_ASSERT_BUS_ERROR

Bus fault.

RAIL_ASSERT_INVALID_FILTERING_CONFIG

The current radio config cannot be used with packet filtering.

RAIL_ASSERT_RETIMING_CONFIG

Retiming configuration error.

RAIL_ASSERT_FAILED_TX_CRC_CONFIG

TX CRC configuration is corrupt.

RAIL_ASSERT_INVALID_PA_OPERATION

The current PA config does not allow for this operation.

RAIL_ASSERT_SEQ_INVALID_PA_SELECTED

The sequencer selected an invalid PA.

RAIL_ASSERT_FAILED_INVALID_CHANNEL_CONFIG

Invalid/unsupported channel config.

RAIL_ASSERT_INVALID_DYNAMIC_FRAME_LENGTH

The dynamic frame length configuration is invalid.

RAIL_ASSERT_FAILED_EM1P_ENTRY

Failed to enable EM1P energy mode.

RAIL_ASSERT_FAILED_EM1P_EXIT

Failed to disable EM1P energy mode.

RAIL_ASSERT_FAILED_RTCC_SYNC_STOP

Failed to disable RTCC synchronization.

RAIL_ASSERT_FAILED_MULTITIMER_CORRUPT

Multitimer linked list corrupted.

RAIL_ASSERT_FAILED_TEMPCAL_ERROR

Unable to configure radio for temperature calibration.

RAIL_ASSERT_INVALID_EFF_CONFIGURATION

Invalid EFF configuration.

RAIL_ASSERT_INVALID_RFFPLL_CONFIGURATION

Invalid RFFPLL configuration.

RAIL_ASSERT_SECURE_ACCESS_FAULT

Secure access fault.

RAIL_ASSERT_FAILED_SYSRTC0_NOT_RUNNING

SYSRTC0 not running.

RAIL_ASSERT_RADIO_CONFIG_NOT_UP_TO_DATE

Radio Configurator not updated.

RAIL_ASSERT_FAILED_RSSI_THRESHOLD

Failed to set the event for configurable RSSI threshold.

RAIL_ASSERT_INCORRECT_ZWAVE_REGION

Intended and actual Z-Wave region configuration mismatch.

RAIL_ASSERT_FAILED_RTCC_SYNC_STALE_DATA

Attempted to sleep with stale RTCC synchronization data.

RAIL_ASSERT_INVALID_LOG2X4_CLEAR_CONDITION

Attempted to clear LOG2X4 with a DEC1 value not equal to 0.

RAIL_ASSERT_FAILED_DMA_WRITE_INCOMPLETE

Failed to complete DMA write.


Definition at line 51 of file common/rail_assert_error_codes.h

Function Documentation#

RAILCb_AssertFailed#

void RAILCb_AssertFailed (RAIL_Handle_t railHandle, RAIL_AssertErrorCodes_t errorCode)

Callback called upon failed assertion.

Parameters
[in]railHandle

A RAIL instance handle.

[in]errorCode

Value passed in by the calling assertion API indicating the RAIL error that is indicated by the failing assertion.


Definition at line 6080 of file common/rail.h

Macro Definition Documentation#

RAIL_ASSERT_ERROR_MESSAGES#

#define RAIL_ASSERT_ERROR_MESSAGES

Use this define to create an array of error messages that map to the codes in RAIL_AssertErrorCodes_t.

You can use these to print slightly more detailed error strings related to a particular assert error code if desired. For example, you could implement your assert failed callback as follows to make use of this.

void RAILCb_AssertFailed(RAIL_Handle_t railHandle, uint32_t errorCode)
{
  static const char* railErrorMessages[] = RAIL_ASSERT_ERROR_MESSAGES;
  const char *errorMessage = "Unknown";

  // If this error code is within the range of known error messages then use
  // the appropriate error message.
  if (errorCode < (sizeof(railErrorMessages) / sizeof(char*))) {
    errorMessage = railErrorMessages[errorCode];
  }
  printf(errorMessage);

  // Reset the chip since an assert is a fatal error
  NVIC_SystemReset();
}

Definition at line 328 of file common/rail_assert_error_codes.h