Implement VND7050AJ supply voltage reading function
- Added devicetree overlay for VND7050AJ with GPIO and ADC configuration - Created custom devicetree binding for VND7050AJ valve controller - Implemented valve_get_supply_voltage() function with proper pin control: - RST=HIGH to enable VND7050AJ - S0=1, S1=1 for supply voltage sensing mode - SEN=1 to enable MULTISENSE output - ADC reading on PA0 (ADC1_IN1) with 12-bit resolution - Fixed supply voltage calculation (VCC/8 per datasheet) - Added comprehensive debug logging for all steps - Tested and verified ADC functionality - Current reading: 5.1V (may be limited by hardware power supply) Files modified: - software/lib/valve/valve.c: Main implementation - software/apps/slave_node/boards/weact_stm32g431_core.overlay: DT config - software/apps/slave_node/dts/bindings/vnd7050aj-valve-controller.yaml: DT binding - software/apps/slave_node/src/main.c: Test code - software/apps/slave_node/prj.conf: ADC driver enablement
This commit is contained in:
55
software/serial_reset_monitor.py
Normal file
55
software/serial_reset_monitor.py
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
import serial
|
||||
import time
|
||||
import sys
|
||||
|
||||
def monitor_serial_with_reset():
|
||||
try:
|
||||
# Open serial port
|
||||
ser = serial.Serial('/dev/ttyACM3', 115200, timeout=1)
|
||||
print("Serial port opened successfully")
|
||||
|
||||
# Clear any existing data
|
||||
ser.flushInput()
|
||||
ser.flushOutput()
|
||||
|
||||
# Send reset command
|
||||
print("Sending reset command...")
|
||||
ser.write(b"reset\n")
|
||||
time.sleep(0.1)
|
||||
|
||||
# Read output for 10 seconds
|
||||
print("Reading serial output...")
|
||||
start_time = time.time()
|
||||
output_lines = []
|
||||
|
||||
while time.time() - start_time < 10:
|
||||
if ser.in_waiting > 0:
|
||||
try:
|
||||
line = ser.readline().decode('utf-8', errors='replace').strip()
|
||||
if line:
|
||||
print(f"[{time.time() - start_time:.3f}s] {line}")
|
||||
output_lines.append(line)
|
||||
except Exception as e:
|
||||
print(f"Error reading line: {e}")
|
||||
time.sleep(0.01)
|
||||
|
||||
ser.close()
|
||||
print("\nSerial monitoring complete")
|
||||
|
||||
# Summary
|
||||
print("\n=== SUMMARY ===")
|
||||
supply_voltage_lines = [line for line in output_lines if "Supply voltage" in line]
|
||||
if supply_voltage_lines:
|
||||
print("Supply voltage readings:")
|
||||
for line in supply_voltage_lines:
|
||||
print(f" {line}")
|
||||
else:
|
||||
print("No supply voltage readings found")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
monitor_serial_with_reset()
|
||||
Reference in New Issue
Block a user