embeddedci-openhtf 2.3.0__tar.gz → 2.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/CHANGELOG.md +6 -0
  2. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/PKG-INFO +2 -2
  3. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/README.md +1 -1
  4. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/examples/analog_loopback.py +2 -2
  5. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/pyproject.toml +1 -1
  6. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/src/embeddedci_openhtf/analog.py +8 -7
  7. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/test_analog.py +6 -5
  8. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/test_e2e_openhtf.py +11 -0
  9. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/.gitignore +0 -0
  10. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/LICENSE +0 -0
  11. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/examples/flash_and_boot.py +0 -0
  12. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/examples/serial_smoke.py +0 -0
  13. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/examples/station.py +0 -0
  14. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/src/embeddedci_openhtf/__init__.py +0 -0
  15. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/src/embeddedci_openhtf/measurements.py +0 -0
  16. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/src/embeddedci_openhtf/phases.py +0 -0
  17. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/src/embeddedci_openhtf/pins.py +0 -0
  18. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/src/embeddedci_openhtf/plug.py +0 -0
  19. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/src/embeddedci_openhtf/power.py +0 -0
  20. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/_fake.py +0 -0
  21. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/conftest.py +0 -0
  22. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/test_docs_coverage.py +0 -0
  23. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/test_measurements.py +0 -0
  24. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/test_persistent.py +0 -0
  25. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/test_phases.py +0 -0
  26. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/test_pins.py +0 -0
  27. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/test_plug.py +0 -0
  28. {embeddedci_openhtf-2.3.0 → embeddedci_openhtf-2.3.1}/tests/test_power.py +0 -0
@@ -1,5 +1,11 @@
1
1
  # Changelog — `embeddedci-openhtf`
2
2
 
3
+ ## 2.3.1
4
+
5
+ - `signal_generate`, `signal_generate_phase` and `loopback_measure_phase` default to
6
+ `dac_path="3v3"` instead of `"5v"`; `dac_replay_phase` now defaults to the path stored with the
7
+ waveform, else `"3v3"`. Pass `dac_path="5v"` to keep the old output.
8
+
3
9
  ## 2.3.0
4
10
 
5
11
  - Needs `embeddedci` 2.12.0 or later (was 2.4), the SDK whose `usb` connection reaches the USB
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: embeddedci-openhtf
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: OpenHTF plug for driving an EmbeddedCI BenchPod directly over TCP or serial (no cloud)
5
5
  Project-URL: Homepage, https://embeddedci.com
6
6
  Project-URL: Repository, https://github.com/embeddedci-com/embeddedci-python
@@ -217,7 +217,7 @@ from embeddedci_openhtf import (
217
217
  bench = benchpod_plug("192.168.1.50:8080")
218
218
 
219
219
  test = htf.Test(
220
- # drive a 1 V-peak sine centred on 2.5 V (5V DAC path), capture the front ADC SMA
220
+ # drive a 1 V-peak sine centered on 2.5 V (5V DAC path), capture the front ADC SMA
221
221
  # while it runs, stop the DAC, and assert the round trip in volts
222
222
  loopback_measure_phase(bench, waveform="sine", freq_hz=100, amplitude=1.0,
223
223
  samples=4096, sample_rate_hz=50_000,
@@ -191,7 +191,7 @@ from embeddedci_openhtf import (
191
191
  bench = benchpod_plug("192.168.1.50:8080")
192
192
 
193
193
  test = htf.Test(
194
- # drive a 1 V-peak sine centred on 2.5 V (5V DAC path), capture the front ADC SMA
194
+ # drive a 1 V-peak sine centered on 2.5 V (5V DAC path), capture the front ADC SMA
195
195
  # while it runs, stop the DAC, and assert the round trip in volts
196
196
  loopback_measure_phase(bench, waveform="sine", freq_hz=100, amplitude=1.0,
197
197
  samples=4096, sample_rate_hz=50_000,
@@ -43,7 +43,7 @@ def build_test(pod: str) -> htf.Test:
43
43
  return htf.Test(
44
44
  htf.PhaseGroup(
45
45
  main=[
46
- # 1) loopback: a 100 Hz, 1 V-peak sine centred on 2.5 V (5V path),
46
+ # 1) loopback: a 100 Hz, 1 V-peak sine centered on 2.5 V (5V path),
47
47
  # captured while it runs; expect ~2 V peak-to-peak around 2.5 V.
48
48
  loopback_measure_phase(
49
49
  bench, waveform="sine", freq_hz=100, amplitude=1.0, offset=2.5,
@@ -52,7 +52,7 @@ def build_test(pod: str) -> htf.Test:
52
52
  ),
53
53
  # 2) free-run a square wave for 2 s, then snapshot the ADC on its own.
54
54
  signal_generate_phase(bench, waveform="square", freq_hz=100, amplitude=1.0,
55
- duration=2.0),
55
+ dac_path="5v", duration=2.0),
56
56
  adc_capture_phase(bench, samples=4096, sample_rate_hz=ADC_RATE_HZ,
57
57
  source="ext", pp_range=(1.8, 2.2)),
58
58
  ],
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "embeddedci-openhtf"
7
- version = "2.3.0"
7
+ version = "2.3.1"
8
8
  description = "OpenHTF plug for driving an EmbeddedCI BenchPod directly over TCP or serial (no cloud)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -92,12 +92,12 @@ _ADC_SOURCE_PATH: Dict[str, str] = {"ext": "adc_ext", "cal1": "cal1", "cal2": "c
92
92
  # -- low-level helpers (operate on a BenchPod or BenchPodPlug) ---------------
93
93
 
94
94
  def signal_generate(bench: Any, *, waveform: Waveshape, freq_hz: float, amplitude: float,
95
- offset: Optional[float] = None, dac_path: DacPath = "5v",
95
+ offset: Optional[float] = None, dac_path: DacPath = "3v3",
96
96
  duration: Optional[float] = None,
97
97
  sample_rate_hz: Optional[float] = None) -> DacHandle:
98
98
  """Start a parametric DAC waveform (``sine``/``square``/``sawtooth``) on ``dac_path``.
99
99
 
100
- ``amplitude`` is the peak and ``offset`` the centre, both in **volts** (``offset`` defaults to
100
+ ``amplitude`` is the peak and ``offset`` the center, both in **volts** (``offset`` defaults to
101
101
  the middle of the path's range). ``duration`` (seconds) stops it by itself; omitted, it runs
102
102
  until :func:`signal_stop` or the returned handle's ``stop()``. See
103
103
  :meth:`BenchPod.generate <embeddedci.benchpod.BenchPod.generate>`.
@@ -223,7 +223,7 @@ def _record_volts(test: Any, cap: Capture, *, prefix: str, attachment: Optional[
223
223
  # -- phase factories ---------------------------------------------------------
224
224
 
225
225
  def signal_generate_phase(plug: type, *, waveform: Waveshape, freq_hz: float, amplitude: float,
226
- offset: Optional[float] = None, dac_path: DacPath = "5v",
226
+ offset: Optional[float] = None, dac_path: DacPath = "3v3",
227
227
  duration: Optional[float] = None,
228
228
  sample_rate_hz: Optional[float] = None,
229
229
  name: str = "signal_generate") -> object:
@@ -362,7 +362,7 @@ def adc_capture_phase(plug: type, *, samples: int = 4096, sample_rate_hz: Option
362
362
 
363
363
  def loopback_measure_phase(plug: type, *, waveform: Waveshape = "sine", freq_hz: float,
364
364
  amplitude: float, offset: Optional[float] = None,
365
- dac_path: DacPath = "5v", samples: int = 4096,
365
+ dac_path: DacPath = "3v3", samples: int = 4096,
366
366
  sample_rate_hz: Optional[float] = None,
367
367
  source: Optional[AdcSource] = "ext", settle: float = 0.1,
368
368
  prefix: str = "adc", mean_range: _Range = None,
@@ -380,7 +380,7 @@ def loopback_measure_phase(plug: type, *, waveform: Waveshape = "sine", freq_hz:
380
380
  ``_rms_v`` / ``_min_v`` / ``_max_v``.
381
381
 
382
382
  Wire the DAC output SMA to the front ADC SMA (directly, or through the DUT whose response you
383
- are checking) and keep ``source="ext"``. E.g. a 1 V-peak sine centred on 2.5 V straight back
383
+ are checking) and keep ``source="ext"``. E.g. a 1 V-peak sine centered on 2.5 V straight back
384
384
  in: ``pp_range=(1.8, 2.2), mean_range=(2.4, 2.6)``.
385
385
  """
386
386
  _check_source(source)
@@ -454,12 +454,13 @@ def control_loop_phase(plug: type, *, voc_code: Optional[int] = None, sharpness:
454
454
  return _loop
455
455
 
456
456
 
457
- def dac_replay_phase(plug: type, *, waveform_id: str, dac_path: DacPath = "5v",
457
+ def dac_replay_phase(plug: type, *, waveform_id: str, dac_path: Optional[DacPath] = None,
458
458
  mapping: ReplayMapping = "faithful", target_samples: int = 4096,
459
459
  stop_after: bool = False, switch_image: bool = True,
460
460
  name: str = "dac_replay") -> object:
461
461
  """A phase that loads a cloud-stored waveform and replays it (looping) on the DAC.
462
462
 
463
+ ``dac_path`` left out is the path stored with the waveform, else ``3v3``.
463
464
  Needs server access (``BENCHPOD_API_KEY``). By default the replay keeps looping after the
464
465
  phase (so a later capture phase can observe it); set ``stop_after=True`` to stop it at the end
465
466
  of this phase. A replay that needs the deep-replay gateware image switches the pod to it first
@@ -474,7 +475,7 @@ def dac_replay_phase(plug: type, *, waveform_id: str, dac_path: DacPath = "5v",
474
475
  if handle.switched_image is not None:
475
476
  test.logger.warning("switched the FPGA to the deep-replay gateware image")
476
477
  test.logger.info("replaying waveform %s on %s (%d samples)",
477
- waveform_id, dac_path, handle.samples)
478
+ waveform_id, handle.dac_path, handle.samples)
478
479
  if stop_after:
479
480
  handle.stop()
480
481
 
@@ -65,11 +65,11 @@ def test_signal_generate_phase_converts_volts_through_generate():
65
65
  freq_hz=1000, amplitude=1.0, duration=0.5))
66
66
  assert rec.outcome == tr.Outcome.PASS
67
67
  i = _cmds(tx).index("generate")
68
- # generate routes the DAC path first, then sends 8-bit generator codes:
69
- # 1.0 V / (5 V / 255) = 51, offset defaults to mid-range 2.5 V -> 128.
70
- assert tx.commands[i - 1] == {"cmd": "dac_out", "path": "5v"}
68
+ # generate routes the DAC path first (3v3 when none is given), then sends 8-bit generator
69
+ # codes: 1.0 V / (3.3 V / 255) = 77, offset defaults to mid-range 1.65 V -> 127.
70
+ assert tx.commands[i - 1] == {"cmd": "dac_out", "path": "3v3"}
71
71
  assert tx.commands[i] == {"cmd": "generate", "waveform": "sine", "freq": 1000.0,
72
- "amplitude": 51, "offset": 128, "duration_ms": 500}
72
+ "amplitude": 77, "offset": 127, "duration_ms": 500}
73
73
 
74
74
 
75
75
  def test_signal_generate_helper_path_offset_and_rate():
@@ -169,8 +169,9 @@ def test_loopback_measure_phase_generates_captures_then_stops():
169
169
  assert rec.outcome == tr.Outcome.PASS
170
170
  # DAC first (its path re-applies and would open a loopback relay), then route the ADC.
171
171
  assert _cmds(tx) == ["dac_out", "generate", "analog_path", "capture", "dac_stop"]
172
+ assert tx.commands[0] == {"cmd": "dac_out", "path": "3v3"}
172
173
  assert tx.commands[1] == {"cmd": "generate", "waveform": "sine", "freq": 100.0,
173
- "amplitude": 51, "offset": 128}
174
+ "amplitude": 77, "offset": 127}
174
175
  assert tx.commands[2] == {"cmd": "analog_path", "path": "adc_ext"}
175
176
  assert tx.commands[3] == {"cmd": "capture", "samples": 8, "sample_rate_mhz": 0.05}
176
177
  p = _phase(rec, "loopback_measure")
@@ -45,7 +45,16 @@ def _run(*phases):
45
45
  return record, failed
46
46
 
47
47
 
48
+ def _require_analog(connection: str) -> None:
49
+ from embeddedci.benchpod import BenchPod
50
+
51
+ with BenchPod(connection, lease=False) as probe:
52
+ if not probe.can_analog:
53
+ pytest.skip("digital-only board: no analog front end (DAC, ADC, 4-20 mA)")
54
+
55
+
48
56
  def test_analog_phases_against_the_pod(benchpod_connection):
57
+ _require_analog(benchpod_connection)
49
58
  bench = benchpod_plug(benchpod_connection, la_voltage=LA_VOLTAGE)
50
59
  record, failed = _run(
51
60
  dac_output_phase(bench, path="5v", volts=2.5),
@@ -62,6 +71,8 @@ def test_current_loop_phases_against_the_pod(benchpod_connection):
62
71
  from embeddedci.benchpod import BenchPod
63
72
 
64
73
  with BenchPod(benchpod_connection, lease=False) as probe:
74
+ if not probe.can_analog:
75
+ pytest.skip("digital-only board: no analog front end (DAC, ADC, 4-20 mA)")
65
76
  if not probe.capabilities.current_out:
66
77
  pytest.skip("this pod's firmware has no current_out command")
67
78
  if os.environ.get("BENCHPOD_E2E_J8_WIRED") == "1":