TIDUFK2 September   2026

 

  1.   1
  2.   Description
  3.   Resources
  4.   Features
  5.   Applications
  6.   6
  7. 1System Description
    1. 1.1 Terminology
    2. 1.2 Key System Specifications
  8. 2System Overview
    1. 2.1 Block Diagram
    2. 2.2 Design Considerations
      1. 2.2.1 Processing
      2. 2.2.2 Voltage and Current Sensing
        1. 2.2.2.1 Voltage Measurement
        2. 2.2.2.2 Current Measurement
      3. 2.2.3 Solenoid – Relay Driver
      4. 2.2.4 Temperature Measurement
    3. 2.3 Highlighted Products
      1. 2.3.1 CC2340R53
      2. 2.3.2 OPA2323
      3. 2.3.3 DRV8213
      4. 2.3.4 TMP236A2
  9. 3System Design Theory
    1. 3.1 Software Architecture
      1. 3.1.1 System Initialization
      2. 3.1.2 Sample Acquisition
      3. 3.1.3 Sample Processing and Task Prioritization
    2. 3.2 Circuit Breaker Functionality
      1. 3.2.1 Breaker State and Relay Control
      2. 3.2.2 Instantaneous Short-Circuit Trip
      3. 3.2.3 Inverse-Time Overload Trip
    3. 3.3 Electrical Metrology
    4. 3.4 Zigbee Connectivity
  10. 4Hardware, Software, Testing Requirements, and Test Results
    1. 4.1 Hardware Requirements
      1. 4.1.1 Hardware Connections and Test Points
    2. 4.2 Test Setup
      1. 4.2.1 Connecting the TIDA-011030 to the Metering Test Equipment
      2. 4.2.2 Power-Supply Options
      3. 4.2.3 Metrology Calibration
      4. 4.2.4 Test-Data Acquisition and Error Calculation
    3. 4.3 Test Results
      1. 4.3.1 Relay Control and Protection
        1. 4.3.1.1 Relay Pull-In and Holding PWM
        2. 4.3.1.2 Instantaneous Trip and Relay-Opening Latency
        3. 4.3.1.3 Inverse-Time Overload Trip
      2. 4.3.2 Metering
      3. 4.3.3 Real-Time Software Performance
      4. 4.3.4 Zigbee Functional Test
  11. 5Design and Documentation Support
    1. 5.1 Tools and Software
      1. 5.1.1 Tools
      2. 5.1.2 Software
    2. 5.2 Documentation Support
    3.     Trademarks
  12. 6About the Author

Sample Processing and Task Prioritization

FreeRTOS separates protection-critical sample processing from calibration and wireless communication. The application uses the execution contexts listed in Table 3-1.

Table 3-1 FreeRTOS Task Prioritization
Execution context Priority Period Main responsibility
ADC interrupt Hardware interrupt 125µs Read ADC sequence, evaluate window-comparator event, and buffer the sample pair
Protection task 6 1ms Process buffered samples, execute protection and Metrology calculations, control the relay, and service the watchdog
Optional calibration GUI task 2 5ms Service UART calibration commands during production or laboratory use
Zigbee task 1 Stack controlled Synchronize Zigbee attributes, process commissioning requests, and execute ZBOSS

The Protection task has the highest software priority and is activated periodically every 1ms using vTaskDelayUntil(). At an acquisition rate of 8kHz, approximately eight new current-and-voltage sample pairs are normally available during each task period. Temporary execution delays are absorbed by the 256-entry ring buffer, and all pending samples are processed in their original acquisition order.

At the beginning of every Protection-task execution, the current sample backlog and task start time are recorded for diagnostic purposes. The task then locks the shared Metrology data structure and drains the ring buffer. For each sample pair, the corrected ADC codes are converted into the fixed-point format expected by the Metrology library. The following operations are then executed:

  1. Metrology per-sample background processing
  2. Instantaneous-current evaluation
  3. Overload-current accumulation

After all pending samples have been processed, Breaker_service() handles pending local or Zigbee control commands and updates the relay-driver state machine. Metrology foreground calculations are executed only when the background processing indicates that a new measurement frame or mains cycle is available. These calculations produce RMS values, power, energy, frequency, phase, and the other reported quantities.

The resulting measurement and breaker state are copied into a coherent application snapshot. The short snapshot update is protected against interrupts so that the Zigbee task cannot observe a partially updated breaker or measurement state. Zigbee reads only this published snapshot and therefore does not need to lock the internal Metrology working data.

An optional lower-priority task services the UART calibration interface every 5ms. This interface is intended only for controlled production calibration and laboratory debugging and is not required during normal breaker operation. UART processing is bounded to 64 received bytes per service call and is skipped when the sample backlog exceeds 32 pairs. Access to the shared Metrology data is protected by a FreeRTOS mutex with priority inheritance, ensuring that calibration activity cannot indefinitely block the Protection task.

Because the Protection task has a higher priority, it can preempt Zigbee processing whenever its periodic execution becomes ready. Consequently, protection processing does not have to wait for a complete ZBOSS operation before it can continue.

After completing the protection-critical processing, the task services the watchdog. The watchdog is fed only if at least one sample pair was processed, no sample loss was detected, and the remaining backlog does not exceed 96 sample pairs. A sustained violation of these conditions prevents the watchdog from being fed and causes a system reset after the configured 50ms watchdog period.

The execution time and start interval of the Protection task are continuously monitored. A diagnostic deadline counter is incremented if either value exceeds 5ms. This threshold does not control task scheduling directly but provides a measurable indication that the protection timing budget has been violated. Task stack usage, maximum backlog, processed-sample count, and individual processing times are also retained as debugger-visible diagnostic values.

The hardware window-comparator path remains independent of this task scheduling. It can latch an over current-related trip directly from the ADC interrupt. Regular instantaneous-current and overload protection are executed by the Protection task using the buffered, gain-corrected current samples.