High-performance AWS Greengrass v2 component for industrial GPIO control using Fintek F81866 DIO chips with real-time data acquisition capabilities for the imPHM platform.
- imPHM AWS Greengrass GPIO DIOFintekF8196xF8186x Component
The imPHM GPIO DIOFintekF8196xF8186x component is a high-performance AWS Greengrass v2 component designed for industrial GPIO control using Fintek F81866 DIO chips. It provides real-time digital input/output control, advanced signal processing, and seamless integration with AWS IoT Device Shadow for remote configuration management on iBase AGS103T devices.
- High-Speed GPIO Control: Real-time digital I/O operations with minimal latency
- Multi-Channel Support: Simultaneous control of multiple GPIO channels (GPIO_0 to GPIO_3)
- AWS Integration: Native AWS IoT Device Shadow integration for remote configuration
- Real-time Data Acquisition: Configurable sampling rates up to 100 Hz
- Robust Architecture: Event-driven design with comprehensive error handling
- Industrial Grade: Designed for 24/7 operation in harsh industrial environments
- Digital I/O Control: Support for digital input and output operations
- Multi-Channel: Simultaneous control of up to 4 GPIO channels
- Configurable Sampling: Software-controlled sampling rates (1-100 Hz)
- Real-Time Processing: Low-latency GPIO state monitoring and control
- Data Buffering: Circular buffering with configurable publish intervals
- Fintek F81866: Direct support for F81866 DIO chip
- iBase AGS103T: Optimized for iBase AGS103T industrial computers
- GPIO Channels: 4 configurable digital I/O channels
- Signal Types: TTL digital signals (0V/3.3V or 0V/5V)
- Isolation: Industrial-grade signal isolation support
- Device Shadow: Remote configuration via AWS IoT Device Shadow
- IPC Communication: Native Greengrass IPC for data streaming
- Status Reporting: Real-time status and health monitoring
- Configuration Management: Dynamic configuration updates without restart
- Configurable Sampling: Adjustable sampling rates (1-100 Hz)
- Data Validation: GPIO state validation and error detection
- Timestamp Precision: High-precision timestamping for data correlation
- Provenance Tracking: Complete data lineage tracking
┌─────────────────┐ ┌───────────────────┐ ┌─────────────────┐
│ Fintek F81866 │───▶│ GPIO Component │───▶│ Data Consumer │
│ DIO Hardware │ │ (Acquisition) │ │ (Output) │
└─────────────────┘ └───────────────────┘ └─────────────────┘
│
┌─────────────────┐
│ Device Shadow │
│ (Configuration)│
└─────────────────┘
-
DIO Module (
src/lib/dio_module.py)- Fintek F81866 driver interface and hardware abstraction
- GPIO direction configuration (input/output)
- Real-time GPIO state reading and writing
- Permission management and initialization
- Signal conditioning and processing
-
Shadow Manager (
src/shadow_manager.py)- AWS IoT Device Shadow integration for configuration management
- Real-time configuration updates and synchronization
- Status reporting and health monitoring
- Secure configuration validation and delta processing
-
Main Service (
src/main.py)- Component lifecycle management and orchestration
- IPC communication setup and data streaming
- Signal handling and graceful shutdown
- Performance monitoring and logging
- Hardware Initialization: Configure F81866 chip and GPIO channels
- Configuration Management: Receive configuration from device shadow
- Data Acquisition: Continuous GPIO state sampling at configured rate
- Data Processing: Buffer and batch GPIO state data
- Data Streaming: Publish processed data via Greengrass IPC
- Status Monitoring: Report acquisition status to device shadow
- iBase AGS103T Device: Industrial computer with Fintek F8196x-F8186x DIO chip
- Processor: x86_64 architecture (Intel/AMD)
- Memory: Minimum 1GB RAM (2GB+ recommended for optimal performance)
- Storage: Sufficient space for logs and temporary buffers
- GPIO Interface: Direct access to F81866 DIO chip
- Operating System: Linux amd64 (tested on Ubuntu 20.04+ LTS)
- Python: 3.10 or higher
- Fintek F81866 Driver: Compatible driver library (libf81866.so)
- AWS Greengrass Core: Nucleus Classic v2.15.0 or higher
- Root Privileges: Required for GPIO hardware access
- iBase AGS103T: Industrial computer series with Fintek DIO
- Fintek F81866: Digital I/O controller chip
The component includes a pre-compiled driver library (libf81866.so) that provides low-level access to the F81866 DIO chip. This library handles:
- Chip initialization and configuration
- Register read/write operations
- GPIO direction control
- I/O permission management
Verify your hardware compatibility:
# Check system architecture
uname -a
# Verify F81866 chip presence (requires root)
sudo lspci | grep -i fintekThe component requires root privileges to access GPIO hardware:
- I/O Port Access: Direct access to hardware I/O ports
- Memory Mapping: Low-level hardware register access
- Kernel Modules: Loading required kernel drivers
# Set I/O permissions (handled automatically by component)
sudo iopl 3
# Verify GPIO device access
ls -la /dev/gpio*# Clone the repository
git clone <repository-url>
cd <repository-name>
# Setup development environment
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 -m pip install -U git+https://github.com/aws-greengrass/aws-greengrass-gdk-cli.git@v1.6.2# Deploy locally (for dev & testing)
./local_deploy.sh
# Remove local deployment
./remove_local_deploy.sh# Build component package
gdk component buildgdk component publishsudo /greengrass/v2/bin/greengrass-cli pubsub sub -t /TOPIC_NAME/Where
TOPIC_NAMEis the name of the topic you want to subscribe to.
Branch model (left to right = promotion path): feature branch → dev → staging → main
Environments and version patterns:
- feature branches: isolated feature / fix work (no version tagging)
- dev: integration / active development (pre-release versions vX.Y.Z-alpha.N)
- staging: pre-production verification (pre-release versions vX.Y.Z-beta.N)
- main: production (stable releases vX.Y.Z)
Rules:
- Only merge into dev via PR from feature branches
- staging only receives squash merges from dev
- main only receives fast-forward or squash from staging (no direct commits)
- Hotfix (critical) may branch from main, then merge back to staging and dev
semantic-release (single source of truth) runs on push to dev, staging, main:
- Analyze commits (Conventional Commits) to determine version bump:
- BREAKING CHANGE: / feat! → major
- feat: → minor
- fix / perf / refactor: → patch
- Other types (docs, chore, ci, style, test) → no version bump
- Prepare phase writes the computed version to:
- gdk-config.json (component version)
- recipe.yaml (ComponentVersion)
- Generate changelog + Git tag:
- dev → vX.Y.Z-alpha.N
- staging → vX.Y.Z-beta.N
- main → vX.Y.Z
- Create GitHub Release / Pre-release with artifacts
- Build & publish to AWS Greengrass ONLY for staging and main
- No separate version-bump workflow; remove any legacy bumps
ci.yml (runs on every PR and push):
- Formatting / style: black, isort, flake8
- (Soft) typing: mypy (non-blocking initially)
- JSON / YAML schema & syntax validation
- Greengrass component structure & recipe consistency checks
- (Soft) security & secret scanning (upgradeable to blocking later)
- Fails fast on critical structural or syntax errors
Format: [optional scope]:
[optional body]
[optional footer(s)]
Common types:
- feat: new feature (triggers minor)
- fix: bug fix (patch)
- perf: performance improvement (patch)
- refactor: code change w/o behavior change (patch)
- docs, style, test, chore, ci: no version bump by default
Breaking changes:
- Use feat! / refactor! suffix OR
- Add footer: BREAKING CHANGE: explanation
Recommended workflow:
- Use squash merge
- Ensure PR title is a valid Conventional Commit (final squashed commit = PR title)
Examples: feat: add new sensor data filtering algorithm fix: resolve memory leak in data processing loop feat!: change API response format feat: change API response format BREAKING CHANGE: response changed from array to object
Automated (preferred):
- Develop on feature branch → open PR to dev
- Ensure commits / PR title comply with Conventional Commits
- Merge → semantic-release assigns pre-release (alpha) on dev
- Promote dev → staging → beta release (build + publish to Greengrass)
- Promote staging → main → stable release (build + publish)
Manual trigger (if needed):
- Go to Actions: "Release (semantic-release → build → publish)"
- Select target branch (dev / staging / main)
- Workflow auto-detects:
- dev: pre-release alpha (no publish to AWS)
- staging: pre-release beta (publish)
- main: stable (publish)
Safeguards:
- Never edit versions manually
- All version sources are derived; commit modified version files produced by workflow only
- Avoid tagging manually to prevent semantic-release drift
Operational Notes:
- alpha churn is expected; do not pin production to alpha/beta
- Consumers should pin only stable main releases unless testing
- Monitor release notes for BREAKING CHANGE sections
Copyright (c) 2025 imCloud Co., Ltd. All rights reserved.
This software is proprietary and confidential. Unauthorized copying, modification, distribution, or use of this software is strictly prohibited.