System Real-Time Clock (SYSRTC) Debugging and Error Handling#

Debugging and Error Handling#

This guide explains how to debug and handle errors when working with the System Real-Time Clock (SYSRTC) driver on SiWx917. It provides step-by-step troubleshooting tips, recommended tools, and standardized error codes so you can quickly identify and resolve issues during development and testing.

Common Debugging Tips#

When debugging SYSRTC-related issues, start with the fundamentals before moving into deeper hardware or software analysis.

For detailed information about debugging, see the WiseConnect Debugging Guide.

Debugging SYSRTC Operations#

Debugging SYSRTC operations requires a structured approach. Begin by checking basic hardware connections, then verify signal behavior with measurement tools, and finally confirm proper software configuration in Simplicity Studio.

1. Visual Inspection and Connection Checklist#

Perform configuration check to ensure that SYSRTC is set up correctly:

  • Confirm the SYSRTC clock source is configured and enabled.

  • Verify alarm and compare configurations in the Pin Tool.

  • Check interrupt routing and Nested Vectored Interrupt Controller (NVIC) settings.

  • Ensure voltage levels are stable on all SYSRTC-related general-purpose input/output (GPIO) pins.

  • Verify power domain settings if SYSRTC events are not triggering.

2. Interfacing with SiWx917 Development Kits (SYSRTC Signal Setup)#

When testing SYSRTC outputs or event signals on SiWx917 development kits, connect the board to external measurement tools and verify signals on the designated GPIOs.

Setup Steps:

  1. Build, flash, and debug your firmware with Simplicity Studio.

  2. Configure GPIOs for SYSRTC compare/alarm outputs (and capture inputs if used).

  3. Connect the selected GPIO pin(s) to an oscilloscope or logic analyzer.

  4. Ensure the development kit and test equipment share a common ground.

  5. Verify the waveform timing and event relationships on the analyzer/scope.

Tips:

  • Label the test points (for example, SYSRTC_COMPARE0_OUT) to avoid confusion.

  • Use short ground leads and appropriate probe bandwidth to reduce ringing.

  • If edges look degraded, check drive strength and pin-mux settings in your project configuration.

Example Setup Diagram:

SYSRTC setup diagramSYSRTC setup diagram

3. Using a Logic Analyzer or Oscilloscope for Debugging#

A logic analyzer (LA) or oscilloscope gives you direct visibility into SYSRTC signal behavior.

Connect and Capture#

  • Probe the right pins: Attach probes to SYSRTC compare/alarm outputs (or other routed GPIOs).

  • Set thresholds/sample rate: Use the correct voltage threshold for your I/O rail (for example, 1.8 V or 3.3 V) and a sample rate ≥10× the expected toggle rate.

  • Trigger on events: Trigger on rising/falling edges during alarm, compare, or overflow events to capture the full timing sequence.

  • Measure timing: Check period, pulse width, duty cycle, and inter-event spacing to verify correctness.

What to Verify#

  • Event occurrence: Alarms or compare events occur at the expected times.

  • Interrupt behavior (if routed): Interrupt line/pin asserts/deasserts as configured.

  • Multi-event alignment: Timing relationships between multiple SYSRTC events (for example, Group 0 and Group 1) match your configuration.

Example Demonstration

The following behaviors illustrate typical SYSRTC configurations (as implemented in the demo firmware):

  • Compare channels enabled: LED1 toggles ten times per second. After the configured count completes, the timer stops—verifying repeated compare events and proper halting.

  • Capture channel enabled: LED1 toggles once after one second, showing a single event driven by the capture configuration in the example.

  • No channels enabled (overflow interrupt active): LED1 toggles once when the counter overflows, confirming overflow interrupt handling without compare or capture channels.

Tip: If edges look rounded or noisy on the scope/LA, shorten ground leads, reduce probe capacitance, and confirm the pin’s drive-strength setting in your project configuration.

4. Debugging SYSRTC with Simplicity Studio and a Logic Analyzer#

Simplicity Studio lets you correlate SYSRTC firmware activity with real signals on your board.

  1. Open Simplicity Studio and switch to the Debug perspective.

  2. Build and flash your firmware to the SiWx917 development kit.

  3. Connect a logic analyzer (or oscilloscope) to the GPIO pins carrying SYSRTC compare/alarm (and capture, if used).

  4. Use the analyzer’s software (or Studio plug-in, if available) to visualize edges and timing.

  5. Set breakpoints in SYSRTC interrupt/callback code to correlate code execution with captured events.

  6. In the Debug view, inspect SYSRTC registers/variables to confirm runtime configuration and status (compare/capture flags, counter, group enables).

  7. Iterate: adjust configuration, reflash quickly, and re-measure timing until waveforms meet requirements.

Tip: Save analyzer traces with timestamps alongside your debugger session notes. This makes regressions easy to spot after configuration changes.

Error Code Handling#

SYSRTC APIs return standardized sl_status_t codes to indicate success or failure. Use these to detect misconfiguration, invalid values, or missing initialization.

Return value

Description (SYSRTC context)

SL_STATUS_OK

Operation completed successfully

SL_STATUS_INVALID_PARAMETER

One or more arguments are invalid (for example, null pointer, unsupported channel/group, bad flags)

SL_STATUS_NOT_INITIALIZED

Driver/peripheral not initialized or clock domain not enabled

SL_STATUS_INVALID_RANGE

Value out of range (for example, compare value, prescaler/divider, or period beyond allowed limits)

SL_STATUS_INVALID_COUNT

Invalid count-related value (for example, zero/negative repeats, length, or index)

SL_STATUS_FAIL

General failure or unspecified error

If the SYSRTC peripheral enters an undefined or error state (for example, due to misconfiguration or clock issues), perform a clean reinit:

sl_si91x_sysrtc_deinit();
sl_si91x_sysrtc_init();