Robot Framework Library for RZ-SBC I2C communication with dynamic board configuration support
Project description
Robot Framework RZ-SBC I2C Library
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 typeSet I2C Parameters- Configure I2C bus, addresses, and timing parameters
Device Operations
Detect I2C Adapter- Detect and validate I2C adapter presenceScan I2C Device- Scan for devices on specified I2C busVerify I2C Address Present- Check if a specific device address is presentGet 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
- Import Errors: Ensure all dependencies are installed
- Permission Denied: Check I2C device permissions (
/dev/i2c-*) - Configuration Not Found: Verify
config.ymlfile location and format - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robotframework_rzsbc_i2c-1.0.0.tar.gz.
File metadata
- Download URL: robotframework_rzsbc_i2c-1.0.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebec013b97cc149128a7c84dc7fcb016e95f50039ba01dc3bf23a9de5ecb57be
|
|
| MD5 |
c6ef76ecd9c55658eb165e8355b08135
|
|
| BLAKE2b-256 |
9cfd06666dc7a5eefdc3a883041755a9a62276d5c2e1a9df620f3046bfbbf893
|
File details
Details for the file robotframework_rzsbc_i2c-1.0.0-py3-none-any.whl.
File metadata
- Download URL: robotframework_rzsbc_i2c-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c74a317dc183c749fc3cdc1c482a70cfd0649f31dc6b48d6426883b921aae8e4
|
|
| MD5 |
b55cd1b0e132ab6ee3fdc4ec803c9d65
|
|
| BLAKE2b-256 |
4c6cda94e13c54e09d2ba822416c53e3076ea4d90105989b6fb98e71c5b77efb
|