Beruflich Dokumente
Kultur Dokumente
User Manual
Release Note:
1. 16 Mar, 2009 – official released v1.0
Rm 802, Nan Fung Ctr, Castle Peak Rd, Tsuen Wan NT, Hong Kong
Tel: (852) 2498 6248 Fax (852) 2414 3050
Email: sales@comedia.com.hk
http://www.comedia.com.hk
The C328-7221 is VGA camera module which is specially designed for serial communication and
working under low light condition. It performs as a JPEG compressed still camera and can be attached
to a wireless or PDA host. Users can send out a snapshot command from the host in order to capture a
full resolution single-frame still picture. The picture is then compressed by the JPEG engine and
transferred to the host thru serial port.
.
VGA UART
Image Compression
Sensor Engine Host
(Mono)
EEPROM
C328-7221 camera module
Features
z Small in size, 20x28mm z Low power consumption 105mA
z Monochrome image sensor used z User friendly commands for control
z 8-bit, 256-level grey level z UART interface of up to 115.2Kbps
z Sensitive to IR, good for night vision z Auto detect baud rate and make
z VGA resolution, down sample to connection to the host
QVGA z Power saving mode
z 3.3V operation z Various lens options
Board Layout
20mm
RS-232 RS-232
J1
J1
EEPROM
3.3V Tx Rx GND
28mm
Image
DSP
Sensor
SYNC Command
Single
Byte
Figure 4 – RS-232 SYNC command timing diagram
Command Summary
Command Function
INITIAL To configure the image size
GET PICTURE Get Picture type
SNAPSHOT Set snap shot image type
SET PACKAGE SIZE Set the package size to transmit data from module to Host
SET BAUDRATE Change the baud rate
RESET Reset the whole system or reset the state machine
POWER OFF To enter sleep mode
DATA Set the data type and length for transmitting data to host
SYNC Sync signal to connect between host and module
ACK Command to indicate the communication success
NAK Command to indicate the communication fail with error code
The C328-7221 module supports total 12 commands for interfacing to host as following:
Data AA0Ah Data Type Length Byte 0 Length Byte 1 Length Byte 2
The host issues this command to configure the preview image size and color type. After
receiving this command, the module will send out an ACK command to the host if the
configuration success. Otherwise, an NAK command will be sent out.
1.1 Initialization example
Initial HOST
(AA 01 00 07 00 07)
ACK
(AA 0E 01 xx 00 00) C328
Set the C328-7221 baud rate by issuing this command. As the module can auto-detect the
baud rate of the incoming command, host can make connection with one of the following
baud rate in the table. The module will keep using the detected baud rate until physically
power off.
The host issues this command to change the size of data package which is used to transmit
JPEG image data from the C328-7221 to the host. This command should be issued before
sending Snapshot command or Get Picture command to C328-7221, even though it is default
value. It is noted that the size of the last package varies for different image.
Byte 0 Byte N
ID (2 bytes) Data Size (2 bytes) Image Data Verify Code (2 bytes)
Low byte, high byte Low byte, high byte (Packet size - 6 bytes) Low byte, high byte
Packet Size
ACK
(AA 0E 06 xx 00 00)
C328-7221 will keep a single frame of still picture data in the buffer after receiving this
command.
4.1 Snapshot Type
Snapshot Type Parameter 1
JPEG Picture 00h
Uncompressed Picture (RAW) 01h
Snapshot
(AA 05 00 00 00 00)
ACK
(AA 0E 05 xx 00 00)
Get Picture (aa 04 01 00 00 00) (aa 04 01 00 00 00) (aa 04 05 00 00 00) (aa 04 02 00 00 00)
Initial
JPEG picture, VGA
(AA 01 00 07 yy 07)
ACK
(AA 0E 01 xx 00 00)
Set Package Size
512 bytes size
(AA 06 08 00 02 00)
ACK
(AA 0E 06 xx 00 00)
Snapshot
JPEG picture
(AA 05 00 00 00 00)
ACK
(AA 0E 05 xx 00 00)
Get Picture
Snapshot picture
(AA 04 01 00 00 00)
ACK
(AA 0E 04 xx 00 00)
Data
snapshot picture
ACK (AA 0A 01 ~~ ~~ ~~)
package ID: 0000h
(AA 0E 00 00 00 00)
Image Data Package
512 bytes, ID: 0000h
ACK
package ID: 0001h
(AA 0E 00 00 01 00)
Image Data Package
512 bytes, ID: 0001h
Note:
xx, yy: Don’t care
~~: Image size returned by C328
Initial
JPEG preview, QVGA
(AA 01 00 07 yy 05)
ACK
(AA 0E 01 xx 00 00)
Set Package Size
512 bytes size
(AA 06 08 00 02 00)
ACK
(AA 0E 06 xx 00 00)
Get Picture
JPEG preview picture
(AA 04 05 00 00 00)
ACK
(AA 0E 04 xx 00 00)
Data
JPEG preview picture
(AA 0A 05 ~~ ~~ ~~)
ACK
package ID: 0000h
(AA 0E 00 00 00 00)
1 frame
Image Data Package
512 bytes, ID: 0000h
ACK
package ID: 0001h
(AA 0E 00 00 01 00)
Image Data Package
512 bytes, ID: 0001h
Loop
HOST
Note:
xx,yy: Don’t care
~~: Image size returned by C328 C328
C328-7221 issues this command for telling the host the type and the size of the image data
which is ready for transmitting out to the host.
6.1 Data Type
Data Type Parameter 1
Snapshot Picture 01h
Uncompressed Preview Picture 02h
JPEG Preview Picture 05h
6.2 Length
These three bytes represent the length of data of the Snapshot Picture, Preview Picture or
JPEG Preview Picture.
Get Picture
(AA 04 yy 00 00 00)
ACK
(AA 0E 04 xx 00 00)
Data
(AA 0A yy ~~ ~~ ~~)
……
Note:
xx: Don’t care
yy: Get picture type
~~: Image size returned by C328
7. RESET (AA08h)
The host reset C328-7221 by issuing this command. C328-7221 will return an ACK
command to host at first then perform the reset operation.
7.1 Reset Type
“00h” resets the whole system. C328-7221 will reboot and reset all registers and state
machines. “01h” resets state machines only.
Reset
(AA 08 yy 00 00 00)
ACK
(AA 0E 08 xx 00 00) yy: reset type
8.1 Wake up
SYNC command (AA0Dh) must be sent to wake up C328-7221 for certain period until
receiving ACK command from C328-7221.
The previous command (setting) that has been sent to C328-7221 by host would be reserved
when C328-7221 went into sleep mode. These commands include: Initial, Set Package Size,
Set Baud Rate.
SLEEP:
POWER OFF
(AA 09 00 00 00 00)
ACK
(AA 0E 09 xx 00 00)
WAKE UP:
SYNC
(AA 0D 00 00 00 00)
SYNC
Max 60 times
(AA 0D 00 00 00 00)
……
SYNC
(AA 0D 00 00 00 00)
ACK
(AA 0E 0D xx 00 00)
SYNC
(AA 0D 00 00 00 00)
ACK
(AA 0E 0D xx 00 00)
Either the host or the C328-7221 can issue this command to make connection. An ACK
command must be sent out after receiving this command.
SYNC
(AA 0D 00 00 00 00)
ACK
(AA 0E 0D xx 00 00)
SYNC
(AA 0D 00 00 00 00)
ACK
(AA 0E 0D xx 00 00) xx: Don’t care
SYNC
(AA 0D 00 00 00 00)
SYNC
(AA 0D 00 00 00 00)
SYNC
(AA 0D 00 00 00 00) Max. 60 times
SYNC
(AA 0D 00 00 00 00)
ACK
(AA 0E 0D xx 00 00)
SYNC
(AA 0D 00 00 00 00)
ACK
(AA 0E 0D xx 00 00)
xx: Don’t care
This command indicates the success of last operation. After receiving any valid command,
ACK command must be sent out except when getting preview data. The host can issue this
command to request image data package with desired package ID after receiving Data
command from C328-7221.
10.1 Command ID
The command with that ID is acknowledged by this command.
10.3 Package ID
For acknowledging Data command, these two bytes represent the requested package ID.
While for acknowledging other commands, these two bytes are set to 00h.
The host should send this command with package ID F0F0h after receiving a package to
end the package transfer. Note that the field “command ID” should be 00h when request
image data package.
Package ID Command
0000h AA 0E 00 00 00 00
0001h AA 0E 00 00 01 00
0002h AA 0E 00 00 02 00
0003h AA 0E 00 00 03 00
…… ……
0102h AA 0E 00 00 02 01
…… ……
F0F0h AA 0E 00 00 F0 F0
You need to get rid of the packet ID, data size in the head and verify code in the end. And you should combine
the available image data together one by one.
At last, you should create a file with suffix “.JPG” and put the available image data into it. The image showed
here was made from the above data.