Skip to content

korad-kaxxxxp: Add KA3305P support, handle multiple outputs - #307

Open
minuteman3 wants to merge 1 commit into
sigrokproject:masterfrom
minuteman3:korad-ka3305p-multi-output
Open

minuteman3 wants to merge 1 commit into
sigrokproject:masterfrom
minuteman3:korad-ka3305p-multi-output

Conversation

@minuteman3

Copy link
Copy Markdown

Adds support for the Korad KA3305P and its RND 320-KA3305P rebadge — a dual-output variant of the KA3005P family — and teaches the driver to handle more than one output.

Model support

  • Detected natively (KORAD KA3305P V7.1), no force_detect workaround.
  • Ranges per the manual: 0–30 V / 0–5 A, 10 mV / 1 mA resolution.

Multiple outputs

  • Per-output values in dev_context; VSET/ISET/VOUT/IOUT now carry the output number instead of being hardcoded to output 1.
  • Dual-output models expose V1/I1/V2/I2 plus one channel group per output, so per-output config can be addressed with e.g. sigrok-cli -g CH2.
  • Single-output models are unchanged (V/I, previous behaviour).
  • Output enable stays device-level: OUT<boolean> takes no channel on this family, so the outputs cannot be switched individually.

STATUS bit quirk

Measurements on real hardware contradict the documented STATUS? map, so this family reads OVP from bit 4 (gated behind KORAD_QUIRK_STATUS_OVP_BIT4):

bit documented driver used to read actually
4 N/A beep_enabled OVP enable
5 N/A ocp_enabled OCP (unchanged)
6 Output output output (unchanged)
7 N/A ovp_enabled tracks output state, not OVP

As a result SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED reported true whenever the output was enabled and could never report false. The beeper has no status bit at all (toggling it changes no bit), so it is no longer derived from the OVP bit. Other models keep the previous bit 7 decoding.

Verification

Tested on a KA3305P (firmware V7.1) with a Brymen BM257s on CH2 as an independent witness:

  • native detection: Korad KA3305P [S/N: 00018549] with 4 channels: V1 I1 V2 I2
  • per-output routing with distinct values (CH1 0.5 A / 9.0 V vs CH2 0.1 A / 6.0 V); -g CH2 emits VSET2:…/ISET2:…, -g CH1 emits VSET1:…
  • CH2 setpoint change independently confirmed by the DMM (6.00 → 7.50 → 6.00 V) while V1 stayed at 9.00 V
  • ocp_enabled and ovp_enabled now round-trip correctly (set false → get false); the latter was previously impossible while the output was on
  • bit map established from repeated OCP0/1, OVP0/1, BEEP0/1, TRACK0/1/2 sweeps
  • make check passes; builds clean under -Wall -Wextra -Wmissing-prototypes

Caveats

  • bit 4 may mean "OVP armed" or "OVP set mode"; these cannot be distinguished, as OVPSTE is write-only (no readback query) and is absent from the official manual, and no functional OVP trip was reproducible.
  • OCP functional trip is untested (requires a load).
  • The RND 320-KA3305P entry is inferred from documentation, not verified against hardware.

Add the Korad KA3305P and its RND 320-KA3305P rebadge, a two output
variant of the KA3005P family, and teach the driver to handle more than
one output.

Model support:
  - Recognise "KORAD KA3305P" natively, no force_detect workaround.
  - Ranges from the manual: 0-30V / 0-5A with 10mV / 1mA resolution,
    which matches the existing volts_30 and amps_5 tables.

Multiple outputs:
  - dev_context keeps its values per output, and the VSET/ISET/VOUT/IOUT
    commands are built with the output number instead of being hardcoded
    to output 1.
  - Models with more than one output get Vn/In analog channels and one
    channel group per output, so per output config can be addressed with
    e.g. "sigrok-cli -g CH2". Single output models keep the historical
    "V"/"I" channels and the previous behaviour.
  - The acquisition cycle walks all outputs before reading the shared
    status byte, and each datafeed packet now references the channel it
    actually belongs to. The previous channel list juggling also leaked
    the removed list link, that is gone too.
  - Output enable remains a device level option. On this family the
    "OUT<boolean>" command has no channel number, so the outputs cannot
    be switched individually.

Status bit quirks:
  - Measurement shows the KA3305P family reports the OVP enable state on
    STATUS bit 4, not bit 7. The documented bit map lists bit 4 as unused
    and the driver decoded it as the beeper state, so
    SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED read bit 7 and therefore
    reported "true" whenever the output was enabled, and could never
    report "false" while the output was on.
  - The beeper has no status bit at all on this family: toggling it
    changes no bit whatsoever, so its state is left untouched rather than
    being derived from the OVP bit.
  - All of this is gated behind KORAD_QUIRK_STATUS_OVP_BIT4, so the other
    models keep the previous bit 7 decoding. OCP on bit 5, the output
    state on bit 6, and the per output CC/CV bits are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant