Dahua DH-HAC-HDW1801MP-0280B how I changed mode back to HDCVI via serial connection

just1time

n3wb
Nov 3, 2023
7
0
somewhere
Hi, I have analog camera Dahua DH-HAC-HDW1801MP-0280B. I switched mode and can't get it back into the CVI mode from CVBS.
I know about device PFM 820 but people says its not workin with 8mp cameras, and it costs almost like my camera. So I started experimenting with cam.
I found information on another forum "Unbricking your Dahua IP camera" thread, but its about IP cameras and not working for me at all. some usefull information was there and here :
- serial interface the same 1.RX 2.TX 3.GND 4.VCC
  • to enter in comand line hold the "*" key
  • "?" help
  • few commands working
I'm using arduino mega with serial passthrough example from the library to connect camera to the pc
Here is the outpoot on boot:
Code:
RGD FlashID : c81640c8
start miniboot...
swdg reset
u8SlaveToMasterFlag = 0X0
u8IsHdcviUpdateSucc = 0x0
check uptate strategy and '*'
check master image!
check master img ok!
copy to DDR
lu32Len = 0x13fff0
J

And if I press"*" I'm enetering to cmd :
Code:
RGD FlashID : c81640c8
start miniboot...
power reset
u8MasterToSlaveFlag = 0x0
check uptate strategy and '*'
IO_init.
Entery cmdline or wait upminib #

minib # ?
md: md [addr] [len]
pri: printf
?: for help
exit: exit cmd line !
minib #

minib # pri
UpdateByHdcviFlag = 0x0
SlaveToMasterFlag = 0x0
MasterToSlaveFlag = 0x0
DeviceName:

minib #
minib # set dh_keyboard 0
set key = 0x0
minib #
minib # set dh_keyboard 1
set key = 0x1
minib #
minib # md 0x13fff0

00000002: 00    ................
2000bf46: 00    ................
40017e8a: 8c    ................
60023dce: 63    c...............
8002fd12: 29    )...............
a003bc56: 66    f...............
c0047b9a: 28    (...............
e0053ade: 00    ................
0005fa22:

So i can use SET command, I can read memory by MD command and thats all.
"dh_keyboard" is existing parameter , I got answer its related to debug state
I'm sure via SET command possible to switch mode back to CVI, but I dont know name of the variable.
maybe I could find out something if I had the decrypted firmware
Hope this information would be usefull for someone who can do more, my knowledge is not enough to continue
maybe someone who has a PFM820 can listen to the exchange between the camera and this device and share the information
 
Last edited:
Looks like i switched debug state, itried this before but its not worked, and now I've got more information on boot:
Code:
start miniboot...
power reset
u8MasterToSlaveFlag = 0x0
check uptate strategy and '*'

check master image!
K⸮check master img ok!
copy to DDR
lu32Len = 0x13fff0
J[0;32;32m[cannon] Sensor hardware reset
[m[0;32;32m[cannon] Product Name: HAC-HFW1801T
[m[0;32;32m[] INFO (DH_SEN_SetFormat|9150): SEN:-> ----- Set format 42 -----
[m[0;32;32m[] INFO (DH_SEN_SetFormat|9151): running timing format =-1.
[m[0;32;32m[] INFO (DH_SEN_SetFormat|9172): timing Format set to id: 42 success!
[m[0;32;32m[cannon] Init isp ok!
[m(VPS_Init|2252) Vps is already init.
[0;32;32m[cannon] Init vps ok!
[m[AEW]:productInfo.nSensorId=23

AEW]: ALG_sensorCfg:LINEAR Mode,DNC_MULTICOLOR
[AEW]ALG_aeInit:framerate:25, block=1, normal_line_max=4790, line_min:8, line_max:4790, gain_min:0, gain_max:1023, gain_step:10

[AEW] set_value_aew_n:64,64,29,77,0,0,3456,1944
[AEW]CCM:1620,-736,140,-172,1548,-352,84,-580,1520

[0;32;32m[cannon] Init AEWB ok!
[m[0;32;32m[HDC-APP] SVN NUM: 32134.

[m[0;32;32m[HDC-APP] CFG_ADDR_DEFAULT 205000
[m[0;32;32m[HDC-APP] read : addr 205010 ,size 2607[m[0;32;32m[HDC-APP] addr 205010 ,size 2607[m[0;35m[HDC-APP] Config[0] is loading...
[m[0;32;32m[HDC-APP] CFG_ADDR_MAIN 201000
[m[0;32;32m[HDC-APP] read : addr 201010 ,size 3256[m[0;32;32m[HDC-APP] addr 201010 ,size 3256[m[0;35m[HDC-APP] Config[1] is loading...
[m[0;32;32m[HDC-APP] sync cfg from MAIN to BAK
[m[0;32;32m[HDC-APP] Back same with Main!
[m[0;35m[HDC-APP] Support hdcvi comm!
[m[0;32;32m[libial] Succeed to create IAL lib.
[m[0;35m[HDC-APP] Support hdcvi comm!
[m[0;35m[libmenu.a] SVN NUM: 31962.

[m[0;32;32m[libmenu.a] OSD_fontInit,0x208000
[m[0;32;32m[libgui]
[m[0;32;32m[libgui] libGUI Build on Oct 12 2017 at 17:29:48.
[m[0;32;32m[libgui] Set color map ...
[m[0;35m[libmenu.a] MENU_create OK

[m[0;32;32m[libgui]
[m[0;32;32m[libgui] libGUI Build on Oct 12 2017 at 17:29:48.
[m[0;32;32m[libgui] Set color map ...
[m(VPS_CAL_InitOsd|1089) VpsGrp[0], VpsChn[1] Osd has already init.
PDI_wdtOpen sucess!
[AEW]Msg Vstd:standard[8202]
[0;32;32m[cannon] in formatmode:30  !!!!!!!!!!
[m[0;32;32m[cannon] DH_SEN_SetFormat 3840,2160,15
[m[0;32;32m[] INFO (DH_SEN_SetFormat|9150): SEN:-> ----- Set format 42 -----
[m[0;32;32m[] INFO (DH_SEN_SetFormat|9151): running timing format =42.
[m[0;32;32m[] INFO (DH_SEN_SetFormat|9172): timing Format set to id: 42 success!
[m[0;32;32m[cannon] InWidth:3840 ,InHeight:2160 ,OutWidth:3840 ,OutHeight:2160
[m[0;32;32m[cannon] u32InWidth =3840
[m[0;32;32m[cannon] HDCVI:37
[m[0;32;32m[cannon] VouDev 1 0
[mSetColorBurst VIDEO_HDCVI
[AEW]Msg Color:brightness[7],ctr[7],hue[7],sat[7],sharpness[7],gamlevel[7],sharpsuppress[7],chomasuppress[7],color[0]
[AEW]Msg Awb:awbMode[1],rCustom[50],bCustom[50],nRoiNum[0],left[0],top[0],right[0],bottom[0]
[AEW]Msg Ae:aeMode[0],antiFlicker[0],slow_shutter_switch[0],apert_auto_switch[0],expMax[33.299999],expMin[0.000000],gainMax[12],gainMin[0],evdefault[7],evdefaultLow[7],smartIrEnable[1],irEvWeight[5]
[AEW]Msg AeMode:meterMode[0],level[0],nRoiNum[0],left[0],top[0],right[0],bottom[0]
[AEW]Msg DayNight:day_night_mode[1],c2bThr[6],b2cThr[12],waitingTime[2]
[AEW]Msg Nr2D:nr2dLevel[7],enable[1]
[0;32;32m[libial] send IAL_setNr3d
[m[AEW]Msg Nr3D:nr3dLevel[7],enable[1]
mirrorMode:0     !
[0;32;32m[HDC-APP] DevInfo lang=4, name=00000000
[m[AEW]Msg:appMsg->msgData.debugParam=100,appMsg->msgData.debugParam.temperlog=1
[0;35m[HDC-APP] call IAL_setDefog
[m[0;32;32m[libial] IAL_setDefog Mode:0,Level:1
[m[AEW]Msg Defog:defogMode[0],defogLevel[1]
[0;32;32m[cannon] Init dbg ok!
[m[0;32;32m[cannon] HDCVI app starts OK!
[m[0;32;32m[cannon] version is V1.0.0000001.1.R.190608
[m[AEW]ae mode change!
[AEW]:2A Start OK!!
sky mode !!!

[AEW]ICR:frame_rate=25.000000 , waitingTime=2,daynight_frames=4000,day_2_night_thr=180,night_2_day_thr=360

[AEW]:productInfo.nSensorId=23

[AEW]: ALG_sensorCfg:LINEAR Mode ,DNC_BLACKWHITE!
[AEW]ALG_aeInit:framerate:15, block=1, normal_line_max=5170, line_min:8, line_max:5170, gain_min:0, gain_max:1023, gain_step:10

[AEW] set_value_aew_n:128,120,29,77,0,0,3840,2160
[AEW]CCM:1588,-812,248,-16,1588,-548,140,-1188,2068

[0;32;32m[cannon] reduce noise module init successfully!
[m[AEW]ae mode change!
[AEW]:2A Start OK!!
[AEW]ICR:frame_rate=15.000000 , waitingTime=2,daynight_frames=1600,day_2_night_thr=180,night_2_day_thr=360

SetColorBurst VIDEO_HDCVI
[AEW]:ALG_firstIcrSet: change to NightMode!

SetColorBurst VIDEO_HDCVI
[AEW]:change to NightMode!

[AEW]:productInfo.nSensorId=23

[AEW]: ALG_sensorCfg:LINEAR Mode ,DNC_BLACKWHITE!
[AEW]ALG_aeInit:framerate:15, block=1, normal_line_max=5170, line_min:8, line_max:5170, gain_min:0, gain_max:1023, gain_step:10

[AEW] set_value_aew_n:128,120,29,77,0,0,3840,2160
[AEW]CCM:1024,0,0,0,1024,0,0,0,1024

[AEW]ae mode change!
[AEW]:2A Start OK!!
[AEW]ICR:frame_rate=15.000000 , waitingTime=2,daynight_frames=1600,day_2_night_thr=180,night_2_day_thr=360

[0;32;32m[HDC-APP] device name is HAC-HFW1801T
[m
 
Now I have more commands, but not sure what to do :rolleyes:
Code:
[m***
[1;33m[cannon] WARN  : invalid cmd
[m[0;32;32m[cannon] help                 : help
[m[0;32;32m[cannon] mem                  : <r|w> <addr> <val>
[m[0;32;32m[cannon] sensor               : <r|w|i> <addr> <val>
[m[0;32;32m[cannon] irq                  : print irq cnt
[m[0;32;32m[cannon] thread               : print thread info
[m[0;32;32m[cannon] osd                  : <str> <idx> <x> <y>
[m[0;32;32m[cannon] mask                 : <id> <x> <y> <w> <h>
[m[0;32;32m[cannon] key                  : <l|r|u|d|e>
[m[0;32;32m[cannon] flash                : <e|w>
[m[0;32;32m[cannon] raw                  : [0-2]: 0-linear or HDR short1-HDR long 2-HDR Dow 10-YUV
[m[0;32;32m[cannon] fmt                  : [0-20]: 0-CVI_1080P@25 1-CVI_1080P@30 2-CVI_720P@25 3-CVI_720P@30 4-CVI_720P@50 5-CVI_720P@60 6-CVI_4MP@25 7-CVI_4MP@30 8-CVI_6MP@20 9-CVI_4KP@15 10-960H_PAL 11-960H_NTSC 12-AHD_720P@25 13-AHD_720P@30 14-AHD_1080P@25 15-AHD_1080P@30 16-AHD_4MP@25 17-AHD_4MP@30 18-AHD_5MP@20 19-TVI_720P@25 20-TVI_720P@30 21-TVI_720P@50 22-TVI_720P@60 23-TVI_1080P@25 24-TVI_1080P@30 25-TVI_4MP@25 26-TVI_4MP@30 27-TVI_5MP@20
[m[0;32;32m[cannon] reboot               : reboot system
[m[0;32;32m[cannon] icr                  : set icr state: <0-1>
[m[0;32;32m[cannon] ir                   : set ir pwm: <0-100>
[m[0;32;32m[cannon] adc                  : get adc value
[m[0;32;32m[cannon] audio                : enable audio[0-2]
[m[0;32;32m[cannon] cfg                  : [0-2]: 0-default 1-main 2-back
[m[0;32;32m[cannon] hdcvi                : <0-1>
[m[0;32;32m[cannon] bypass               : <0-1>: enable 2a run
[m[0;32;32m[cannon] image                : [0-10]: 0-OFF 1-AE_PARAM 2-AWB_PARAM 3-ICR_PARAM 4-ISPIMAGE_PARAM 5-EE_PARAM 6-NR_PARAM 7-GAIN_INTER_PARAM 8-CALCEV_PARAM 9-AUTO_DEFOG 10-NULL
[m[0;32;32m[cannon] ram                  : ram
[m[0;32;32m[cannon] hdr                  : hdr <0-1>
[m[0;32;32m[cannon] gpio                 : gpio <0-n> <0-1>
[m[0;32;32m[cannon] pwm                  : pwm <0-10000>
[m[0;32;32m[cannon] i2c                  : i2c r8 devID reg val
[m[0;32;32m[cannon] audreg               : <r|w> <addr> <val>
[m[0;32;32m[cannon] PN                   : <r|w> <addr> <val>
[m[0;32;32m[cannon] AF                   : p 0/1 switch af print,i 0/1 24036/af init,m 0xaaaabbbb zoom/focus pos,a 0 trig af,r 0 len reset,t 0x55 alt mode
[m[0;32;32m[cannon] LOG                  : AF 0-3,AEW 0-3,HDC 0-3,MENU 0-3,ALL 0-1
[m[0;32;32m[cannon] fisheye              : set|get|clr
[m
 
and after some tries I swtched to CVI and turned on OSD menu, but the color is still black and white

Code:
fmt 0
[1;33m[HDC-APP] WARN  (APP_judgeFmtSupport|7797): Unsupported resolution 1000
[m[1;33m[HDC-APP] WARN  (APP_setVideoFormat|7830):  videoFormat is not support
[m
fmt 1
[1;33m[HDC-APP] WARN  (APP_judgeFmtSupport|7797): Unsupported resolution 1001
[m[1;33m[HDC-APP] WARN  (APP_setVideoFormat|7830):  videoFormat is not support
[m
fmt 2
[1;33m[HDC-APP] WARN  (APP_judgeFmtSupport|7797): Unsupported resolution 1002
[m[1;33m[HDC-APP] WARN  (APP_setVideoFormat|7830):  videoFormat is not support
[m
fmt 3
[1;33m[HDC-APP] WARN  (APP_judgeFmtSupport|7797): Unsupported resolution 1003
[m[1;33m[HDC-APP] WARN  (APP_setVideoFormat|7830):  videoFormat is not support
[m

fmt 6
[AEW]Msg Vstd:standard[4102]
[0;32;32m[cannon] in formatmode:6  !!!!!!!!!!
[m[0;32;32m[cannon] DH_SEN_SetFormat 3456,1944,25
[m[0;32;32m[] INFO (DH_SEN_SetFormat|9150): SEN:-> ----- Set format 52 -----
[m[0;32;32m[] INFO (DH_SEN_SetFormat|9151): running timing format =42.
[m[0;32;32m[] INFO (DH_SEN_SetFormat|9172): timing Format set to id: 52 success!
[m[AEW]:productInfo.nSensorId=23

[AEW]: ALG_sensorCfg:LINEAR Mode ,DNC_BLACKWHITE!


From OSD menu I changed resolution to 4K, and image to color.

Happy end.
 
Last edited:
Oh I forgot to turn off debug and already assembled camera
actually I'm not sure how to do it, Iguess it must be
set dh_keyboard 0
or
set dh_keyboard 1

P.S. I also tried in the start command "set appauto " and other variations ( set appauto 0, set appauto 1), but have not received a reply from camera , so I dont know if its needed to turn on debug state
 
Before disassemble your camera try set parameters from your dvr like in "fmt 6"

6-CVI_4MP@25
CVI mode, 25 fps resolution 3456*1944
and check OSD menu.

maybe this is a simple way to solve the problem, I'm not sure. At the beginning I tried to change the parameters, but maybe I missed this one.
my cam is ok now so I don't want to repeat all the way again to see if it works.
 
I played with the camera settings for a while and found the following interesting points:
If you switched to TVI mode, then you can still use the OSD menu during the daytime if the DVR is also set to TVI mode. when the recorder is in auto mode it selects CVI in this case the menu does not work, I checked the “other” checkbox and the menu worked. But at night the menu in TVI mode does not work.
And one more thing related to the previous post. choosing "fmt 6" is not a universal method, apparently it depends on the matching capabilities of the camera and the recorder. It is necessary that both support this resolution and fps.

I hadn’t thought about this before, but now I have a question:
my 4k camera produces 15fps, but the recorder has a maximum fps = 7 at 4k resolution, will the recorder work correctly if the camera resolution is higher than its maximum?