# Annke WZ500 (IPC-E2A5Z18-W-B-TY) - board notes for the OpenIPC catalogue

Sold as Annke WZ500: 5 MP Wi-Fi PTZ with 18x optical zoom (Tuya cloud, vendor
"Hank" firmware V3.2.13-Tuya_231018). Boots and runs OpenIPC
`gk7205v300` ultimate (16 MB NOR) flashed with a programmer.

## Hardware

| part | marking |
|---|---|
| main board | `HC902-M16EV3-S335-V1.0`, variant `999B` (vendor `boardId=999B`) |
| SoC | Goke GK7205V300 (`GK7205 RBCFV300`) |
| sensor | Sony IMX335 (vendor devid `V6202IR-IMX335`) |
| flash | FM25Q128A, 16 MB SPI NOR |
| RAM | 256 MB (ipctool: total 256M, media 96M); CPU 900 MHz, DDR 1800 MT/s |
| motor driver | Relmon **MS41959**: 4 stepper channels + IR-cut bridge, SPI |
| zoom block | `HK-8520A-MT-C048` ("500万一体化机芯", 5 MP integrated module) |
| lamp board | `XZ-079-02`, three PT4115 LED drivers, connector `IR1..IR4, CDS` |
| IR ring | `XKQJ-1023-04` |
| Wi-Fi | Hisilicon Hi3881 on SDIO1 (no OpenIPC driver) |
| Ethernet | 100M, `TMK 2250E` magnetics |
| photocell | not fitted (`CDS` pad and lens window empty); vendor used software day/night |

## What OpenIPC needs on this board (verified on hardware)

### Motors: MS41959 on SPI1
- `/dev/spidev1.0`, SPI mode 3 + LSB first, 1 MHz, 3-byte frames
  `[reg, lo, hi]`, read = `reg | 0x40`. The gk7205v300 kernel config lacks
  `CONFIG_SPI_SPIDEV`; the DT already has `spidev@0/1` under `spi@12071000`.
- Chip clock (without it reads return reset values and writes are dropped):
  pad `0x112C0048 = 0x1A03`, CRG `0x12010108 = 0x00B00100`,
  `0x12010104 = 0x081B4E82`.
- Pads: `0x120C0018 = 0x1D02`, `0x120C001C = 0x1402`, `0x12028000 = 0x8`,
  `0x100C0084..0x90 = 0x1001`, `0x100C0038/3C = 0x1000`.
- RSTB GPIO1_3 (high-low-high, 10 ms); GPIO0_5 high.
- VD lines: GPIO1_6 starts channels A and C, GPIO1_7 channels B and D.
- Channels (upright camera): A `0x24/0x25` tilt (raw 0 = up),
  B `0x29/0x2A` pan (raw 1 = right), C `0x04/0x05` zoom (raw 1 = wide),
  D `0x09/0x0A` focus (raw 0 = near). Burst: PSUM `0x3400|dir<<8|steps`,
  INTCT `25000/steps`, one burst per 25 ms VD pulse. Pan/tilt duty 0x7878
  while moving, 0x0C0C at rest.
- Pan/tilt travel 13280 / 4840 microsteps; no end-stop sensors read, the
  vendor homes into the mechanical stops at boot.
- IR-cut coil on the chip's bridge, register `0x2C`: `0x6` night (filter
  out), `0x5` day, 250 ms, then `0x4` idle. majestic's default
  `nightMode.irCutPin1/2` (GPIO1_2/GPIO1_3) hit the chip's RSTB here and
  must stay unset.
- A majestic-af backend (`ptz.actuator: ms419xx`) driving all of the above
  is prepared; to be offered as a pull request to OpenIPC/majestic-af.

### Note on ipctool's output

The attached `ipctool.yml` was taken under OpenIPC, so `board` reads
OpenIPC, not the vendor. Its `possible-IR-cut-GPIO: 61` is the long-range
IR LED pair, not the filter: this board's IR-cut coil is on the MS41959
(register `0x2C`), so no GPIO moves it.

### Lights
- IR lamp: PWM0 on GPIO0_3; white lamp: PWM1 on GPIO0_4; active high.
- Long-range IR pair (top of the ring): GPIO7_5, high = on (vendor lit it
  above ~7x zoom).

### Wi-Fi (Hi3881, not working yet)
- Power: GPIO0_0 high (pad `0x100C0008 = 0x1D20`).
- SDIO1 pads that the vendor U-Boot sets and OpenIPC's does not:
  `0x100C0060 = 0x1D54`, `0x100C0064..0x74 = 0x1174`. With them the card
  enumerates (`mmc1: new high speed SDIO card at address 0001`).
- The vendor's binary `hi3881.ko` loads its firmware on OpenIPC but fails
  creating the netdev: the vendor kernel has no IPv6, so
  `net_device.dev_addr` is at 468 there and 472 in OpenIPC's.

## Vendor partition layout (stock)

`sfc:192K(boot),64K(bootargs),1920K(kernel),1408K(rootfs),384K(config),11392K(data),1024K(huiyun)`
