Skip to main content

Robot Framework Library for RZ-SBC I2C communication with optimized imports

Project description

Robot Framework RZ-SBC I2C Library

PyPI version License: MIT

Robot Framework library for RZ-SBC I2C communication with dynamic board configuration support for Renesas RZ-SBC systems.

Features

  • Dynamic Board Configuration: Automatically loads I2C settings based on board type
  • Serial Integration: Works with serial connections for remote I2C operations
  • Configuration Management: Uses YAML-based configuration files for different board types
  • Comprehensive I2C Operations: Supports device detection, scanning, and communication
  • Error Handling: Robust error handling and logging for debugging

Installation

pip install robotframework-rzsbc-i2c

Requirements

  • Robot Framework (>=3.2.2)
  • pyserial (>=3.5)
  • pyyaml (>=5.4.0)

Quick Start

*** Settings ***
Library    robotframework_rzsbc_i2c.I2CLibrary.I2CLibrary

*** Test Cases ***
Test I2C Communication
    Init I2C Library    ${serial_connection}    RZ_SBC_Board
    Set I2C Parameters    i2c_bus=1    expected_addr=0x48
    Detect I2C Adapter
    ${devices}=    Scan I2C Device    1
    Log    Found devices: ${devices}

Keywords

Initialization and Configuration

  • Init I2C Library - Initialize the library with serial connection and board type
  • Set I2C Parameters - Configure I2C bus, addresses, and timing parameters

Device Operations

  • Detect I2C Adapter - Detect and validate I2C adapter presence
  • Scan I2C Device - Scan for devices on specified I2C bus
  • Verify I2C Address Present - Check if a specific device address is present
  • Get I2C Bus Address Pairs - Retrieve configured I2C bus/address pairs for board type

Board Configuration

The library uses YAML configuration files to define board-specific I2C settings:

boards:
    RZ_SBC_Board:
        images:
            linux_image:
                features:
                    i2c:
                        enabled: true
                        instances:
                            temp_sensor:
                                i2c_bus: 1
                                expected_addr: "0x48"
                            rtc:
                                i2c_bus: 1
                                expected_addr: "0x68"

Examples

Basic I2C Device Detection

*** Settings ***
Library    robotframework_rzsbc_i2c.I2CLibrary.I2CLibrary

*** Test Cases ***
Detect I2C Devices
    Init I2C Library    ${SERIAL}    RZ_SBC_Board
    Detect I2C Adapter    delay=2

    ${pairs}=    Get I2C Bus Address Pairs    RZ_SBC_Board
    FOR    ${bus}    ${addr}    IN    @{pairs}
        ${present}=    Verify I2C Address Present    ${bus}    ${addr}
        Should Be True    ${present}    Device ${addr} not found on bus ${bus}
    END

Advanced I2C Scanning

*** Settings ***
Library    robotframework_rzsbc_i2c.I2CLibrary.I2CLibrary

*** Test Cases ***
Comprehensive I2C Test
    Init I2C Library    ${SERIAL}    RZ_SBC_Board
    Set I2C Parameters    retry_count=3    delay_between_commands=1

    # Scan multiple buses
    FOR    ${bus}    IN RANGE    0    3
        TRY
            ${devices}=    Scan I2C Device    ${bus}    delay=2
            Log    Bus ${bus} devices: ${devices}
        EXCEPT
            Log    Bus ${bus} not available or no devices found
        END
    END

Board-Specific Configuration

*** Settings ***
Library    robotframework_rzsbc_i2c.I2CLibrary.I2CLibrary

*** Test Cases ***
Test Multiple Board Types
    @{board_types}=    Create List    RZ_SBC_Board    RZ_G2L_Board    RZ_V2L_Board

    FOR    ${board}    IN    @{board_types}
        TRY
            Init I2C Library    ${SERIAL}    ${board}
            ${pairs}=    Get I2C Bus Address Pairs    ${board}
            Log    ${board} I2C configuration: ${pairs}
        EXCEPT    AS    ${error}
            Log    Board ${board} not configured: ${error}
        END
    END

Configuration File Structure

The library expects a config.yml file with the following structure:

boards:
    BOARD_TYPE:
        images:
            IMAGE_NAME:
                features:
                    i2c:
                        enabled: true/false
                        instances:
                            INSTANCE_NAME:
                                i2c_bus: BUS_NUMBER
                                expected_addr: "DEVICE_ADDRESS"

Error Handling

The library provides comprehensive error handling:

  • Missing Configuration: Graceful handling when board configs are not found
  • Serial Communication: Robust serial connection error handling
  • I2C Hardware: Proper error reporting for I2C hardware issues
  • Device Detection: Clear feedback when devices are not present

Supported Platforms

  • Renesas RZ-SBC systems
  • Any Linux system with I2C support
  • Remote systems via serial connection

Hardware Requirements

  • I2C-enabled system or board
  • Serial connection for remote operations
  • Proper I2C device permissions

Troubleshooting

Common Issues

  1. Import Errors: Ensure all dependencies are installed
  2. Permission Denied: Check I2C device permissions (/dev/i2c-*)
  3. Configuration Not Found: Verify config.yml file location and format
  4. Serial Connection: Ensure proper serial connection and baud rate

Debug Mode

Enable detailed logging by setting the Robot Framework log level:

*** Settings ***
Library    robotframework_rzsbc_i2c.I2CLibrary.I2CLibrary    WITH NAME    I2C

License

MIT License. See LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please use the GitHub issue tracker.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework_rzsbc_i2c-1.0.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotframework_rzsbc_i2c-1.0.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_rzsbc_i2c-1.0.1.tar.gz.

File metadata

  • Download URL: robotframework_rzsbc_i2c-1.0.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for robotframework_rzsbc_i2c-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b5969858fb893055596960c2e1ccefa257ddbf886adccebf0683bd934f390c1a
MD5 9ae1b1a630368b461488eeaea25c5aef
BLAKE2b-256 57bd7cef17afcebaa48a188b68db3c54140665360066b95dec6f2e5d6ecc0d59

See more details on using hashes here.

File details

Details for the file robotframework_rzsbc_i2c-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_rzsbc_i2c-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5fd20c273dfab18261e4e0ec6a94951faebcf46f7739b3db80b01bb8c5d558fb
MD5 bd6be54654d16ccb896afb8c97be1262
BLAKE2b-256 54dcf159afab3b3c0d88f35903079c49185dd2b17bf33f718d2b9128f67682d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page