Skip to content

t23_lite_botslab-c213: add the Botslab C213 - #283

Draft
echoechoechoechoechoechoechoecho wants to merge 1 commit into
OpenIPC:masterfrom
echoechoechoechoechoechoechoecho:botslab-c213
Draft

echoechoechoechoechoechoechoecho wants to merge 1 commit into
OpenIPC:masterfrom
echoechoechoechoechoechoechoecho:botslab-c213

Conversation

@echoechoechoechoechoechoechoecho

Copy link
Copy Markdown

Botslab C213: T23N, SmartSens SC3332 on 2-lane MIPI, ATBM6012B USB Wi-Fi, 8 MB NOR, Ethernet, microSD, pan/tilt and IR cut on a TMI8152 (SPI), IR LEDs, two LEDs, reset and touch buttons, microphone and speaker.

Depends on:

Adds t23_lite_botslab-c213 and a tmi8152-c213 package for the pan/tilt and IR-cut driver chip.
Hardware facts come from the stock firmware C213C_v1.0.4.5649 (kernel board data, init scripts,
the vendor camera app) and were checked on a camera.

Hardware

Function GPIO Notes
Reset button 18 (PA18) active low
Touch "call" button 58 (PB26) active low
Status LEDs 50 green / 57 blue active low
IR illuminator 49 (PB17) nightMode.backlightPin
SD card detect 51 (PB19) active low, gpio_mmc=51 (the loader default 59 is an SSI0 pin here)
Ethernet PHY reset 52 (PB20) active low; stock U-Boot ethphy reset pulses it, Linux does not, so muxes.sh does
Speaker amplifier 53 (PB21) active high (stock qhHALAOSetPAOnOrOff)
TMI8152 power stage 63 (PB31) must stay high; stock audio.ko holds it high as its default spk_gpio. Without it the chip answers on SPI (ID 0x8150) but reports a fault and drives nothing
Pan/tilt + IR cut SSI0 PB27-PB30 TMI8152 (the stock app calls it tmi8150b), bus 0 CS0

GPIO8, which the stock init script sets, does not respond on T23N (reads 0 in the stock firmware too).

TMI8152 (package tmi8152-c213)

Thingino's driver (sstepansky/tmi8152-spi-dev) with its SPI framing, speed table, move mode and
IR-cut sequence unchanged. The patch only makes it work on the OpenIPC T23 kernel:

  • write() on /dev/tmi8152_ir_cut fails on this kernel ("Error copying data from user",
    while the ioctl paths copy fine), so the IR cut is also exposed as the ircut module
    parameter (/sys/module/tmi8152_spi_dev/parameters/ircut).
  • struct motor_message without inversion_state, the layout OpenIPC's ingenic-motor uses
    (MOTOR_GET_STATUS copied 4 bytes past its buffer).
  • The motor module is built as tmi8152_motor.ko, since openingenic already installs a motor.ko
    (excluded for this board).

The package enables CONFIG_SPI, CONFIG_JZ_SPI, CONFIG_JZ_SPI0 (PB27-PB30) through
LINUX_CONFIG_FIXUPS.

Board setup (S36c213): pan on channel 0, tilt on channel 1; ranges and home from the stock app
(pan 500 counts, home 250; tilt 200, home 60 from the low stop; driver units x16: 8000 / 3200,
centre 4000 / 960), all overridable with fw_setenv motor_*. The IR cut follows majestic's
night_enabled through ircut-sync, since majestic only drives GPIO IR-cut pins.
WebUI PTZ uses the motor backend (/usr/bin/motor -> ingenic-motor, ptz_control=motor).

Sensor

The open SC3332 driver (openingenic, ported from thingino) with thingino's ISP tuning
(sensor-iq/t23/sc3332.bin), shipped in the profile as /etc/sensor/sc3332-t23.bin with its
sc3332.yaml; checked on the camera against the vendor module and IQ, no worse. sinfo detects
the sensor, so the customizer does not pin sensor. Settings: 2304x1280 (the T23 H.264 encoder
rejects 1296 lines), image.flip + image.mirror, osmem 40M, rmem 24M.

The sensor reset is PA17, passed to the sensor driver and to sinfo in
/etc/modprobe.d/c213.conf: PA18, the T23 default, is the reset button here. resetd.sh (from
the Jooan profiles) now ignores a button pin it cannot read instead of treating it as pressed;
a driver holding the pin made it factory-reset the camera five seconds after boot. It also makes PA18 an input on every poll: tx-isp-t23 turns it into an output driven high when it probes (it is the T23 default sensor reset), and the button then never reads as pressed.

Known gaps

  • The WebUI's flash size counts the split layout's nested partitions twice on 3.10 kernels
    (no offset in sysfs), showing 15.69 MB for 8 MB; to be fixed in majestic-webui separately.
  • The touch button (GPIO58) is not bound to anything yet.
  • package/tmi8152-c213 is a builder-local package, so ci-matrix.py widens this PR to every
    device. If you would rather have it in OpenIPC/firmware (other T23/T31 boards carry a TMI8152),
    I can move it there.

Hardware tested on

T23N, Botslab C213, image built from this branch (with the openingenic commit applied), flashed
and run.

Evidence

On the camera, image built from this branch with the openingenic commit applied (c213+8c63a83-183217; the final commit differs from it only in resetd.sh, rechecked below). Pan/tilt homing, sensor detected by sinfo (sensor was cleared before this boot), SD card, Wi-Fi driver, TMI8152 modules, and the IR-cut and reset-button daemons running:

root@openipc-t23:~# grep -i version /etc/os-release; fw_printenv sensor wlandev gpio_mmc; dmesg | grep -i -E "sc3332|Chip ID|homing|jz_mac|link is up|mmc0"; lsmod; logread | grep -E "ircut|resetd" | tail -5; ps | grep -E "[i]rcut|[r]esetd"
VERSION=-g8c63a83-dirty
VERSION_ID=2024.02.10
OPENIPC_VERSION=2.6.11.30
GITHUB_VERSION="c213+8c63a83-183217, 2026-11-30"
sensor=sc3332
wlandev=atbm603x-generic-usb
gpio_mmc=51
[    0.619650] jz_mac jz_mac.0: JZ on-chip Ethernet MAC driver, Version 1.0
[    2.807898] Chip ID is 0x8150
[    3.517905] Waiting for MOTOR_RESET to perform homing sequence
[    3.530249] Starting enhanced homing sweep
[   12.883531] Enhanced homing complete - logical center (4000, 960)
[   19.104381] sinfo: Successful sensor detection: sc3332, I2C Bus: 0, I2C Address: 0x30
[   21.273235] mmc0: new high speed SDHC card at address aaaa
[   21.283463] mmcblk0: mmc0:aaaa SE32G 29.7 GiB 
Module                  Size  Used by    Tainted: G  
jzmmc_v12              16033  0 
audio                  43139  2 
sensor_sc3332_t23       9600  0 
tx_isp_t23            986939  1 sensor_sc3332_t23
sinfo                  16628  0 
atbm603x_comb_wifi_usb   929711  0 
cfg80211              224892  1 atbm603x_comb_wifi_usb
tmi8152_motor           8713  0 
tmi8152_spi_dev         5566  1 tmi8152_motor
vfat                    8664  1 
fat                    51832  1 vfat
  741 root      0:00 {ircut-sync} /bin/sh /usr/sbin/ircut-sync
  742 root      0:00 {resetd.sh} /bin/sh /usr/sbin/resetd.sh

Network on Wi-Fi (no Ethernet cable on this run):

root@openipc-t23:~# for i in eth0 wlan0; do echo "$i: $(cat /sys/class/net/$i/operstate) carrier=$(cat /sys/class/net/$i/carrier 2>/dev/null) speed=$(cat /sys/class/net/$i/speed 2>/dev/null)"; done; ip -o link | cut -d' ' -f2,9; iwconfig wlan0 2>/dev/null | grep -E "ESSID|Bit Rate|Signal"
eth0: down carrier=0 speed=10
wlan0: up carrier=1 speed=
lo: UNKNOWN
eth0: DOWN
tunl0: DOWN
wlan0: UP
p2p0: DOWN
wlan0     IEEE 802.11bgn  ESSID:"<ssid>"  
          Bit Rate=65 Mb/s   
          Link Quality=66/70  Signal level=-44 dBm  

Build: firmware.bin: [6400KB/7616KB].

Checked by hand on earlier builds of this profile (same overlay, TMI8152 package and majestic settings): video with flip/mirror, day/night switching moves the IR cut, WebUI pan/tilt arrows in both axes, microphone and speaker, Ethernet link (100/Full after the PHY reset). Reset button: once booted, PA18 read 1 for ever. tx-isp-t23 (the vendor ISP module) makes it an output driven high when it probes, PA18 being the T23 default sensor reset; it does so through the GPIO registers, so gpiolib still reports the pin as a sysfs input. A boot-time probe of PA PAT1 (bit 18 = PA18, bit 17 = PA17), next to dmesg:

3.60 PAT1=0x000740C0
11.72 PAT1=0x000340C0
11.84 PAT1=0x000740C0
14.25 PAT1=0x000540C0
[   11.711940] "echo 1 > enable" or "echo 0 > enable " @@@@ tx-isp-probe ok(version H20240204a), compiler date=Feb  4 2024 @@@@@
 gpio-17  (sensor_reset        ) out hi
 gpio-18  (sysfs               ) in  hi

At 11.72 PA18 turns output, right after tx-isp probes; at 11.84 resetd.sh has made it an input again (it does so on every poll); at 14.25 the sensor driver takes PA17 as its reset. With the pin an input, it reads 0 while pressed, and a 5 s hold blinks the LED and factory-resets the camera. Rechecked on the final image (c213+8c63a83-190433): a 5 s hold blinks the LED and resets the camera.

Install

Stock U-Boot (2013.07) is kept. From its console, with firmware.bin on a FAT SD card:

mmc rescan; sf probe 0
fatload mmc 0 0x80600000 firmware.bin
sf erase 0x50000 0x7b0000; sf write 0x80600000 0x50000 ${filesize}
setenv bootargs 'console=ttyS1,115200n8 panic=10 mem=40M@0x0 rmem=24M@0x2800000 init=/init root=/dev/mtdblock3 rootfstype=squashfs mtdparts=jz_sfc:256k(boot),64k(env),-(firmware)'
setenv bootcmd 'sf probe 0; sf read 0x80600000 0x50000 0x200000; bootm 0x80600000'
saveenv; reset

The kernel's split-layout parser finds the uImage and squashfs itself; later updates use
openipc.t23-nor-lite-split.tgz through the WebUI.

🤖 Generated with Claude Code

T23N, SC3332 on 2-lane MIPI, ATBM6012B USB Wi-Fi, 8 MB NOR, Ethernet,
microSD, pan/tilt and IR cut on a TMI8152 (SPI), IR LEDs, two LEDs,
reset and touch buttons, microphone and speaker.

- GPIO map from the stock firmware C213C_v1.0.4.5649, checked on the
  camera: reset 18, touch button 58, LEDs 50/57, IR LEDs 49, SD detect
  51, Ethernet PHY reset 52 (pulsed in muxes.sh), speaker amplifier 53,
  TMI8152 power stage 63, sensor reset PA17 (modprobe.d, for the sensor
  driver and sinfo).
- tmi8152-c213: thingino's TMI8152 driver with three OpenIPC T23 fixes
  (an "ircut" module parameter, as write() on the IR-cut device fails
  here; the ingenic-motor struct layout; the tmi8152_motor.ko name);
  enables CONFIG_SPI/JZ_SPI/JZ_SPI0 through LINUX_CONFIG_FIXUPS.
- WebUI PTZ through the "motor" backend; the IR cut follows majestic's
  night_enabled (ircut-sync), as majestic drives only GPIO IR-cut pins.
- SC3332 ISP tuning: thingino's sensor-iq/t23/sc3332.bin.
- resetd.sh: ignores a button pin it cannot read instead of factory
  resetting, and makes PA18 an input on every poll, as tx-isp-t23 turns it
  into an output when it probes (it is the T23 default sensor reset).
- Stock U-Boot is kept; the kernel's split-layout parser boots it.

Needs the SC3332 driver in OpenIPC/openingenic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

1 participant