Disclaimer: This description is completely unofficial, Epson even does not know about its existance. Most of the informaion presented here is discovered by me, Eugene Crosser, while snooping the serial line and by trial and error. I never had an official protocol description, have never seen any related software source code, and have never done reverse engineering of any related software. This description may be incomplete, inaccurate or completely wrong. You are warned.

Some information is taken from `camediaplay' package by Jun-ichiro Itoh <itojun@itojun.org> and from other (open) sources and not checked by me.

Serial Protocol of Some Digital Cameras

Several models of digital cameras, namely Epson, Sanyo, Agfa and Olympus cameras, seem to use the same protocol for communication with the host. Follows the description of the high-level protocol they use over the serial line.

Protocol Basics

The host and the camera exchange with data packets and individual bytes. Serial line paramaters used are: 8bit, no parity. No flow control is used. All arithmetic data is transmitted in the "network order" - least significant byte first.

Protocol Elements

The elementary units of the protocol are:
Initialization ByteNUL 0x00
Action Complete NotificationENQ 0x05
Positive AchnowledgementACK 0x06
Unable to Execute CommandDC1 0x11
Negative Acknowledgement,
also Camera Signature
NAK 0x15
PacketVariable length sequence of bytes
Termination Byte

Packet structure

The packet has the following structure:
01Packet type
11Packet subtype/sequence
22Length of data

Known packet types are:
0x02Data packet that is not last in sequence
0x03Data packet that is last in sequence
0x1bCommand packet

Data packets that are sent in responce to a single command are numbered starting from zero. If all requested data fits in one packet, it has type 0x03 and sequence 0.

Command packet has subtype 0x43 or 0x53. Only the first command packet in a session has subtype 0x53.

Maximum length of data field in a packet is 2048 bytes, which yields in 2054 total packet length.

Checksum is a simple 16 bit arithmetic sum of all bytes in the data field. As already mentioned above, length and checksum values are transmitted least significant byte first.

Flow of Control

A communication session flow is as follows:
Port speed set to 19200 baud
Host sends init byte 0x00
Camera responds with signature 0x15
Host sends command packet with subtype 0x53 and "set speed" command
Camera sends ACK 0x06
Port speed set to the new value
Host sends command
Camera responds with either ACK plus optionally "action taken" notifier or data packet sequence
Host sends ACK to every data packet
... Command - reply cycle repeated ...
Camera sends 0xff and resets after a few seconds (value is model-dependant) of inactivity

If the camera does not respond to a command in reasonable time, or responds with a NAK, the command can be resent. If the camera does not provide a complete data packet in reasonable time, or the data packet is corrupt (checksum does not match), the host can request resending of the packet by sending NAK instead of ACK.

Command format and codes

Command is a sequance of bytes sent in the data field of a command packet. Command format is as follows:
01Command code
11Register number or subcode
2variableOptional argument

Five command codes are known:
0int32Set value of integer register
1noneRead value of integer register
2vdataTake action unrelated to registers
3vdataSet value of vdata register
4noneRead value of vdata register

Commands 1 and 3 are replied with a single ACK 0x06. Command 2 is replied with an ACK 0x06 followed by an "action complete" notifier 0x05. Commands 1 and 4 are replied with a sequence of data packets, each of them must be ACK'ed by the host.

Command 0 must be issued with a 4 byte argument containg the new value for the register (bytes in network order). Command 2 typically is issued with a single zero byte as an argument. Command 3 is issued with an argument of variable number of bytes. If this is a printable string, it should not include the trailing zero byte.

Camera replies to the command 1 with a single data packet containing 4 bytes of a 32bit integer (in network order). Camera replies to the command 4 with a sequence of data packets with variable number of data bytes. Note that if a printable string is returned, it is terminated with a zero byte, and thus may be safely printed or otherwise treated as a normal C language character string.


The following registers are known (read/writablity info is inaccurate):
1int32R/WResolution: 1 - Std, 2 - Hi, 3 - Ext
2int32R/WClock in UNIX time_t format
3int32R/WShutter speed (microseconds)
4int32 WCurrent frame number
5int32R/WUnknown (5)
6int32R/WColor mode: 1 - Color, 2 - B/W
7int32R/WFlash mode: 0 - Auto, 1 - Force, 2 - Off, 3 - Anti RedEye
8int32R/WUnknown (128)
9int32R/WUnknown (128)
10int32R No. of frames taken
11int32R No. of frames left
12int32R Length of current frame *
13int32R Length of current thumbnail *
14vdataR Current frame JFIF data *
15vdataR Current thumbnail JFIF data *
16int32R Battery capacity percentage
17int32 WCommunication speed 1 - 9600 .. 5 - 115200
18int32R Unknown (1)
22vdataR/WCamera I.D.
23int32R/WAutoshut on host timer (seconds)
24int32R/WAutoshut in field timer (seconds)
25vdataR/WSerial No. (string)
26vdataR Version
28int32R Available memory left
29vdataR/WUpload image JFIF data to this register
30vdataR Unknown ("")
31vdataR Unknown ("\0")
32int32R Put "magic spell" 0x0FEC000E here before uploading image data
33int32R/WLens mode: 1 - Macro, 2 - Normal
34int32R Unknown (0)
35int32R LCD brightness 1 to 7
36int32R Unknown (3)
37vdataR Unknown ("\0")
38int32R LCD autoshut timer (seconds)
39int32R Protection state of current frame *
40int32R Unknown (0)
41int32R/WDate format (?)
* Note: registers 12 thru 15 and 39 only become useful for reading after setting register 4. If value of 0 assigned to register 4, subsequent retrieval of picture data gives the "live preview".

For command 2, the second byte is action code not register number. The following action codes are known:
1single zero byteErase all picures
2single zero byteTake picture
4single zero byteFinish session immediately
7single zero byteErase current frame *
9single byteSet protection state of current frame to the value of parameter (binary 0 or 1)*
11single zero byteStore freshly uploaded image into NVRAM
* Note: actions 7 and 9 only useful after setting register 0x04.

Unknown things

Please mail your corrections/additions to <crosser@average.org>
See http://www.average.org/digicam/ for possible updates.