Skip to content

builder: add the VStarcam C23S, with the pan coils held off at boot - #254

Open
zx97 wants to merge 4 commits into
OpenIPC:masterfrom
zx97:vstarcam-c23s
Open

zx97 wants to merge 4 commits into
OpenIPC:masterfrom
zx97:vstarcam-c23s

Conversation

@zx97

@zx97 zx97 commented Nov 17, 2026

Copy link
Copy Markdown

What this adds

devices/hi3518ev200_lite_vstarcam-c23s, a device entry for the VStarcam C23S
(HI3518EV200, OV2710 over one MIPI lane, 16 MB flash, MT7601U on USB).

The reason it exists is muxes.sh, the other half of
OpenIPC/openhisilicon#305.

The coils

The Darlington array that drives the pan stepper (CHMC 1J2003EF, foot board)
takes its inputs from GPIO3_7 and GPIO4_0..GPIO4_2 - pads 31 to 34 - and the BSP
leaves them as inputs with the internal pull-up. They read 1 from the first
second of uptime, every coil carries current, and the motor heats without ever
turning. On this board a coil is on when its input is high, so muxes.sh claims
those four pads as outputs and drives them low. Pads 35 and 36 sit in the same
block and are left untouched: what they drive is not identified.

Which four, and in which order, was settled without a multimeter. The head
carries the image sensor, so a pan that turns is visible in the frame, and
gpio-motors from OpenIPC/firmware was driven with a stand-in fw_printenv on
PATH so nothing was written to the U-Boot environment:

PATH=/tmp:$PATH PTZ_GPIO='31 32 33 34 31 32 33 34' gpio-motors 30 0 4
set of four frame change (mean abs diff, 160x90 grey)
31 32 33 34 25.6 (noise floor 3.3), back to 3.4 when stepped back
32 33 34 35, 33 34 35 36, 31 32 35 36, 31 33 35 36, 32 34 35 36 3.7 / 5.0 / 6.2 / 5.3 / 5.8, nothing moved

So ptz_gpio is '31 32 33 34 31 32 33 34' - the pan set twice, because
gpio-motors wants two axes - and ptz_coil_active is 1, the default. The tilt
phases are not on these pads (the head has its own 5-pin connector and no driver
of its own), so tilt steps must stay at 0 until someone identifies them.

The rest of the entry

  • BR2_PACKAGE_GPIO_MOTORS=y: the tool majestic drives the head through, absent
    from this board's image today.
  • IR-cut on 65 and 64, measured by pulsing each pin and watching the frame:
    65 gives mean luma 154 with R/G 1.50 (filter out, infrared through), 64 gives
    130 with R/G 0.99 (filter in). The same pair the C8892WIP device carries.
  • fw_setenv sensor ov2710_mipi: the default ov2710_mipi_1080p.ini describes
    the parallel interface, so the streamer moves on to
    ov2710_mipi_1lane_1080p.ini by itself (the fallback added in #2871). Naming
    the sensor is enough.
  • Flash size 16 MB, from /proc/mtd: 1024k boot, 3072k kernel, 8192k rootfs,
    the rest rootfs_data. The kernel config is the hi3518ev200 generic one, copied
    as the neighbouring devices do.

Verified on hardware, and not

Verified on the board: SoC, sensor and lane count, flash layout, the four motor
pads and their order, the coil polarity, the IR-cut pins, the MT7601U
(148f:7601 on the USB bus).

Not verified: the LED pins, the light sensor pin, and the tilt driver. None of
them is set here; they fall back to the image defaults.

Testing

After flashing, gpio-motors status should answer instead of reporting a
missing package, pads 31-34 should read out 0 right after boot
(ipctool gpio dump), and gpio-motors 20 0 4 should turn the head without the
motor warming up. Video is /mjpeg; the H.264 stream wedges the pipeline on
this board (OpenIPC/majestic#377), so mp4.enable is better left off.

The board is a Hi3518EV200 with an OV2710 over one MIPI lane, 16 MB of flash
and an MT7601U on the USB bus. Nothing here is new hardware support: the point
of the device entry is the muxes.sh, which is the other half of
OpenIPC/openhisilicon#305.

On this board the Darlington array that drives the pan stepper (CHMC 1J2003EF)
takes its inputs from GPIO3_7 and GPIO4_0..GPIO4_2 - pads 31 to 34 - and the
BSP leaves them as inputs with the internal pull-up. They read 1 from the first
second of uptime, every coil carries current, and the motor heats up without
ever turning. A coil is on when its input is high here, so muxes.sh claims
those four pads as outputs and drives them low. Pads 35 and 36 sit in the same
block and are left untouched: what they drive is not identified.

The four phases were identified without a multimeter, by stepping the motor
with gpio-motors and watching the camera's own image move: 30 steps at 4 ms
change the frame by 25.6 (mean absolute difference on a 160x90 grey copy) on a
noise floor of 3.3, and stepping back returns it to 3.4. Sets that leave 34 out
do not move anything. This is also how `ptz_gpio` was settled, so the entry
writes `31 32 33 34` twice and `ptz_coil_active 1`; the tilt phases are not on
these pads, so tilt steps must stay 0 until someone identifies them.

gpio-motors is built in (BR2_PACKAGE_GPIO_MOTORS=y): it is the tool majestic
drives the head through, and on this image it was absent.

The customizer also records the IR-cut pins, 65 and 64, measured the same way:
pulsing 65 gives mean luma 154 with R/G 1.50 (filter out, infrared through),
pulsing 64 gives 130 with R/G 0.99 (filter in). Those are the pins the C8892WIP
device already carries, and this board is the same vendor and SoC family.

The kernel config is the hi3518ev200 generic one, copied as the other devices
in this family do. The flash size is 16 MB, from /proc/mtd on the board:
1024k boot, 3072k kernel, 8192k rootfs, the rest rootfs_data.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add VStarcam C23S profile and switch off pan coils at boot

✨ Enhancement 🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Add a VStarcam C23S image profile for its sensor, Wi-Fi, flash size, and motor package.
• Drive pan GPIOs low at boot to prevent stationary coils from heating.
• Configure verified IR-cut and pan pins without assigning unidentified tilt or LED pins.
Diagram

graph TD
  Boot["S30customizer"] --> Mux["muxes.sh"] --> GPIO["GPIO 31-34"] --> Coils["Pan coils"]
  Boot --> Custom["customizer.sh"] --> Env[("PTZ settings")] --> Motors["gpio-motors"]
  Motors --> GPIO
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Initialize pins in board pinctrl or bootloader
  • ➕ Could switch off coils earlier than the userspace boot hook.
  • ➖ Requires board-specific lower-level changes rather than a self-contained device profile.
  • ➖ Would still need userspace PTZ configuration for motor control.

Recommendation: Keep the board-scoped mux script as the practical fix alongside the new profile. It cannot prevent coil current before S30customizer runs; consider earlier pin initialization if that interval remains a thermal concern.

Files changed (5) +2693 / -0

Bug fix (1) +20 / -0
muxes.shSwitch off pan coils during boot +20/-0

Switch off pan coils during boot

• Exports verified GPIOs 31–34 and drives them low as outputs to stop the active-high pan coils carrying current while idle. Leaves nearby unidentified pins 35 and 36 untouched.

devices/hi3518ev200_lite_vstarcam-c23s/general/overlay/usr/share/openipc/muxes.sh

Other (4) +2673 / -0
hi3518ev200.generic.configAdd the HI3518EV200 kernel configuration +2507/-0

Add the HI3518EV200 kernel configuration

• Supplies the 4.9.37 kernel configuration for this board profile, including GPIO sysfs, USB host support, and the MT7601U driver. It follows the generic configuration used by neighboring HI3518EV200 devices.

devices/hi3518ev200_lite_vstarcam-c23s/br-ext-chip-hisilicon/board/hi3516cv200/hi3518ev200.generic.config

hi3518ev200_lite_vstarcam-c23s_defconfigDefine the C23S Buildroot image +69/-0

Define the C23S Buildroot image

• Selects the HI3518EV200 lite profile with 16 MB flash, MT7601U firmware, Majestic, and gpio-motors. Configures the kernel and NOR image packaging.

devices/hi3518ev200_lite_vstarcam-c23s/br-ext-chip-hisilicon/configs/hi3518ev200_lite_vstarcam-c23s_defconfig

customizer.shSet C23S sensor, IR-cut, Wi-Fi, and PTZ defaults +41/-0

Set C23S sensor, IR-cut, Wi-Fi, and PTZ defaults

• Sets the upgrade URL, OV2710 sensor name, measured IR-cut pins, MT7601U device, and active-high pan mapping. Repeats the pan pins for the required two-axis PTZ value while leaving unidentified tilt hardware unconfigured.

devices/hi3518ev200_lite_vstarcam-c23s/general/overlay/usr/share/openipc/customizer.sh

hi3518ev200_lite.listTrim unused sensor and Wi-Fi files +56/-0

Trim unused sensor and Wi-Fi files

• Excludes unrelated sensor profiles, sensor libraries, and the RTL8188EU module from the lite image. This keeps the board image focused on its OV2710 and MT7601U hardware.

devices/hi3518ev200_lite_vstarcam-c23s/general/scripts/excludes/hi3518ev200_lite.list

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Default codec is the stream that wedges ✓ Resolved
Description
The customizer runs cli -s .video0.codec h264 on first boot, so every C23S starts on the H.264
path that the PR description says wedges this board and that OpenIPC/majestic#377 ties to a stale
VENC channel 0 after restarts. The PR description recommends /mjpeg for this board, so the shipped
default contradicts the author's own finding and reaches live video on every fresh flash.

2. README device table lacks the new board ✓ Resolved
Description
The PR adds the device directory, defconfig, and customizer but changes no README file, so the
device-table row the rule requires is absent. Users and maintainers reading the README inventory
will not find the C23S, and the table will drift from the devices that are built; this is flagged as
a remediation because the README could not be located in this checkout to confirm the table.

3. Tilt requests turn the pan motor ✓ Resolved
Description
ptz_gpio assigns GPIOs 31–34 to both the pan and tilt phase groups without preventing nonzero tilt
commands. The board installs gpio-motors, so a tilt request that reaches it drives the pan coils
even though the tilt wiring is unidentified.

Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

- do not force video0.codec h264: the H.264 channel wedges this board
  (OpenIPC/majestic#377) and video is taken from /mjpeg, so the codec is left
  at the image default
- do not set ptz_gpio: gpio-motors wants two axes and writing the pan set twice
  would make a tilt request drive the pan coils. The four pan phases and how to
  enable them once the tilt ones are known are in a comment instead
- add the C23S row to the device table in README.md
@zx97

zx97 commented Nov 17, 2026

Copy link
Copy Markdown
Author

Addressed the three findings in the branch.

  • h264 by default: the customizer no longer sets video0.codec. The H.264
    channel wedges this board (VPSS to VENC channel 0 stops being fed after repeated S95majestic restarts (live page 500, JPEG paths fine) majestic#377) and video is taken from
    /mjpeg, so the codec is left at the image default instead of being forced on
    every fresh flash.
  • tilt drives pan: ptz_gpio is no longer set. gpio-motors wants two
    axes, and writing the pan set twice - because there is nothing else to write -
    would make a tilt request turn the pan coils. The four pan phases, and the
    one-line command to enable them once the tilt ones are known, are in a
    comment instead. The coils are held off by muxes.sh either way, which is
    what this device entry was for.
  • device table: the C23S row is in README.md, between the C23S's
    alphabetical neighbours.

@openipc-ai openipc-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right home for it, and the pad and polarity work is solid: you used the frame difference as the sensor, and stepped back to the start. A few notes, none of them blocking.

  • muxes.sh: it leaves pads 31–34 exported, but that doesn't get in gpio-motors' way. Its export of an already-exported pin fails silently and it carries on, and when it releases the pins it drives them low before unexporting, which is the off level here. So the two coexist.
  • Not setting ptz_gpio until the tilt phases are known is the right call. One consequence: nothing in the web UI will pan this camera out of the box, so pan-ok in the README row reads stronger than what ships. Something like pan coils held off (pins known), tilt-no would match it.
  • The quieter [3dnr] from OpenIPC/firmware#2884 belongs here rather than in the shared cv200 package. Add it as general/overlay/etc/sensors/iq/c23s.ini (or any name) and select it in customizer.sh with cli -s .isp.iqProfile /etc/sensors/iq/c23s.ini. isp.iqProfile is the key that picks the IQ file, and it's documented in the wiki's majestic-config.md. hi3516ev300_ultimate_xm-85h50ai and hi3518cv100_lite_xm-n51813l already ship their own IQ file the same way. Every C23S then gets the tuning you measured, and no other cv200 board changes.
  • On OpenIPC/majestic#377: in the lab it hasn't reproduced as "H.264 wedges the pipeline" (36 restarts, with and without clients streaming). It's still open pending your clean-boot run. Leaving the codec at the image default is fine; I'd just not state it as settled in the comment.

…EADME row to what ships

- add general/overlay/etc/sensors/iq/c23s.ini, the [3dnr] ladder measured on
  this board, and select it from the customizer with isp.iqProfile. Without the
  key the streamer opens default.ini, which is the AR0130 ladder on every cv200
  image, so the tuning would ship unread.
- README row: "pan coils held off (pins known)" instead of "pan-ok", since
  ptz_gpio is deliberately not set until the tilt phases are known.
- do not state the H.264 channel as settled: it has not been reproduced in the
  lab (OpenIPC/majestic#377).
@zx97

zx97 commented Nov 17, 2026

Copy link
Copy Markdown
Author

All four points taken, in 6d91dd7.

  • The IQ profile is here now. general/overlay/etc/sensors/iq/c23s.ini
    carries the [3dnr] ladder, and the customizer selects it with
    cli -s .isp.iqProfile /etc/sensors/iq/c23s.ini. I checked the key on the
    board before writing it: pointing isp.iqProfile at ov2710.ini makes the
    loader open that file and apply its [3dnr] (70/54/12/4), and pointing it
    back at ar0130.ini restores the other ladder. So the file is read, not
    carried.
  • README row now reads pan coils held off (pins known), tilt-no instead of
    pan-ok. You are right that it overstated what ships.
  • muxes.sh and gpio-motors coexisting: good to know, thank you - I had
    not checked the export path of the tool against an already-exported pin.
  • #377: the comment no longer states the H.264 channel as settled. It says
    suspected, not reproduced in the lab, and that video was taken from /mjpeg
    while the board was being brought up.

@openipc-ai openipc-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All four points addressed. Thanks, especially for checking isp.iqProfile on the board before relying on it.

One small thing, which can go in now or in a follow-up: your clean run on OpenIPC/majestic#377 didn't reproduce it, and that issue is now closed as not reproducible. The customizer's "H.264 channel is suspected on this board" comment can go. Leaving the codec at the image default needs no reason attached.

OpenIPC/majestic#377 is closed as not reproducible, and leaving the codec at
the image default needs no reason attached.
@zx97

zx97 commented Nov 18, 2026

Copy link
Copy Markdown
Author

Gone. The codec is left at the image default, with no reason attached.

@zx97

zx97 commented Nov 18, 2026

Copy link
Copy Markdown
Author

One thing this board needs, found after the last review question about
Mask_0. ov2710_mipi_1lane_1080p.ini carries Mask_0 = 0x3FF0000, the
parallel-port value; with it, a white ceiling lit by a bright tube lamp comes out
covered in a coloured pattern over 61 % of its area. With 0xFFF00000, the value
every other MIPI file for cv200 uses, that area is 0 %.

The fix belongs in the sensor file, not here: OpenIPC/firmware#2898. The device
will get it when that lands, since it loads /etc/sensors/ov2710_mipi_1lane_1080p.ini
from the osdrv package.

Worth knowing while testing this board: the mask does not corrupt the signal, it
scales it down about six times. On my unit, 33 ms reads a mean luma of 132 with
the old value and 22 with the new one; with isp.aGain 4.0 and isp.ispGain 1.5
on top it is back to 111 and clean. So anyone flashing this device before the
sensor fix arrives will find the picture dark, not broken.

This branch has not been deployed

No deployments
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.

2 participants