Flashing procedure for ax206 lcd photo frame with dpf-hack

Written by Matej Drolc




A quick summary on how to flash an ax206-based lcd photo frame with “ax-dpf” hacked firmware.

Prerequisites

  • AX206 based LCD photo frame
  • linux (in my case default Kali Linux 1.0.9 VMware 64 bit (amd64) image hosted on windows 8.1 x64)

Procedure

Compile firmware

mirror in case svn disappears

svn checkout svn://svn.code.sf.net/p/dpf-ax/code/trunk dpf-ax-code
cd dpf-ax-code
make all

In best case scenario, that will build firmware images without problems (it also compiles lcd4linux along the way). I encountered a few problems and fixed them with:

  1. automake needed:
    apt-get install automake
    
  2. missing or wrong (too new from apt-get) version of sdcc (2.9 is required): Download source from http://sourceforge.net/projects/sdcc/files/sdcc-linux-x86/2.9.0/ or from mirror.

    tar xjf sdcc-2.9.0-i386-unknown-linux2.5.tar.bz2
    cp -r sdcc/bin /usr/local
    cp -r sdcc/share /usr/local
    
  3. “ImportError: No module named intelhex” in compile.py: Download http://www.bialix.com/intelhex/intelhex-1.5.zip or mirrored.

    python setup.py install
    

Now “make all” completes without errors.

Identify device

Connect the lcd photo frame to the PC and enable usb mode in the photo frame menu (Menu->Usb connect->Yes). In my case /dev/sg2 and /dev/sr1 show up, this is the output of dmesg:

[ 4895.605593] usb 1-2.2: new full-speed USB device number 12 using uhci_hcd
[ 4895.977180] usb 1-2.2: New USB device found, idVendor=1908, idProduct=0102
[ 4895.977186] usb 1-2.2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[ 4895.977189] usb 1-2.2: Product: Digital Photo Frame
[ 4895.977191] usb 1-2.2: Manufacturer: BUILDWIN
[ 4895.977193] usb 1-2.2: SerialNumber: 200807101900000000
[ 4896.002072] usb-storage 1-2.2:1.0: USB Mass Storage device detected
[ 4896.002346] scsi5 : usb-storage 1-2.2:1.0
[ 4897.020217] scsi 5:0:0:0: CD-ROM            buildwin  Photo Frame     1.01 PQ: 0 ANSI: 2
[ 4897.036154] sr1: scsi3-mmc drive: 40x/40x writer cd/rw xa/form2 cdda tray
[ 4897.036771] sr 5:0:0:0: Attached scsi CD-ROM sr1
[ 4897.037868] sr 5:0:0:0: Attached scsi generic sg2 type 5
root@kali:~/Desktop/dpf-ax-code/tools# python identify.py /dev/sr1
Detecting & reading dpf flash...
Opening generic SCSI device '/dev/sr1'
Manufacturer: Macronix
Size        : 2 MB
Reading 200000 bytes from flash...
Flash written to file 'fulldump_20141101-194435.bin'.

Looking for firmware.............: Found (buildwin, 320x240 px).
Looking for Openwin..............: Found.
Looking for LcdIniTbl............: Found.
Looking for backlight & contrast.: Found, Found.
Looking for known signatures.....: Found.

Your dpf is compatible with model ['taobao'].

Ah-ha! Our device corresponds to profile/image named ‘taobao‘.

Or you can do it in two steps:

root@kali:~/Desktop/dpf-ax-code/tools# python fulldump.py /dev/sr1
Opening generic SCSI device '/dev/sr1'
Manufacturer: Macronix
Size        : 2 MB
Reading 200000 bytes from flash...
Flash written to file 'fulldump_20141101-194631.bin'.

root@kali:~/Desktop/dpf-ax-code/tools# python identify.py fulldump_20141101-194631.bin
Looking for firmware.............: Found (buildwin, 320x240 px).
Looking for Openwin..............: Found.
Looking for LcdIniTbl............: Found.
Looking for backlight & contrast.: Found, Found.
Looking for known signatures.....: Found.

Your dpf is compatible with model ['taobao'].

Flashing hacked firmware

root@kali:~/Desktop/dpf-ax-code/tools# python restore.py ../src/fw_taobao.bin -f
Found AX206 DPF
Error: Failed to claim usb device!
Possibly you have to detach the device from hid.
Use hiddetach from the fw folder: 'sudo fw/hiddetach'
                       or libhid: 'sudo libhid-detach-device 1908:3318'
Traceback (most recent call last):
  File "restore.py", line 25, in <module>
    d = dpf.open("usb0")
SystemError: Failed to open port:
Unknown error

We need to enter bootloader mode. Press and hold the reset button, press and hold the menu button, release reset button, wait a second and release menu. The screen should be blank(black) but the device should be detectable via usb.

root@kali:~/Desktop/dpf-ax-code/tools# ./hiddetach 
Detaching dpf at 1-2.2:1.0... done.

root@kali:~/Desktop/dpf-ax-code/tools# python restore.py ../src/fw_taobao.bin -f
Found AX206 DPF (bootloader)
Manufacturer: Macronix
Size        : 2 MB
Erase full flash...
Flashing sector 0...
Flashing sector 1...
Flashing sector 2...
Flashing sector 3...
Flashing sector 4...
Flashing sector 5...
Executing applet..

That’s it. Now you should see a new splash screen together with new menus.

Now you can use lcd4linux to display all sorts of data on it.

Compiling lcd4linux with dpf driver on BeagleBone Black

Tested on debian console img (debian-7.7-console-armhf-2014-10-29).

sudo apt-get install subversion make automake gcc libusb-dev python-dev pkg-config autoconf gettext libtool libjpeg62-dev
sudo ln -s /usr/bin/aclocal /usr/bin/aclocal-1.14
sudo ln -s /usr/bin/automake /usr/bin/automake-1.14
svn checkout svn://svn.code.sf.net/p/dpf-ax/code/trunk dpf-ax-code
cd dpf-ax-code
mkdir lcd4linux
mkdir lcd4linux/m4
cd lcd4linux
autoreconf -fvi
cd ..
make all

It will fail to compile firmware images because it needs sdcc2.9 but it does not matter because those can be prepared on another machine, we only only need to compile lcd4linux and dpf driver to use a DPF frame on the beaglebone. lcd4linux should be run with sudo and make sure the config is chowned to root:root and chmoded to 700.