Professional Documents
Culture Documents
UART INTERFACE
1.1. Interface instructions
The UART and High Speed UART interface of VC0706 is based on the design of standard UART
interface. It can be connected to the serial communication ports of a PC and an external MCU.
VC0706 supports RXD and TXD,but not support the all pins that are related to MODEM
functions.
Using Serial communicate Protocol,we can get information of vc0706 or control it,such as taking
photo ,reading photo ,etc.
Out of the Serial Communication, the UART and High Speed UART interface pins of VC0706 and
GPIO pins are in common.
Pin No. GPIO UART Instructions
76 GPIO0 UART_TX Send data through VC0706 UART interface
77 GPIO1 UART_RX Receive data through VC0706 UART interface
80 GPIO14 HSUART_TX Send data through VC0706 HS_UART interface
81 GPIO15 HSUART_RX Receive data through VC0706 HS_UART interface
VC0706 supports three interfaces, UART, HS_UART, SPI, communication with the external
MCU.But whenever, only one can be used as the main communication interface to control system.
UART is VC0706 default interface, if using other interfaces as the main communication interface,
it is necessary to set some specified values in EEPROM or SPI Flash.
Address: 0x0007
Length: 1 byte
Interface configuration value
UART 0x01
HS_UART 0x02
SPI 0x03
About VC0706 UART baud rate, the default is 38400, the highest is 115200, it can be set by
the specified values in EEPROM or SPI Flash.
Address: 0x0008
Length: 2 bytes
About VC0706 HS_UART baud rate, the default is 115200, the highest is 921600, it can be
set by the specified values in EEPROM or SPI Flash.
Address: 0x000A
Length: 4 bytes
baud rate configuration value
38400 0x002B 0x03C8
57600 0x001D 0x0130
115200 0x000E 0x0298
460800 0x0003 0x02A6
921600 0x0001 0x0353
1.2.Communication Protocol
Protocol sign it marks that the protocol is VC0706 Serial Communication Protocol, the receive
sign is 0x56('V'), return sign is 0x76('v').
Serial number it specify one device when there are serval devices in communication at the
same time,the value of this byte range from 0 to 255 .
Command it marks a special command.
Data-lengths it shows the data lengths behind itself., not include Protocol sign, Serial number,
Command, Data length.
Data used in commands, every command has different data lengths and format, range from 0 to
16 bytes.
Status this byte shows whether the receive command is right or wrong , 0 is right, others are
wrong.
To multi-byte data type, the lower bytes follow the higher bytes.
If serial number is wrong, the system will not return any content.
The max communication data lengths are 16 bytes
If the command format is wrong or command executes wrong , the status byte will be 1 byte and
the data length byte will be 0.
1.3.communication command
1.3.1.command form
Command Definition Command Instructions
Byte
GEN_VERSION 0x11 Get Firmware version information
SET_SERIAL_NUMBER 0x21 Set serial number
SET_PORT 0x24 Set port
SYSTEM_RESET 0x26 System reset
READ_DATA 0x30 Read data regisvter
WRITE_DATA 0x31 Write data register
READ_FBUF 0x32 Read buffer register
WRITE_FBUF 0x33 Write buffer register
GET_FBUF_LEN 0x34 Get image lengths in frame buffer
SET_FBUF_LEN 0x35 Set image lengths in frame buffer
FBUF_CTRL 0x36 Control frame buffer register
COMM_MOTION_CTRL 0x37 Motion detect on or off in comunication interface
COMM_MOTION_STATUS 0x38 Get motion monitoring status in comunication
interface
COMM_MOTION_DETECTED 0x39 Motion has been detected by comunication interface
MIRROR_CTRL 0x3A Mirror control
MIRROR_STATUS 0x3B Mirror status
COLOR_CTRL 0x3C Control color
COLOR_STATUS 0x3D Color status
POWER_SAVE_CTRL 0x3E Power mode control
POWER_SAVE_STATUS 0x3F Power save mode or not
AE_CTRL 0x40 Control AE
AE_STATUS 0x41 AE status
MOTION_CTRL 0x42 Motion control
MOTION_STATUS 0x43 Get motion status
TV_OUT_CTRL 0x44 TV output on or off control
OSD_ADD_CHAR 0x45 Add characters to OSD channels
DOWNSIZE_CTRL 0x54 Downsize Control
DOWNSIZE_STATUS 0x55 Downsize status
GET_FLASH_SIZE 0x60 Get SPI flash size
ERASE_FLASH_SECTOR 0x61 Erase one block of the flash
ERASE_FLASH_ALL 0x62 Erase the whole flash
READ_LOGO 0x70 Read and show logo
SET_BITMAP 0x71 Bitmap operation
BATCH_WRITE 0x80 Write mass data at a time
1.3.2.2.SET_SERIAL_NUMBER
1.3.2.3.SET_PORT
1.3.2.4.SYSTEM_RESET
Command function System reset
Command format 0x56+Serial number+0x26+0x00
Return format 0x76+Serial number+0x26+0x00+0x00
E.g. 0x56+0x00+0x26+0x00 The system will be reset.
When receiving return command, ten millisecond later, system will reset and receive some basic
configuration information.
1.3.2.5.READ_DATA
1.3.2.6.WRITE_DATA
1.3.2.7.READ_FBUF
1.3.2.8.WRITE_FBUF
1.3.2.9.GET_FBUF_LEN
1.3.2.10.SET_FBUF_LEN
1.3.2.11.FBUF_CTRL
1.3.2.12.COMM_MOTION_CTRL
1.3.2.13.COMM_MOTION_STATUS
1.3.2.14.COMM_MOTION_DETECTED
Command function detect motion
Command format
After starting motion monitoring, once system detects motion, it will send the command.
Return format 0x76+serial number+0x39+0x00
E.g.
0x76+0x00+0x39+0x00 detect motion
It is an active command that system send to control terminal.
1.3.2.15.MIRROR_CTRL
1.3.2.16.MIRROR_STATUS
1.3.2.17.COLOR_CTRL
1.3.2.18.COLOR_STATUS
1.3.2.19.POWER_SAVE_CTRL
1.3.2.21.AE_CTRL
0x56+0x00+0x40+0x03+0x02+0x01+0x00
Stop backlight compensation by MCU UART.
0x56+0x00+0x40+0x03+0x02+0x01+0x01
Start backlight compensation by MCU UART.
0x56+0x00+0x40+0x03+0x02+0x00+0x00
Control backlight compensation by GPIO.
1.3.2.22.AE_STATUS
1.3.2.23.MOTION_CTRL
1.3.2.24.MOTION_STATUS
1.3.2.26.OSD_ADD_CHAR
1.3.2.27.DOWNSIZE_SIZE
1.3.2.28.DOWNSIZE_STATUS
1.3.2.29.GET_FLASH_SIZE
1.3.2.31.ERASE_FLASH_ALL
1.3.2.32.READ_LOGO
1.3.2.33.SET_BITMAP
In this text, FBUF is frame buffer. VC0706 supports two frame buffers, current frame and next
frame.
2.1.Operation steps
When the external MCU read images from VC0706 and write images data to FBUF of VC0706 by
SPI, we need to follow the stated operation steps.
Send FBUF_CTRL command to stop current frame updating, the parameter is 0x00.
Send GET_FBUF_LEN command to get image lengths in FBUF.
Send READ_FBUF to read image data, the parameters are as follows in READ_FBUF
command.
the FBUF frame type is 0x00
control mode is 0x0F
starting address is 0x00
the image data is the one that we get with GET_FBUF_LEN command.
delay time is used to prolong the time between image data and return command, the default
value is 3000 , and can be modified.
After sending READ_FBUF command, wait for responding, if execute right, receive the image
data from VC0706.When the data sending has finished, VC0706 will send the return command
secondly to the external MCU.
After all have finished, we need to send FBUF_CTRL command to resume frame, the parameter
is 0x02.
Send FBUF_CTRL command to stop all frames updating, the parameter is 0x02.
Send WRITE_FBUF command to write image data, the parameters are as follows in
WRITE_FBUF command.
control mode is 0x0F
starting address is 0x00
the image data is the one that be ready to write.
delay time is used to prolong the time between image data and return command, the default
value is 3000 , and can be modified.
After sending WRITE_FBUF command, wait for responding, if execute right, it will send the
image data to VC0706.When the data sending has finished, VC0706 will send the return command
secondly to the external MCU.
Send SET_FBUF_LEN command to set image lengths, the parameter is the lengths of sending
image.
Send FBUF_CTRL command to step frame to current frame and show the image, the parameter
is 0x03.