Download RSV5-C328 serial camera user manual
Transcript
CJ - CAM User Manual OV528 Protocol RSV5-C328 Serial Camera User Manual Notice: This is one kind of protocol standard among various standards, & Instructions Protocol if this protocol is some different from what you required, please kindly inform us, we can amend protocol as per your instructions. RSV5-c328 module is a highly integrated serial camera board that can be attached to a wireless or PDA host performing as a video camera or a JPEG compressed still camera. It provides a serial interface (RS-232) or TTL and JPEG compression engine to act as a low cost and low powered OV528 PROTOCOL camera module for high-resolution serial bus security system or PDA accessory applications. The camera is using OV528 Protocol by Omnivision. Serial Interface Serial Interface Single-byte Timing Diagram Timing Diagram RS232Single-byte single-byte transmission consists of the start bit, 8 data bits and the stop bit. Start bit is fixed a 0, stop bit is fixed at 1. LSB is sent our first and is right after the start bit. Please check the char below.RS232 single-byte transmission consists of the start bit, 8 data bits and the stop bit. Start bit is fixed at 0, stop bit is fixed at 1. LSB is sent our first and is right after the start bit. Please check the chart below. Diagram 1: RS232 Single-byte Timing Diagram Future Electronics Egypt Ltd. (Arduino Egypt). Diagram 2: RS232 SYNC Command Timing SYNC Command Timing Diagram One single command consists of 6 continuous single-bytes. Please find the example of SYNC (AA0D00000000h) command. Diagram 2: RS232 SYNC Command Timing SYNC Command Set Set Command Camera can support 11 commands for interfacing to host as following. Camera can support 11 commands for interfacing to host as following. No. Command Command ID Parameter 1 1 Initial AA01h 00h 2 3 Get Picture Snapshot AA04h AA05h Get Setting Snapshot Setting AA06h 08h 4 Set Set Package Command Size Parameter 2 Color Setting 00h Skip Frame (low byte) Package Size (low byte) Parameter 3 Parameter 4 Preview Resolution 00h Skip Frame (high byte) Package Size (high byte) JPEG Resolution st nd 5 can Set support Baud-rate 11 commands AA07h 00h Camera interfacing 2to host as following. 1for Divider Divider 6 No.7 1 8 Reset Command Power Down Data Initial 9 SNYC 2 10 Get Picture ACK 3 11 Snapshot NAK AA08h 00h 00h 00h 00h Reset Setting 00h 00h xxh Parameter Parameter 3 Parameter 4 00h 00h 00h 2 Date Type Length-byte Length-byte 1 Length-byte 2 00h Preview JPEG Resolut 0 Color Setting Resolution 00h 00h 00h 00h Get Setting 00hID Byte Package 00h Command ID ACK00h Package ID Byte counter 0 1 Snapshot Setting Skip Frame Skip Frame 00h 00h NAK(low byte) Error Number (high byte) 00h counter Command ID 00h Parameter 1 AA09h AA0Ah AA01h AA0Dh AA04h AA0Eh AA05h AA0Fh 4 Set Package AA06h 08h Package Package Size 00h (high byte) Size Size * If the parameter is FFh, firmware will respond immediately. (low byte) st nd 5 Set Baud-rate AA07h Electronics00h Egypt Ltd. (Arduino Egypt).00h 1 Divider 2Future Divider 6 ResetCommands AA08h Interface Details 7 Power Down AA09h Reset Setting 00h 00h 00h 00h 00h xxh 00h The host issues this command to configure the preview image size and co 1. Initial (AA01h) command, the camera will send out an ACK command to the host if the config an NACK command will be sent out. The host issues this command to configure the preview image size and col 1. Initial (AA01h) command, the camera will send out an ACK command to the host if the configu 1. Initial (AA01h) The host issues will thisbe command an NACK command sent out.to configure the preview image size and colo Interface Commands Details command, the camera will send out an ACK command to the host if the configur The host issues this command to configure the preview image size and colo an NACK command will be sent out. 1. Initialcommand, (AA01h) the camera will send out an ACK command to the host if the configur NACK command willtoSetting be sent out.the preview image size and Color The hostan issues this command configure color type. After receiving this camera will send out an ACK 2-bitcommand, Gray-Scalethe 01h command to the host if the4-bit configuration success. Scale 02h Otherwise, an NACK ColorGraySetting command will be sent out. 8-bit Scale 03h 2-bitGrayGray-Scale 01h ColorColor Setting 2-bit 4-bit Gray- Scale 05h 02h 2-bit Gray-Scale 01h Color Setting 16-bit Color Scale 06h 8-bit Gray03h 4-bit GrayScale 02h 2-bit 01h 2-bitGray-Scale Color 05h JPEG 07h 8-bit GrayScale 03h 4-bit Gray16-bit ColorScale 02h 06h 2-bit Color 05h 8-bit Gray- Scale 03h JPEG 07h 16-bit Color 06h 2-bit Color 05h JPEGColor 07h Preview Resolution06h 16-bit 80*60 01h JPEG 07h Preview Resolution03h 160*120 80*60 01h Preview Resolution 160*120 03h 80*60 Resolution01h Preview 160*120 03h JPEG Resolution 01h 80*60 160*120 03h 80*64 01h JPEG Resolution 03h 160*128 80*64 01h 320*240 JPEG Resolution 05h 160*128 03h 640*480 07h 80*64 Resolution 01h JPEG 320*240 05h 160*128 03h 80*64 01h 640*480 07h 320*240 05h 160*128 03h 640*480 07h 320*240 05h 2. Get Picture (AA04h) 2. Get Picture (AA04h) 640*480 07h Host (pc,2.Arduino or microcontroller) issues this command to get a picture Get Picture (AA04h) Host issues this command to get a picture from camera. from camera. 2. Get Picture (AA04h) Getcommand Setting to get a picture from camera. Host issues this Snapshot 01h 2. Get Picture (AA04h) Host issues this command Get Setting to get a picture from camera. Preview Picture 02h Preview Picture Snapshot Picture Get Setting JPEG Preview Preview SnapshotPicture Picture JPEG Picture Preview Preview Picture JPEG Preview Picture 02h 01h 03h 02h 01h 03h 02h 03h Snapshot 01h Host issues this command to get03h a picture from camera. Get Setting JPEG Preview 3. Snapshot (AA05h) 3. Snapshot (AA05h) Future Electronics Egypt Ltd. (Arduino Egypt). Picture 3. Snapshot (AA05h) 3. Snapshot (AA05h) Camera keeps a single frame of JPEG still picture data in the buffer after Camera keeps a single frame of JPEG still picture data in the buffer aft receiving this command. Snapshot Setting Compressed 00h Picture Uncompressed 01h Picture Skip Frame: theofnumber dropped be defined before co Skip Frame: the number dropped of frames can beframes definedcan before compression occurs. “0” keeps frame, the current “1” captures nextect. current “1” frame, captures the nextthe frame frame ect. t Package Size (AA06h) 4. Set Sizestill (AA06h) st will send out the Package size of JPEG picture after receiving this command issued by camera. Host willfollows: send out the size of JPEG still picture after receiving this pe of package is as command issued by camera. Type of package is as follows: ID (2 byte) Date Size (2 byte) Image Data (Package Size-6 byte Verify Code (2 byte) ID:! ! !ID, stars Package starts from zero for an image Package fromID, zero for an image Dataof Size:! data in this package a Size: Size image Size data of in image this package Verifydetection Code:! Error detection to the byte sum of the ify Code: Error code, equals code, to the equals lower byte oflower sum of theofwhole package data excep field. The higher byte ofthe thisverify codecode is always zero. i.e. verify code=lo !the !verify! code whole package data except field. The higher byteǏN-2ǐ) !byte(sum(byteǏ0ǐto ! ! byte of this code is always zero. i.e. verify code=low byte ! ! ! of(sum(byte"0"to byte"N-2") e: As the transmission uncompressed image is not the package mode, it is not necessary to se the package size for the uncompressed image. Note: As the transmission of uncompressed image is not the package mode, it is not necessary to set the package size for the uncompressed et Baud Rate (AA07h) image. Host issues this command to set camera’s baud rate. Camera auto-detects the baud rate issued by ost and keep the baud rate to communicate with host, reconfiguration should be made if power off. he baud rates were supported by camera as follows. aud Rate=14.7456MHz/2*(2nd divider +1)/2*(1st divider+1) Future Electronics Egypt Ltd. (Arduino Egypt). Baud Rate st 1 Divider nd 2 Divider Baud Rate st 1 Divider nd 2 Divider verifydata code field. The higher byte of this code is always zero. i.e. ver Sizethe of image in this package Errorbyte(sum(byteǏ0ǐto detection code, equals to byteǏN-2ǐ) the lower byte of sum of the whole package data except the verify code field. The higher byte of this code is always zero. i.e. verify code=low Note: As the byte(sum(byteǏ0ǐto transmission of uncompressed image is not the package mode, it is not nec byteǏN-2ǐ) size the uncompressed Note: Asthe thepackage transmission of for uncompressed image is notimage. the package mode, it is not necessary to set the package size for the uncompressed image. Data Size: Verify Code: 5. Set Baud RateRate (AA07h) 5. Set Baud (AA07h) 5. Set Baud Rate (AA07h) Host issues command rate. Camera auto-detects the by baud rate Host thisthis command to set to camera’s baud rate.baud Camera auto-detects baud rate issued Hostissues issues this command toset setcamera’s cameraʼs baud rate. Camerathe auto-detects host theissued baudbaud rate communicate withthe host, reconfiguration should be made if power be off. made i host andkeep keep the toand communicate with host, should the and baud rate bytorate host keep baud rate toreconfiguration communicate with The baud rates were supported by camera as follows. The baud rates were supported by camera as follows. host, reconfiguration should be made if power off. The baud rates were nd st Baud Rate=14.7456MHz/2*(2 divider divider+1) supported by camera as follows. nd +1)/2*(1 Baud Rate=14.7456MHz/2*(2 divider +1)/2*(1st divider+1) Baud Rate=14.7456MHz/2*(2nd divider +1)/2*(1st divider+1) Baud Rate st 1 Divider st 2 nd Divider Baud RateFFh 1 Divider 7200bps 01h 9600bps BFh 01h 7200bps FFh 14400bps 7Fh 01h 9600bps 5Fh BFh 01h 19200bps 14400bps 19200bps 7Fh 5Fh Baud Rate nd st 1 Divider nd 2 Divider st nd 28800bpsBaud 3FhRate 01h 2 Divider 1 Divider 2 Divider 01h 57600bps28800bps 3Fh 1Fh 01h 01h 115200bps38400bps 2Fh 0h 01h 01h 57600bps 1Fh 01h 115200bps 0h 01h 01h 01h 01h 38400bps 2Fh 01h 6. Reset (AA08h) 6. Reset (AA08h) Reset Setting 6. Reset00h (AA08h)Reset the whole system, Camera will reboot and reset all registers and state machine Reset state machine only 01h Reset Setting 00h Reset the whole system, Camera will reboot and reset all registers and state 7. Power down machine (AA09h) 01h Reset state machine only Camera go into 7. Power downwill (AA09h) sleep mode after receiving this command and get resumed after sending out an ACK against SYNC command issued by Camera will go into sleep mode after receiving this command and get resumed after sending out an host. ACK against SYNC command issued by host. 8. Data (AA0Ah) 9. (AA0Ah) 7.8. Power down (AA09h) Data The type and size of image data prepared for transmitting out to host would The and size image datathis prepared for transmitting out tocommand host would and be advised to host when betype advised toof host when camera issuing this command. Camera willcamera go into sleep mode after receiving this get resumed after se issuing command. ACK against SYNC command issued by host. 8. Data (AA0Ah) Data Type Snapshot Picture Preview Picture JPEG Picture 01h 02h 05h The type and size of image data prepared for transmitting out to host would be advised Future Electronics Egypt Ltd. (Arduino Egypt). Data Length: these 3 bytes represent the length of Snapshot Picture, Preview Preview Picture. camera issuing this command. Data Type Data Length: these 3 bytes represent the length of Snapshot Picture, Snapshot Picture 01h Preview Picture and JPEG Preview Picture. Preview Picture JPEG Picture 9. SYNC (AA0Dh) 02h 05h Either the host or the camera can issue this command to make Data Length: these 3 bytes represent the length of Snapshot Picture,connection. Preview Picture and JPE An ACK command must be sent out after receiving this command. Preview Picture. 10. ACK (AA0Eh) 9. SYNC (AA0Dh) This command indicates thecan success of the last operation. After receiving Either the host or the camera issue this command to make connection. An ACK command mu any valid command, ACK be sent out after receiving this command command. must be sent out except when getting preview data. The host can issue this command request image data package with desired package ID after receiving Data command from 10. ACK (AA0Eh) camera, and send this command with package ID 0F0Fh when finishing with package. Thisreceiving command data indicates the success of the last operation. After receiving any valid command, AC Note: “Command ID” is when hostgetting requesting image command must be sent out00h except when preview data. data The package. host can issue this comma request image data package with desired package ID after receiving Data command from camera, a send this command package ID 0F0Fh finishing with receiving by data package. Command ID: with The command withwhen that ID is acknowledged this Note: “Command ID” is 00h when host requesting image data package. command. ACK Counter: Not in use Command ID: The command with that ID is acknowledged by this command. Package ID: For acknowledging Data Command, these two bytes ACK Counter: Not in use represent the requested package ID. bytes Whilerepresent for Package ID: For acknowledging Data Command, these two the requested packa acknowledging other commands, these two bytes are setto 00h. ID. While for acknowledging other commands, these two bytes are set to 00h. 11. NAK (AA0Fh) 11. NAK (AA0Fh) This command shows corrupted transmission or unsupported features. This command shows corrupted transmission or unsupported features. NAK Counter: Not in use NAK Notread in use ErrorCounter: Number: (Please the following chart) Error Number: (Please read the following chart) Error Messages Picture Type Error Picture Up Scale Picture Scale Error Unexpected Respond Send Picture Timeout Unexpected Command ASRAM JPEG Type Error ASRAM JPEG Size Error Picture Format Error Picture Size Error NAK code 01h 02h 03h 04h 05h 06h 07h 08h 09h 0Ah Error Messages Parameter Error Send Register Timeout Command ID Error Picture Not Ready Transfer Package Number Error Set Transfer Package Size Wrong Command Header Error Command Length Error Send Picture Error Send Command Error NAK code 0Bh 0Ch 0Dh 0Fh 10h 11h F0h F1h F5h FFh Future Electronics Egypt Ltd. (Arduino Egypt). Command Protocol Examples 1. SYNC Command 2. Make connection with camera Host issues SYNC (baudwith rate: 9600bps) 2. Make connection camerato await ACK from camera (usually an ACK command is received after sending 25 times of SYNC command). . Host issues SYNC (baud rate: 9600bps) to await ACK from camera (usually an ACK command is received after sending 25 : 60 times of SYNC 2. Make connection with camera command) Host issues SYNC (baud rate: 9600bps) to await ACK from camera (usually an ACK command is received after sending 25 times of SYNC command). . Future Electronics Egypt Ltd. (Arduino Egypt). Note: SYNC commands are 60 times at most. 3. Initial/ Get Picture/ Snapshot/Set Baud Rate / Reset/ Power down Command Future Electronics Egypt Ltd. (Arduino Egypt). 4. Getting a Snapshot through RS232 4. Getting a Snapshot through RS232 Please make assure that connection is already made before the following communication. 1 JPEG Snapshot Picture 4.1 JPEG Snapshot Picture Remark: 1) “xx” any number; 2) “~~” image size returned. Remark: 1) “xx” any number; 2) “̚̚” imageEgypt size returned. Future Electronics Ltd. (Arduino Egypt). 4.2 Uncompressed Snapshot Picture) 4.2 Uncompressed Snapshot Picture Remark: 1) “xx” any number; 2) “!!” image size returned. Remark: 1) “xx” any number; 2) “̚̚” image size returned. Future Electronics Egypt Ltd. (Arduino Egypt). 5. Getting a preview Picture through RS232 Please make assure that connection is already made before the following communication. Remark: 1) “xx” any number; 2) “~~” : image size returned Remark: 1) “xx” any number; 2) “̚̚” : image size returned Future Electronics Egypt Ltd. (Arduino Egypt). 5.2. Preview un-impressed image Remark: 1) “xx” any number; 2) “~~” image size returned. Remark: 1) “xx” any number; 2) “̚̚” image size returned. Future Electronics Egypt Ltd. (Arduino Egypt).