no-OS
Loading...
Searching...
No Matches
basic_example.h File Reference

Basic example header for LTC4284 project. More...

Functions

int basic_example_main (void)
 basic example main execution.
 

Detailed Description

Basic example header for LTC4284 project.

Author
Carlos Jones Jr carlo.nosp@m.sjr..nosp@m.jones.nosp@m.@ana.nosp@m.log.c.nosp@m.om
Christopher de Guzman chris.nosp@m.toph.nosp@m.er.de.nosp@m.guzm.nosp@m.an@an.nosp@m.alog.nosp@m..com

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Function Documentation

◆ basic_example_main()

int basic_example_main ( )

basic example main execution.

Returns
ret - Result of the example execution. If working correctly, will execute print the sample data.

basic example main execution.

Returns
ret - Result of the example execution. If working correctly, will execute continuously function basic_app_run and will not return.

basic example main execution.

Returns
ret - Result of the example execution. If working correctly, will execute continuously the while(1) loop and will not return.
ret - Result of the example execution. If working correctly, will execute print the sample data.

basic example main execution.

Returns
ret - Result of the example execution. If working correctly, will execute continuously function basic_app_run and will not return.

basic example main execution.

Returns
ret - Result of the example execution. If working correctly, will execute continuously the while(1) loop and will not return.

basic example main execution.

Demonstrates a full IO-Link communication cycle without an IO-Link stack:

  1. STARTUP - establish communication, read device identity from DPP
  2. PREOPERATE - read ISDU parameters (vendor name, serial number, etc.)
  3. OPERATE - exchange cyclic process data
Returns
0 on success, negative error code otherwise.

basic example main execution.

Returns
ret - Result of the example execution.

basic example main execution.

Initialises the UART peripheral, prints a banner, then loops forever printing a counter message once per second.

Returns
0 on success, negative error code on failure.

basic example main execution.

SAFETY FEATURES DEMONSTRATED:

  1. Current Limit Verification
    • Validates V_ILIM register matches configuration
    • Checks maximum current is within hardware limits
    • Prevents operation with dangerous current limits
  2. Limited Fault Retry
    • Uses 1 retry for transient faults (not unlimited)
    • Prevents thermal cycling on persistent faults
    • Software tracking limits retries to 3 attempts
  3. Selective Fault Clearing
    • Hardware faults (FET_BAD, FET_SHORT) -> latch off permanently
    • Transient faults (OC, UV, OV) -> limited retry only
    • Never auto-retry hardware damage conditions
  4. FET Status Validation
    • Checks SYSTEM_STATUS before reading VOUT
    • Prevents floating ADC pin readings (82V bug)
    • Reports FET state clearly to user
  5. Power Cross-Validation
    • Compares chip power register to V×I calculation
    • Detects configuration errors (dividers, RSENSE)
    • Warns on >10% discrepancy
  6. Timeout Protection
    • 1-hour monitoring limit (not infinite loop)
    • Exits cleanly on I2C errors
    • Suitable for production deployment
  7. Clear Safety Messaging
    • Explains why faults are critical
    • Guides user on required actions
    • Prevents dangerous auto-recovery

IMPORTANT FOR PRODUCTION ADAPTATION:

  • DO NOT increase retry limits without understanding risks
  • DO NOT clear FET_BAD or FET_SHORT faults automatically
  • DO verify current limit before enabling FETs
  • DO implement watchdog timer for production systems
  • DO add energy overflow detection for billing systems
Returns
0 on success, negative error code on failure