Quick jump:  What's new

 
Go to:
 
Weblog: Recent Changes   
in Dobrica Pavlinušić's random unstructured stuff
CH32V003


BalCCon 2k24 badge

https://www.youtube.com/watch?v=4waDha2DxK8

https://ch405-labs.com/mc-0o00/

https://gitlab.com/ch405labs/badgelife/mcd-0o00/mcd-0o00-hardware-design

MC-0o00-Schema.png

CH32V003

https://github.com/cnlohr/ch32v003fun

esp32s2 programmer

https://github.com/cnlohr/esp32s2-cookbook/tree/master/ch32v003programmer

flash programmer to esp32s2

dpavlin@nuc:/nuc/Balccon2k24/esp32s2-cookbook/ch32v003programmer$ /nuc/esp8266/esptool/esptool.py --port /dev/ttyUSB2 -b 460800 write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 build/bootloader/bootloader.bin 0x10000 build/usb_sandbox.bin 0x8000 build/partition_table/partition-table.bin
esptool.py v4.7-dev
Serial port /dev/ttyUSB2
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Detecting chip type... ESP32-S2
Chip is ESP32-S2 (revision v0.0)
Features: WiFi, No Embedded Flash, No Embedded PSRAM, ADC and temperature sensor calibration in BLK2 of efuse V1
Crystal is 40MHz
MAC: 7c:df:a1:02:81:de
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00004fff...
Flash will be erased from 0x00010000 to 0x00041fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 13376 bytes to 9327...
Wrote 13376 bytes (9327 compressed) at 0x00001000 in 0.4 seconds (effective 244.8 kbit/s)...
Hash of data verified.
Compressed 201568 bytes to 111748...
Wrote 201568 bytes (111748 compressed) at 0x00010000 in 2.6 seconds (effective 614.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 119...
Wrote 3072 bytes (119 compressed) at 0x00008000 in 0.1 seconds (effective 391.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Connect SWIO (Pin D1) on CH32V003 to GPIO6 on the ESP32S2.

    Optionally use 10k pull-up on SWIO.
    Optional Clock Synthesizer is on GPIO2 "Multi2" / "M0"
    VCC Output on GPIO11/12 on ESP32S2.

hmm... doesn't seem to work for me

dpavlin@nuc:/nuc/Balccon2k24/ch32v003fun/minichlink$ ./minichlink -3i
Found ESP32S2-Style Programmer
Interface Setup
Error: Failed to get chip details

that's because I didn't turn on switch on badge!

dpavlin@nuc:/nuc/Balccon2k24/ch32v003fun/minichlink$ ./minichlink -i
[Fri Feb 21 14:38:00 2025] usb 3-3.3.4.4: input irq status -75 received
[Fri Feb 21 14:38:00 2025] usb 3-3.3.4.4: input irq status -75 received
[Fri Feb 21 14:38:00 2025] usb 3-3.3.4.4: input irq status -75 received
Found ESP32S2-Style Programmer
[Fri Feb 21 14:38:00 2025] usb 3-3.3.4.4: input irq status -75 received
Interface Setup
USER/RDPR  : e817/5aa5
DATA1/DATA0: ff00/ff00
WRPR1/WRPR0: 00ff/00ff
WRPR3/WRPR2: 00ff/00ff
[Fri Feb 21 14:38:00 2025] usb 3-3.3.4.4: input irq status -75 received
Flash Size: 16 kB
R32_ESIG_UNIID1: 4f29abcd
R32_ESIG_UNIID2: b7cabcd4
R32_ESIG_UNIID3: ffffffff

flash

dpavlin@nuc:/nuc/Balccon2k24$ ./minichlink -w functest.bin 0 -b

https://gitlab.com/BlueSyncLine/arduino-ch32v003-swio

permalink
IR


Various infrared links collected here



Ir Send

Updated for HVAC Mitsubishi & Panasonic IR

Tasmota IR

Configure module

Generic

D4 GPIO2 - AM2301

D6 GPIO12 - IN - IRrecv

D7 GPIO13 - Switch1 - reed relay to gnd

D5 GPIO14 - OUT - IRsend

Configure WIFI

AP1 SSID, AP1 password
hostname - ir

Configure MQTT

Host: rpi2

Topic: ir

Configure Logging

Telemetry period: 10

Configure Other

Device Name: IR

Friendly Name 1: IR

Console

SerialLog 3 - turn serial log output https://tasmota.github.io/docs/Commands/

reed sensor

switch 2 gpio 13

https://tasmota.github.io/docs/Buttons-and-Switches/#switchmode-15

expose gpio 13 in homeassistant as lodja_vrata sensor, remove connection with relay

SwitchText2 lodja_vrata
Setoption114 1
SwitchMode2 15

ESP IR TR

https://templates.blakadder.com/ESP_IR_TR.html

{"NAME":"Tasmota IR-Gateway","GPIO":[0,0,0,0,1056,0,0,0,0,0,1088,0,0,0],"FLAG":0,"BASE":18}

GPIO04 IRsend
GPIO14 IRrecv

AM2301 + IR

module pinout

esp_ir_tr-pinout.jpg

esp_ir_tr-am2301-gpio15.jpg

(it's on GPIO13, ignore picture name which is wrong)

addition AM2301 on GPIO13 - requires custom tasmota ir build with USE_DHT enabled for IR_FIRMWARE build

(venv) dpavlin@nuc:/nuc/esp8266/Tasmota$ git diff
diff --git a/tasmota/include/tasmota_configurations.h b/tasmota/include/tasmota_configurations.h
index 1260892a0..c64d1ac1e 100644
--- a/tasmota/include/tasmota_configurations.h
+++ b/tasmota/include/tasmota_configurations.h
@@ -503,7 +503,8 @@
 #undef USE_PROJECTOR_CTRL                        // Disable support for LCD/DLP Projector serial control interface
 #undef USE_LOX_O2                                // Disable support for LuminOx LOX O2 Sensor

-#undef USE_DHT                                   // Disable support for DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321) and SI7021 Temperature and Humidity sensor
+// XXX FIXME dpavlin -- keep DHT11
+//#undef USE_DHT                                   // Disable support for DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321) and SI7021 Temperature and Humidity sensor
 #undef USE_MAX31855                              // Disable MAX31855 K-Type thermocouple sensor using softSPI
 #undef USE_MAX31865                              // Disable support for MAX31865 RTD sensors using softSPI
 #undef USE_TM1638                                // Disable support for TM1638 switches copying Switch1 .. Switch8

template:

{"NAME":"Tasmota IR-Gateway","GPIO":[0,0,0,0,1056,0,0,0,0,0,1088,1216,0,0],"FLAG":0,"BASE":18}
permalink
Milk-V Duo


https://milkv.io/docs/duo/overview

Duo S

https://milkv.io/docs/duo/getting-started/duos

[Thu Jan 23 16:32:35 2025] usb 3-3.3.4.4: new high-speed USB device number 28 using xhci_hcd
[Thu Jan 23 16:32:36 2025] usb 3-3.3.4.4: device descriptor read/64, error -71
[Thu Jan 23 16:32:36 2025] usb 3-3.3.4.4: New USB device found, idVendor=3346, idProduct=1009, bcdDevice= 5.10
[Thu Jan 23 16:32:36 2025] usb 3-3.3.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Thu Jan 23 16:32:36 2025] usb 3-3.3.4.4: Product: RNDIS
[Thu Jan 23 16:32:36 2025] usb 3-3.3.4.4: Manufacturer: Cvitek
[Thu Jan 23 16:32:36 2025] usb 3-3.3.4.4: SerialNumber: 0123456789
[Thu Jan 23 16:32:36 2025] rndis_host 3-3.3.4.4:1.0 eth0: register 'rndis_host' at usb-0000:00:14.0-3.3.4.4, RNDIS device, 7a:f4:9f:e4:50:82
[Thu Jan 23 16:32:36 2025] usbcore: registered new interface driver rndis_host
[Thu Jan 23 16:32:36 2025] rndis_host 3-3.3.4.4:1.0 enx7af49fe45082: renamed from eth0

dpavlin@nuc:/nuc/milkv-duo$ sudo dhclient enx7af49fe45082

dpavlin@nuc:/nuc/milkv-duo$ /sbin/ifconfig enx7af49fe45082
enx7af49fe45082: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.42.94  netmask 255.255.255.0  broadcast 192.168.42.255
        inet6 fe80::78f4:9fff:fee4:5082  prefixlen 64  scopeid 0x20<link>
        ether 7a:f4:9f:e4:50:82  txqueuelen 1000  (Ethernet)
        RX packets 7  bytes 816 (816.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 31  bytes 6008 (5.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

dpavlin@nuc:/nuc/milkv-duo$ ssh root@192.168.42.1.
The authenticity of host '192.168.42.1. (192.168.42.1)' can't be established.
ED25519 key fingerprint is SHA256:sfqq5/VjPb++J6gD4Q8/JxUn6u2geewQcqPwIjJHiF4.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:809: [hashed name]
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.42.1.' (ED25519) to the list of known hosts.
root@192.168.42.1.'s password: ### milkv
[root@milkv-duo]~#

[root@milkv-duo]~# cat /proc/cpuinfo
processor	: 0
hart		: 0
isa		: rv64imafdvcsu
mmu		: sv39

[root@milkv-duo]~# uname -a
Linux milkv-duo 5.10.4-tag- #1 PREEMPT Thu Jun 6 14:28:13 CEST 2024 riscv64 GNU/Linux
[root@milkv-duo]~# free
              total        used        free      shared  buff/cache   available
Mem:         330960       22516      296692         148       11752      300580
Swap:             0           0           0

buildroot

dpavlin@nuc:/nuc/milkv-duo/duo-buildroot-sdk$ ./build.sh milkv-duos-sd

...

 create partition mounting points and move sytems to read-write partitions
  [TARGET] br-rootfs-pack
make -C /nuc/milkv-duo/duo-buildroot-sdk/buildroot-2021.05 milkv-duos-sd_musl_riscv64_defconfig BR2_TOOLCHAIN_EXTERNAL_PATH=/nuc/milkv-duo/duo-buildroot-sdk/host-tools/gcc/riscv64-linux-musl-x86_64
make[1]: Entering directory '/nuc/milkv-duo/duo-buildroot-sdk/buildroot-2021.05'
  GEN     /nuc/milkv-duo/duo-buildroot-sdk/buildroot-2021.05/output/milkv-duos-sd_musl_riscv64/Makefile
#
# configuration written to /nuc/milkv-duo/duo-buildroot-sdk/buildroot-2021.05/output/milkv-duos-sd_musl_riscv64/.config
#
make[1]: Leaving directory '/nuc/milkv-duo/duo-buildroot-sdk/buildroot-2021.05'
/nuc/milkv-duo/duo-buildroot-sdk/buildroot-2021.05/utils/brmake -j16 -C /nuc/milkv-duo/duo-buildroot-sdk/buildroot-2021.05
2025-01-24T13:36:30 >>> host-util-linux 2.36.2 Building
Done in 10s  (error code: 2)
make: *** [Makefile:597: br-rootfs-pack] Error 2
Error: Build board milkv-duos-sd failed!
dpavlin@nuc:/nuc/milkv-duo/duo-buildroot-sdk$

huh, Debian sid build doesn't work. Build with docker and Ubuntu 22.04 works.

docker run --privileged -itd --name duodocker -v $(pwd):/home/work milkvtech/milkv-duo:latest /bin/bash

docker exec -it duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build.sh milkv-duos-musl-riscv64-sd"

Duo 256M

debian

https://community.milkv.io/t/debian-images-for-duo256-duos/1715

https://github.com/Fishwaldo/sophgo-sg200x-debian

persisatnt cdc ncm mac address

[root@milkv-duos]~# grep -C 2 c0:ff /etc/run_usb.sh
  if [ "$CLASS" = "ncm" ] ; then
    # FIXME dpavlin
    echo c0:ff:e0:00:00:44 >$CVI_GADGET/functions/$CLASS.usb$FUNC_NUM/host_addr
    ln -s $CVI_FUNC/ncm.usb$FUNC_NUM $CVI_GADGET/configs/c.1
  fi

  • isb rom mode
dpavlin@nuc:/nuc/milkv-duo/duo-buildroot-sdk-v2/build$ ./tools/cv181x/usb_dl/rom_usb_dl/cv181x_rom_usb_download.py
fip_path: /nuc/milkv-duo/duo-buildroot-sdk-v2/build/fip.bin
CV181X USB download start
Connecting to ROM


camera

raspberry pi camera

It does not work as well as gc2083

[root@milkv-duo]/mnt/data# uname -a
Linux milkv-duo 5.10.4-tag- #1 SMP PREEMPT Mon Dec 9 10:20:52 CST 2024 aarch64 GNU/Linux
[root@milkv-duo]/mnt/data# ls -al
total 28
drwxr-xr-x 2 root root 4096 Dec  6  2024 .
drwxr-xr-x 6 root root 4096 Dec  6  2024 ..
lrwxrwxrwx 1 root root   21 Dec  6  2024 sensor_cfg.ini -> sensor_cfg_GC2083.ini
-rw-r--r-- 1 root root  262 Dec  6  2024 sensor_cfg_GC2083.ini
-rw-r--r-- 1 root root  259 Dec  6  2024 sensor_cfg_OV5647_J1.ini
-rw-r--r-- 1 root root  259 Dec  6  2024 sensor_cfg_OV5647_J2.ini
-rw-r--r-- 1 root root  263 Dec  6  2024 sensor_cfg_SC035HGS.ini
-rw-r--r-- 1 root root  259 Dec  6  2024 sensor_cfg_SC200AI.ini


root@milkv-duo]~# i2cdetect -y 1
Warning: Can't use SMBus Quick Write command, will skip some addresses
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:
10:
20:
30: -- -- -- -- -- -- -- --
40:
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60:
70:
[root@milkv-duo]~# i2cdetect -y 2
Warning: Can't use SMBus Quick Write command, will skip some addresses
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:
10:
20:
30: -- -- -- -- -- -- 36 --
40:
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60:
70:
[root@milkv-duo]~# cd /mnt/data/
[root@milkv-duo]/mnt/data# ls
sensor_cfg.ini         sensor_cfg_OV5647_J1.ini  sensor_cfg_SC035HGS.ini
sensor_cfg_GC2083.ini  sensor_cfg_OV5647_J2.ini  sensor_cfg_SC200AI.ini
[root@milkv-duo]/mnt/data# grep 36 *
sensor_cfg_OV5647_J1.ini:sns_i2c_addr = 36
sensor_cfg_OV5647_J2.ini:sns_i2c_addr = 36

# this is error prodced on v2 sdk which doesn't work

[root@milkv-duo]/mnt/system/usr/bin# ./sample_sensor_test
[sys_vi_init]-59: MMF Version:7d0dea0a1-64bit
[SAMPLE_COMM_SNS_ParseIni]-2168: Parse /mnt/data/sensor_cfg.ini
[parse_source_devnum]-1761: devNum =  1
[parse_sensor_name]-1842: sensor =  OV_OV5647_MIPI_2M_30FPS_10BIT
[parse_sensor_busid]-1871: bus_id =  3
[parse_sensor_i2caddr]-1882: sns_i2c_addr =  36
[parse_sensor_mipidev]-1893: mipi_dev =  0
[parse_sensor_laneid]-1904: Lane_id =  2, 0, 1, -1, -1
[parse_sensor_pnswap]-1915: pn_swap =  0, 0, 0,  0,  0
[sys_vi_init]-70: Parse complete
[sys_vi_init]-129: set VBpool [0] 1920:1080, BlkCnt= 3, Size = 3133440
family ID request : receive error
ISP Vipipe(0) Allocate pa(0x962f1000) va(0x0x7f9bba3000) size(284104)
stSnsrMode.u16Width 1920 stSnsrMode.u16Height 1080 30.000000 wdrMode 0 pstSnsObj 0x5dcd00
[SAMPLE_COMM_VI_StartMIPI]-494: sensor 0 stDevAttr.devno 0
[sys_vi_init]-163: vi init failed. s32Ret: 0xffffffff !

[root@milkv-duo]/mnt/data# ln -sf sensor_cfg_OV5647_J2.ini sensor_cfg.ini

# this is working output on v1 sdk

[root@milkv-duo]~# /mnt/system/usr/bin/sensor_test
[sys_vi_init]-41: MMF Version:7e0cc6a08-musl_riscv64
[SAMPLE_COMM_SNS_ParseIni]-1950: Parse /mnt/data/sensor_cfg.ini
[parse_source_devnum]-1605: devNum =  1
[parse_sensor_name]-1686: sensor =  OV_OV5647_MIPI_2M_30FPS_10BIT
[parse_sensor_busid]-1714: bus_id =  2
[parse_sensor_i2caddr]-1725: sns_i2c_addr =  36
[parse_sensor_mipidev]-1736: mipi_dev =  0
[parse_sensor_laneid]-1747: Lane_id =  5, 3, 4, -1, -1
[parse_sensor_pnswap]-1758: pn_swap =  0, 0, 0,  0,  0
[SAMPLE_PLAT_SYS_INIT]-72: common pool[0] BlkSize 3133440
ISP Vipipe(0) Allocate pa(0x97b1f000) va(0x0x3fda046000) size(291120)
stSnsrMode.u16Width 1920 stSnsrMode.u16Height 1080 30.000000 wdrMode 0 pstSnsObj 0xef898
[SAMPLE_COMM_VI_StartMIPI]-483: sensor 0 stDevAttr.devno 0
awbInit ver 6.8@2021500
0 R:1400 B:3100 CT:2850
1 R:1500 B:2500 CT:3900
2 R:2300 B:1600 CT:6500
Golden 1024 1024 1024
WB Quadratic:0
isWdr:0
19700101 02:29:34.620 2892 E isp setNoiseProfile:3460 Noise profile get fail. Please check
ViPipe:0,===OV5647 1080P 30fps 10bit LINE Init OK!
********************************************************************************
cvi_bin_isp message
gerritId:      36403          commitId:      c69c5863e
md5:           cab880835a2ad5184de5ed7762404b84
sensorNum      1
sensorName0    22087

PQBIN message
gerritId:      80171          commitId:      5c9d8fc5d
md5:           ba5a510e093ad42db6788e6c2d13169e
sensorNum      3
sensorName0    2053

author:        wanqiang.he    desc:          思博慧CV1812H_GC2083_RGB_mode_V1.0.0
createTime:    2023-08-04 16:48:08version:       V1.1
tool Version:       v3.0.5.24           mode:
********************************************************************************
sensorName(0) mismatch, mwSns:22087 != pqBinSns:2053
[SAMPLE_COMM_ISP_Thread]-95: ISP Dev 0 running!
0 R:1165 B:3087 CT:2688
1 R:1464 B:2327 CT:3937
2 R:1974 B:1613 CT:7225
Golden 1464 1024 2327
wdrLEOnly:1
[main]-578: ---Basic------------------------------------------------
[main]-579: 1: dump vi raw frame
[main]-580: 2: dump vi yuv frame
[main]-581: 3: set chn flip/mirror
[main]-582: 4: linear wdr switch
[main]-583: 5: AE debug
[main]-584: 6: sensor dump
[main]-585: 7: sensor proc
[main]-586: 255: exit
[main]-587: input your choice: 255
ISP Vipipe(0) Free pa(0x97b1f000) va(0x0x3fda046000)

[root@milkv-duo]~# camera-test.sh

This only works with original v1 version of sdk https://github.com/milkv-duo/duo-buildroot-sdk/releases

gc2083

[root@milkv-duos]~# i2cdetect -y 3
Warning: Can't use SMBus Quick Write command, will skip some addresses
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:
10:
20:
30: -- -- -- -- -- -- -- 37
40:
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60:
70:

[root@milkv-duos]~# ls -al /mnt/data/sensor_cfg.ini
lrwxrwxrwx 1 root root 21 Jan  1 00:01 /mnt/data/sensor_cfg.ini -> sensor_cfg_GC2083.ini

[root@milkv-duos]~# which camera-test.sh
/mnt/system/usr/bin/camera-test.sh

[root@milkv-duos]~# cat /mnt/system/usr/bin/camera-test.sh
#!/bin/sh

export LD_LIBRARY_PATH=/mnt/system/lib

sample_vi_fd /mnt/cvimodel/scrfd_768_432_int8_1x.cvimodel

run yolo model

[root@milkv-duos]~# ./sample_vi_od yolov3 yolov3.cvimodel

[SAMPLE_COMM_SNS_ParseIni]-1950: Parse /mnt/data/sensor_cfg.ini
[parse_source_devnum]-1605: devNum =  1
[parse_sensor_name]-1686: sensor =  GCORE_GC2083_MIPI_2M_30FPS_10BIT
[parse_sensor_busid]-1714: bus_id =  3
[parse_sensor_i2caddr]-1725: sns_i2c_addr =  37
[parse_sensor_mipidev]-1736: mipi_dev =  0
[parse_sensor_laneid]-1747: Lane_id =  2, 0, 1, -1, -1
[parse_sensor_pnswap]-1758: pn_swap =  0, 0, 0,  0,  0
MMF Version:7e0cc6a08-musl_riscv64
Create VBPool[0], size: (3110400 * 3) = 9331200 bytes
Create VBPool[1], size: (3110400 * 3) = 9331200 bytes
Create VBPool[2], size: (2359296 * 1) = 2359296 bytes
Total memory of VB pool: 21021696 bytes
Initialize SYS and VB
Initialize VI
ISP Vipipe(0) Allocate pa(0x9680e000) va(0x0x3fbd57e000) size(291120)
stSnsrMode.u16Width 1920 stSnsrMode.u16Height 1080 25.000000 wdrMode 0 pstSnsObj 0x3fbe3d0860
[SAMPLE_COMM_VI_StartMIPI]-483: sensor 0 stDevAttr.devno 0
awbInit ver 6.8@2021500
0 R:1400 B:3100 CT:2850
1 R:1500 B:2500 CT:3900
2 R:2300 B:1600 CT:6500
Golden 1024 1024 1024
WB Quadratic:0
isWdr:0
ViPipe:0,===GC2083 1080P 30fps 10bit LINE Init OK!===
********************************************************************************
cvi_bin_isp message
gerritId:      36403          commitId:      c69c5863e      
md5:           cab880835a2ad5184de5ed7762404b84
sensorNum      1              
sensorName0    2083           

PQBIN message
gerritId:      80171          commitId:      5c9d8fc5d      
md5:           ba5a510e093ad42db6788e6c2d13169e
sensorNum      3              
sensorName0    2053           

author:        wanqiang.he    desc:          思博慧CV1812H_GC2083_RGB_mode_V1.0.0
createTime:    2023-08-04 16:48:08version:       V1.1           
tool Version:       v3.0.5.24           mode:      
********************************************************************************
sensorName(0) mismatch, mwSns:2083 != pqBinSns:2053
[SAMPLE_COMM_ISP_Thread]-95: ISP Dev 0 running!
Initialize VPSS
---------VPSS[0]---------
Input size: (1920x1080)
Input format: (19)
VPSS physical device number: 1
Src Frame Rate: -1
Dst Frame Rate: -1
    --------CHN[0]-------
    Output size: (1920x1080)
    Depth: 1
    Do normalization: 0
        Src Frame Rate: -1
        Dst Frame Rate: -1
    ----------------------
    --------CHN[1]-------
    Output size: (1920x1080)
    Depth: 1
    Do normalization: 0
        Src Frame Rate: -1
        Dst Frame Rate: -1
    ----------------------
------------------------
Bind VI with VPSS Grp(0), Chn(0)
Attach VBPool(0) to VPSS Grp(0) Chn(0)
Attach VBPool(1) to VPSS Grp(0) Chn(1)
Initialize VENC
venc codec: h264
venc frame size: 1920x1080
Initialize RTSP
rtsp://169.254.72.208/h264
prio:0
version: 1.4.0
yolove416opt Build at 2024-12-03 01:10:02 For platform cv181x
Max SharedMem size:8306688
Enter TDL thread
Enter encoder thread
0 R:1165 B:3087 CT:2688
1 R:1464 B:2327 CT:3937
2 R:1974 B:1613 CT:7225
Golden 1464 1024 2327
wdrLEOnly:1
obj count: 0, take 473.42,width:1920 ms
obj count: 2, take 474.43,width:1920 ms
^Chandle signal, signo: 2
Exit encoder thread
Exit TDL thread
destroy middleware
ISP Vipipe(0) Free pa(0x9680e000) va(0x0x3fbd57e000)
stop VPSS (0)
[root@milkv-duos]~# 

tdl

https://milkv.io/docs/duo/application-development/tdl-sdk/tdl-sdk-introduction


permalink
Raspberry Pi Camera
permalink
Ikea Zigbee

https://zigbee.blakadder.com/index.html

rodret dimmer

To pair the device, reset the device by pressing the pair button exactly 4 times quickly. Then trigger the configuration of the zigbee-device by holding the pair button for 10 seconds.

traderi led

pair by turning it off and on 6 times in quick succession

https://www.youtube.com/watch?v=mJm9YpPrGzk

vallhorn pir

push the vallhorn device link button 4 times in max 5 sec

Stoftmoln light

urn off and on 1 second between 6 times I think or 5.

permalink
CH552G

https://altbier.us/ch552g/Intro_to_the_CH552G_Microcontroller.pdf

RGB micropad 3 keys 1 rotary encoder

RGB micropad with three buttons and rotary encoder based on CH552G

https://github.com/eccherda/ch552g_mini_keyboard/

https://hackaday.io/project/189914-rgb-macropad-custom-firmware

https://github.com/biemster/3keys_1knob

fork with hid sending (which somehow doesn't work) https://github.com/mgrenonville/3keys_1knob/tree/serial

fork with ability to send sequence of keys (with different eeprom config) https://github.com/MrGeorgeK55/Macropad-3-keys-1-knob

flashing tools

https://github.com/MarsTechHAN/ch552tool

https://github.com/rgwan/librech551

https://github.com/frank-zago/isp55e0 - can read and write flash data

usb original

[Thu Dec 12 11:24:45 2024] usb 3-3.3.4.4: new full-speed USB device number 28 using xhci_hcd
[Thu Dec 12 11:24:45 2024] usb 3-3.3.4.4: New USB device found, idVendor=1189, idProduct=8890, bcdDevice= 0.00
[Thu Dec 12 11:24:45 2024] usb 3-3.3.4.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[Thu Dec 12 11:24:45 2024] input: HID 1189:8890 as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.0/0003:1189:8890.0022/input/input70
[Thu Dec 12 11:24:46 2024] hid-generic 0003:1189:8890.0022: input,hidraw6: USB HID v1.11 Keyboard [HID 1189:8890] on usb-0000:00:14.0-3.3.4.4/input0
[Thu Dec 12 11:24:46 2024] usbhid 3-3.3.4.4:1.1: couldn't find an input interrupt endpoint
[Thu Dec 12 11:24:46 2024] input: HID 1189:8890 Keyboard as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.2/0003:1189:8890.0023/input/input71
[Thu Dec 12 11:24:46 2024] hid-generic 0003:1189:8890.0023: input,hidraw7: USB HID v1.00 Keyboard [HID 1189:8890] on usb-0000:00:14.0-3.3.4.4/input2
[Thu Dec 12 11:24:46 2024] input: HID 1189:8890 as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.3/0003:1189:8890.0024/input/input72
[Thu Dec 12 11:24:46 2024] hid-generic 0003:1189:8890.0024: input,hidraw8: USB HID v1.10 Mouse [HID 1189:8890] on usb-0000:00:14.0-3.3.4.4/input3

after shoring unpopulated pad on bottom of board and plugging back in to enter bootloader mode

[Thu Dec 12 11:31:40 2024] usb 3-3.3.4.4: new full-speed USB device number 29 using xhci_hcd
[Thu Dec 12 11:31:40 2024] usb 3-3.3.4.4: New USB device found, idVendor=4348, idProduct=55e0, bcdDevice= 2.40
[Thu Dec 12 11:31:40 2024] usb 3-3.3.4.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0

Arduino

After compiling and flashing doesn't work with error because of permissions to device in bootloader mode.

Re-run flashing command with sudo:

dpavlin@nuc:~$ sudo /home/dpavlin/.arduino15/packages/CH55xDuino/tools/MCS51Tools/2023.10.10/linux/vnproch55x -r 2 -t CH552 -c 3 /tmp/arduino_build_734169/ch552g_mini_keyboard.ino.hex
------------------------------------------------------------------
CH55x Programmer by Deqing
Updated on: 2023/10/10
------------------------------------------------------------------
usbRertySeconds 2
target: CH552
config bytes: 3
Load file as hex
   Loaded 12673 bytes between: 0000 to 31CE
DeviceVersion of CH55x: 2.40
MCU ID: 52 11
Found Device CH552
Bootloader: 2.4.0
ID: 4E 8F 51 BC
XOR Mask: EA EA EA EA EA EA EA 3C
Write 12751 bytes from bin file.
..................................................
Write complete!!!
Verify chip
..................................................
Verify complete!!!
------------------------------------------------------------------
Reset OK

dpavlin@nuc:~$ 

[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: USB disconnect, device number 29
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: new full-speed USB device number 30 using xhci_hcd
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: New USB device found, idVendor=1209, idProduct=c55d, bcdDevice= 1.00
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: Product: CH55xduino
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: Manufacturer: Deqing
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: SerialNumber: CH55x kbd mos
[Thu Dec 12 11:36:59 2024] input: Deqing CH55xduino Keyboard as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.0/0003:1209:C55D.0025/input/input73
[Thu Dec 12 11:36:59 2024] input: Deqing CH55xduino Mouse as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.0/0003:1209:C55D.0025/input/input74
[Thu Dec 12 11:36:59 2024] hid-generic 0003:1209:C55D.0025: input,hidraw6: USB HID v1.10 Keyboard [Deqing CH55xduino] on usb-0000:00:14.0-3.3.4.4/input0
[Thu Dec 12 14:40:42 2024] input: WH-1000XM5 (AVRCP) as /devices/virtual/input/input75

better yet, copy udev rules

dpavlin@nuc:~/.arduino15/packages/CH55xDuino/tools/MCS51Tools/2023.10.10$ sudo cp -v linux/99-ch55xbl.rules /etc/udev/rules.d/
'linux/99-ch55xbl.rules' -> '/etc/udev/rules.d/99-ch55xbl.rules'

root@nuc:~# udevadm control --reload-rules && udevadm trigger
permalink
Zengge
Zengge-board.jpg

https://www.home-assistant.io/integrations/zengge/ -- doesn't work

https://github.com/home-assistant/core/issues/124083 -- LEDnetWF BLE seems to work

But changing settings in home assistant bricked device. Fix it by shorting button pins on board.

https://play.google.com/store/apps/details?id=com.zengge.blev2

08:65:F0:62:19:5c

https://github.com/8none1/zengge_lednetwf

permalink
Ikea
permalink
Xiaomi Mijia Bluetooth Thermometer


info

https://hackaday.com/2020/12/08/exploring-custom-firmware-on-xiaomi-thermometers/

https://github.com/atc1441/ATC_MiThermometer

https://github.com/pvvx/ATC_MiThermometer

 Xiaomi Smart LCD Screen Digital Thermometer 2 Mijia Bluetooth Temperature Humidity Sensor Moisture Meter Mijia App

https://www.aliexpress.com/item/1005002401046796.html

LYWSD03MMC

decode using gatttool

https://ndimension.design.blog/2021/12/16/reading-data-from-xiaomi-mi-temperature-and-humidity-monitor-2-lywsd03mmc/

root@rpi2:/home/pi# sudo hcitool lescan
LE Scan ...
A4:C1:38:D8:3F:9C ATC_D83F9C


open source firmware

https://github.com/bentolor/xiaomi-mijia-bluetooth-firmware

simple shell to send reading to influx

https://github.com/dpavlin/air-quality/blob/master/ble-mijia.sh

https://github.com/dpavlin/air-quality/blob/master/system/ble-mijia%40.service

https://www.youtube.com/watch?v=NXKzFG61lNs

Home Assistant

connected to home assistant using https://esphome.github.io/bluetooth-proxies/

get bindkey using https://atc1441.github.io/TelinkFlasher.html

https://esphome.io/components/sensor/xiaomi_ble.html?highlight=xiaomi_ble#obtaining-the-bindkey

[core-ssh ~]$ tail -18 config/.storage/core.config_entries
      {
        "entry_id": "574243c45c4485523ec174e18cfcf1ad",
        "version": 1,
        "domain": "xiaomi_ble",
        "title": "Temperature/Humidity Sensor DC63 (LYWSD03MMC)",
        "data": {
          "bindkey": "a6da0c1d99200efe9c9afb8fd9a534ef"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "bluetooth",
        "unique_id": "A4:C1:38:90:DC:63",
        "disabled_by": null
      }
    ]
  }

flash new firmware to sensor https://github.com/pvvx/ATC_MiThermometer

open in chrome on android to flash firmware,
change announcement to BTHome,
set time,
disconnect to start sending data to home assistant

flashing serial port

pinout https://github.com/atc1441/ATC_MiThermometer/blob/master/Mi_SWS_Connection.jpg

DTR - 3V3 (so that reset works)
GND - GND
TX - P14 - SWS

https://pvvx.github.io/ATC_MiThermometer/USBCOMFlashTx.html

https://github.com/pvvx/TlsrComSwireWriter

https://github.com/pvvx/ATC_MiThermometer?tab=readme-ov-file#the-usb-com-adapter-writes-the-firmware-in-explorer-web-version

reed switch

https://github.com/pvvx/ATC_MiThermometer?tab=readme-ov-file#reed-switch-or-button-functions

It is possible to solder a reed switch on the LYWSD03MMC board to the pins marked "P8" (GPIO PA6) and GND.

permalink
ebus
permalink
Weblog Navigation
Loading...
Weblog Archives
  • Loading...