JPEG Serial Camera Module OV528 Protocol LCF-23M1 32mmx32mm or 38mmx38mm LCF-23MA 32mm-38mm Default baudrate 9600bps~115200 bps Auto adaptive 9600bps~115200 bps Page 1 of 15
1.General Description OV528 PROTOCOL RS232/TTL/RS485 module is a igly integrated serial camera board tat can be attaced to a wireless or PDA,ost performing as a video camera or a JPEG compressed still camera. It provides a serial interface (RS-232) and JPEG compression engine to act as a low cost and low powered camera module for ig resolution serial bus security system or PDA accessory applications. Figure 1 System Block Diagram 2. Features Small in size, low cost and low powered (3.3V/5.0V )camera module for ig resolution serial bus security system or PDA accessory applications. On-board EEPROM provides a command based interface to external ost via RS-232. UART: 115.2Kbps for transferring JPEG still pictures or 160x128 preview @8bpp wit 0.75fps. On board OmniVision OV7640/8/7725 color sensor. Built-in JPEG CODEC for different resolutions. Built-in down sampling, clamping and windowing circuits for VGA, QVGA, 160x120 or 80x60 image resolutions. No external DRAM required. Page 2 of 15
3.Serial Interface Name descriptions +5V Power GND Ground TXD(OUT) RS232 level connected to MCU or PC RXD RXD(IN) RS232 level connected to MCU or PC TXD 1. Single Byte Timing Diagram A single byte RS-232 transmission consists of te start bit, 8-bit contents and te stop bit. A start bit is always 0, wile a stop bit is always 1. LSB is sent out first and is rigt after te start bit. Figure 3 RS-232 single byte timing diagram Page 3 of 15
2. Command Timing Diagram A single command consists of 6 continuous single byte RS-232 transmissions. Te following is an example of SYNC (AA0D00000000) command. Figure 4 RS-232 SYNC command timing diagram 4.Command Set Te RS232 module supports total 11 commands for interfacing to ost as following: Command ID Number Parameter 1 Parameter 2 Parameter 3 Parameter 4 Initialise AA 00 Color Type Preview Resolution JPEG Resolution Get Picture AA04 Picture Type 00 00 00 Snapsot AA05 Snapsot Type Skip Frame Skip Frame 00 Low Byte Hig Byte Set Packet AA06 08 Packet Size Packet Size 00 Size Low Byte Hig Byte Set Baud rate AA07 1st Divider 2nd Divider 00 00 Reset AA08 Reset Type 00 00 xx* Power Off AA09 00 00 00 00 Data AA0A Data Type Lengt Byte 0 Lengt Byte 1 Lengt Byte 2 SYNC AA0D 00 00 00 00 AA0E Command ID counter 00/Packat ID 00/Packet ID Byte 0 Byte 1 NAK AA0F 00 NAK counter Error Number 00 * If te parameter is 0xFF, te command is a special Reset command and te firmware responds to it immediately. Page 4 of 15
1. Initialise (AA) Te ost issues tis command to configure te preview image size and color type. After receiving tis command, te module will send out an command to te ost if te configuration success. Oterwise, an N command will be sent out. 1.1 JPEG Resolution Since te Embedded JPEG Code can support only multiple of 16, te JPEG preview mode can support following image sizes. It is different from normal preview mode. 80x60 160x120 320x240 640x480 03 05 07 2. Get Picture (AA04) Te ost gets a picture from RS232 by sending tis command. 2.1 Picture Type Snapsot Picture Preview Picture JPEG Preview Picture 02 05 3. Snapsot (AA05) RS232 keeps a single frame of JPEG still picture data in te buffer after receiving tis command. 3.1 Snapsot Type Compressed Picture 00 3.2 Skip Frame Counter Te number of dropped frames can be defined before compression occurs. 0 keeps te current frame, 1 captures te next frame, and so fort. 4. Set Packet Size (AA06) Te ost issues tis command to cange te size of data packet wic is used to transmit image data from te RS232 to te ost. Tis command sould be issued before sending Snapsot command or Get Picture command to RS232. It is noted tat te size of te last packet varies for different image. Page 5 of 15
4.1 Packet Size Te default size is 64 bytes and te maximum size is 512 bytes. Byte0 ID Data Size Image Data Verify Code Byten (2 bytes) (2 bytes) (Packet Size 6 bytes) (2 bytes) ID -> Packet ID, starts from zero for an image Data Size -> Size of image data in te packet Verify Code -> Error detection code, equals to te lower byte of sum of te Wole package data except te verify code field. Te iger byte of tis code is always zero. i.e. verify code=low byte(sum(byte<0>to byte<n-2>). 5. Set Baud Rate (AA07) Set te RS232 baud rate by issuing tis command. As te default baud rate is Seted according to clients request, ost sould make connection wit RS232 at tis baud rate eac time power on. 5.1 Baud rate Divider Baud rate = 14.7456MHz / 2 x (2nd Divider + 1) / 2 x (1st Divider + 1) Baud rate 1 st 2 nd Baud rate 1 st 2 nd 7200 bps 9600 bps Ff Bf 14400 bps 7f 19200 bps 5f 28800 bps 38400 bps 3f 2f 57600 bps 1f 115200 bps 0f 6. Reset (AA08) Te ost reset RS232 by issuing tis command. 6.1 Reset Type 00 Resets te wole system. RS232 will reboot and reset all registers and Resets state macines only Page 6 of 15
7. Power Off (AA09) RS232 will go into sleep mode after receiving tis command. SYNC command (AA0D) must be sent to wake up RS232 for certain period until receiving command from RS232. 8. Data (AA0A) RS232 issues tis command for telling te ost te type and te size of te image data wic is ready for transmitting out to te ost. 8.1 Data Type 8.2 Lengt Snapsot Picture Preview Picture 02 JPEG Preview Pi 05 Tese tree bytes represent te lengt of data of te Snapsot Picture, Preview Picture or JPEG Preview Picture. 9. SYNC (AA0D) Eiter te ost or te RS232 can issue tis command to make connection. An command must be sent out after receiving tis command. 10. (AA0E) Tis command indicates te success of last operation. After receiving any valid command, command must be sent out except wen getting preview data. Te ost can issue tis command to request image data packet wit desired packet ID after receiving Data command from RS232. Te ost sould send tis command wit packet ID F0F0 after receiving a packet to end te packet transfer. Note tat te field command ID sould be 00 wen request image data packet. 10.1Command ID Te command wit tat ID is acknowledged by tis command. 10.2 Counter No use. Page 7 of 15
10.3Packet ID For acknowledging Data command, tese two bytes represent te requested packet ID. Wile for acknowledging oter commands, tese two bytes are set to 00. 11. NAK (AA0F) Tis command indicates corrupted transmission or unsupported features. 11.1NAK Counter No use. 11.2Error Number Picture Type Error Picture Up Scale 02 Picture Scale Error 03 Unexpected Reply 04 Send Picture Timeout 05 Unexpected Command 06 SRAM JPEG Type 07 E SRAM JPEG Size Error 08 Picture Format Error 09 Picture Size Error 0a Parameter Error Send Register Timeout Command ID Error Picture Not Ready Transfer Packet Number E Set Transfer Packet Size W Command Header Error Command Lengt Error Send Picture Error Send Command Error 0b 0c 0d 0f 10 11 F0 F1 F5 Ff Page 8 of 15
5.Command Protocol A. SYNC Command B. Make Connection wit RS232 Send te SYNC command (at 115200bps) until receiving command from RS232 (usually an command is receive after sending 25 times of SYNC command). Tis must be done after Power up. Page 9 of 15
C. Initial, Get Picture, Snapsot, Set Packet Size, Set Baudrate, Reset and Power Off Command SYNC Get Picture Snapsot Set Packet Size Set Baud Rate Reset Power Off D. Getting a Snapsot JPEG Picture for RS232 Make sure connection is made before te following communication. JPEG Snapsot Picture (e.g. 640x480 VGA format) Page 10of 15
Initialise JPEG preview, VGA (AA 00 07 yy 07) Set Packet Size 512 bytes (AA 06 08 00 02 00) Snapsot Compressed picture (AA 05 00 00 00 00) Get Picture Snapsot picture (AA 04 00 00 00) (AA 0E xx 00 00) (AA 0E 06 xx 00 00) (AA 0E 05 xx 00 00) (AA 0E 04 xx 00 00) Packet ID:0000 (AA 0E 00 00 00 00) Packet ID:00 (AA 0E 00 00 00) Data snapsot picture (AA 0A ~~ ~~ ~~) Image Data Packet 512 bytes, ID:0000 Image Data Packet 512 bytes, ID: 00 Packet ID:F0F0 (AA 0E 00 00 F0 F0) Te Last Image Data Packet Note: xx,yy: Don t care ~~zz: Image size return by RS232 Page 11 of 15
6.Poto Taken from Serial Camera/Camera module A. At Day B. At Nigt or Dark Environment Page 12of 15
BRIEF OPERATION INSTRUCTION Te following values are Hex unless special instruction. XX means careless values, after power on, delay 3 seconds. A. SYNC 1. Host SYNC Camera Host: AA 0D 00 00 00 00 Host send tis command witin 50 times, interval time is 0.1s, until te camera replies. More tan 50times, failed. Send one SYNC command, it can connect wit camera. 2. Camera Reply Camera: AA 0E 0D XX 00 00 3. Camera SYNC Host Camera: AA 0D 00 00 00 00 4.Host Reply Host: AA 0E 0D 00 00 00 B. Cange baud rate ost: AA 07 B1 B2 00 00 B1=0x0f B2=0x 115200 B1=0x1f B2=0x 57600 B1=0x2f B2=0x 38400 B1=0x3f B2=0x 28800 B1=0x5f B2=0x 19200 B1=0x7f B2=0x 14400 B1=0xBf B2=0x 9600 Camera reply in te baud rate wic was not canged Camera: AA 0E 07 XX 00 00 Page of 15 13
C. Take pictures: 1.Host send command to start take potos Host: AA 04 05 00 00 00 2. Getting te above command, camera reply: Camera AA 0E 04 XX 00 00 3. Camera begin to take potos, and ten send tis command to tell te ost te data lengt, for tis step, to set overtime latency time,5s is better. Camera: AA 0A 04 L H 00 L is lower byte of image data lengt, H is iger byte of image data lengt. Te data is divided into several packet, default packet lengt is 506(maybe 512) (image data is 506-6)byte, ost can read only one packet eac time. 4. Read potos: Host send: ID ID Host: AA 0E 00 00 (L) (H) Host send tis command to request te camera to transmit te data ID is serial number of packet, begin from 0,ID(L)is lower byte,id(h)is iger byte. Camera reply ID ID P Image Verify Camera: P(L) 00 (L) (H) (H) data code ID (L) ID(H) as te same meaning wit above one. P(L) P(H) means packet lengt, ost will calculate ow muc packet it will read according to te lengt in step 3,repeat step 4 until get all Packet. Verify: eg. verify code=low byte(sum(byte<0>to byte<n-2>). Wen ost is in te process of transmission, if an error, can request te camera to transmit one packet again. Host finis getting last one packet, send one end command. Host: AA 0E 00 00 F0 F0 Camera can not reply tis command. Page of 15 14
D. Set image resolution Host: AA 00 07 00 N N=3:160 120 N=5:320 240 N=7:640 480 Reply Camera: AA 0E XX 00 00 Contact information: Email: felix@cn-lcf.com amos@cn-lcf.com ailsa@cn-lcf.com MSN: felixlcf@otmail.com amoslcf@otmail.com ailsalcf@otmail.com SKYPE: amoslcf Page of 15 15