Skip to content

Reading and writing chip memory

Daniel Doña edited this page Oct 10, 2023 · 1 revision

There are several ways for reading and writing the internal memory of the BK7252 SoC, depending on the situation and the address range we want to target.

If there is still a working bootloader in the SoC, you can try uartprog to read and write in the APP partition, if not you can try to boot into SPI mode and read/write the memory directly using something like flashrom.

Depending on the firmware running can be an option to flash the APP partition from the SD slot using an SD with the firmware file or perform an OTA update from a local or remote HTTP address.

UART

  1. Depending on the PCB version, locate the UART pins RX and TX. Try checking if your PCB is already documented: https://github.com/daniel-dona/beken7252-opencam/wiki/PCB-versions,-pictures-and-pinouts
  2. You will need to solder at least 3 cables to the PCB: RX, TX and some GND point. You can use the USB connector shield as GND or the battery negative terminal. Note: if you are going to power the camera using an USB cable and the USB cable is connected to the same computer as your UART interface, you can skip the GND connection as it's already connected through the USB shield and negative power connection.
  3. Connect the cables to your UART interface or device, remember that RX on your PC goes in TX of the device and the other way around.
  4. To check if the connection is correct, try setting the baudrate to 115200 and turn on the camera, you will see the boot log and maybe additional messages. If you see nothing you'll need to check your connections.
  5. Download the tool here https://github.com/OpenBekenIOT/hid_download_py

Reading

  1. If this is the first time you try to flash the device, make a copy first of the original firmware reading the whole memory:

./uartprogram -l 0x1FFFFF -b 115200 -r -d [your UART device] firmware_dump.bin

You can change the baudrate to a faster one, but 115200 should work in any device even with less than ideal conditions. 7. Repeat the previous step at least 2 or 3 times and check the files are identical with md5sum or sha1sum

Writing

Pending

SPI

Pending

Reading

Writing

HID

Not tested

SD

Not tested yet

OTA

Will be available in the custom firmware

Clone this wiki locally