Hikvision DS-1004KI PTZ Keyboard - Reprogramming
You can completly re-write the firmware for your DS1004KI using Arduino IDE and a few extra bits.
You'll need:
Arduino IDE - https://www.arduino.cc/en/software
Modified Libraries - https://github.com/cbradburne/Hikvision-DS1004KI/tree/main/Arduino/libraries
Waveshare STLinkv2 - https://amzn.to/3qEdqnB
STM32CubeProgrammer - https://www.st.com/en/development-tools/stm32cubeprog.html
Philips Screwdriver
Hair dryer - To remove the display's cover, to access hidden screws.
Open Arduino IDE
Open Preferences and paste this link in to the "Additional Boards Manager URLs":
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
Click OK
Click Tools - Board - Boards Manager...
Search for "STM32"
Install - "STM32 MCU based boards"
Click Tools - Board - "Generic STM32F1 series"
Click Tools - Board part number - "Generic F103VDTx"
(Note: the CPU used is actually a STM32F101VDT, but they are pin compatible)
2 libraries are needed. These are slightly modified libraries to work with the LED matrix display.
Copy these folders in to your Arduino libraries folder:
Adafruit-GFX-Library
HT1632
Close Arduino IDE.
macOS:
In your home folder, open "Library" folder (may be hidden, click "View", "Show View Options", check "Show Library Folder").
Open "Arduino15",
Then navigate to the file "HardwareSerial.h" located below:
Open "HardwareSerial.h" in a text editor (Visual Studio Code recommended).
Then change 64 to 256 on lines, 44 & 47.
Before:
After:
Save the file and reopen Arduino IDE.
You should now be able to compile the demo sketch - https://github.com/cbradburne/Hikvision-DS1004KI/tree/main/Arduino/HIKVision_DS-1004KI_github
Click - Sketch - Export complied Binary
When it's finished, click - Sketch - Show Sketch Folder
There should now be a .bin file.
Connect the STMLinkV2 to your computer and DS-1004KI via the 20 pin connector. Pin 1 (red cable) on the the DS-1004KI is top right, and power on the DS-1004KI.
Open STM32CubeProgrammer.
To be continued...