Camera Module control commands

Commands used to control various settings of CTS module. Setting will not be stored between restarts unless saved in EEPROM using update command.

Managing configuration

By default, CTS will not keep settings between restarts as data will be stored in SRAM, however, is possible to overwrite SRAM settings with the original/default configuration from EEPROM or to store the latest settings in EEPROM to become persistent. Bellows are the basic commands to handle these operations.

Basic Help

A basic Help feature is implemented by default on CTS for every command. To get help type the command followed by ‘h’:

h
Available commands (use '<command>h'for more details).
- Tracking/capture:
    Frame dumping:       F...
    Tracking:            T...
    YUV Class:           C...
- Image control:
    AWB:                 a...
    Brightness:          b...
    Contrast:            c...
    GAMMA:               g...
    Orientation:         f...
    Resolution:          r...
    Saturation:          s...
    Sharpness:           S...
- System control:
    Configuration:       M...
    Version info:        v...
    UART:                u...

System Configuration

There are five commands that handle System Configuration, however, these are very important to store and retrieve settings to or from EEPROM:

Mh
List or update CTS settings values.
  List settings (SRAM):  M?
  Copy EEPROM to SRAM:   Mr
  Copy SRAM to EEPROM:   Mw
  Dump settings (hex):   Md
  Verify SRAM vs EEPROM: Mv

List Settings

This command will list all the settings stored in the EEPROM in a readable way:

M?
Version:      0515d134
Camera model: OV7721
   Vendor ID: 7F.A2
UART speed:   230,400
Resolution:   QVGA (320 x 240)
AWB:          on
Brightness:   +25%
Contrast:     0 %
Saturation:   0 %
Gamma:        -25%
Orientation:  normal
Sharpness:    disable
 

Copy EEPROM to SRAM

To reload the latest setting stored in the EEPROM to SRAM can use the following command:

Mr
Note: 
  • no confirmation will be provided when running this command.
  • Reloading data from EEPROM to SRAM will not update the configuration! To update the configuration using EEPROM settings a RESET is required.

Copy SRAM to EEPROM

To store configuration between RESTART, settings have to be stored in EEPROM. To do this, can use the following command (this will impact ONLY configuration settings and not Tracking Colour Table data):

Mw
Note: no confirmation will be provided, however can check  using Verify Configuration option (see bellow).

Dump settings (hex)

For easier communication between CTS and other systems/applications, settings can be dumped in hex format using the following command:

Md
M...........

The output seen using a terminal will look like above as is generated in hex format. The format of the package is described bellow:

Byte1:     Start byte (0x4D)
Byte2:     UART speed index
Byte3:     Sharpness
Byte4:     AWB
Byte5:     Orientation
Byte6:     Contrast
Byte7:     Brightness
Byte8:     Saturation
Byte9:     Resolution
Byte10:    GAMMA
Byte11:    End byte (0x00)
Byte12:    End byte (0xFF)

Verify configuration

To check if configuration stored in SRAM is the same with the one in EEPROM, the following command can be used:

Mv

This will return OK if SRAM and EEPROM content is same or ERR if is not.

UART Configuration

By default, CTS module will come configured to run at 115,200 baud, however, speed can be changed from 38,400 to 912,600 baud. To review available option use bellow command:

uh
UART settings.
  Current speed:     u?
  List valid speeds: ul
  Change speed:      u<speed code>

NOTE:
  - UART setting change is real-time, when UART speed is changed connection will be terminated!
  - Change is not stored in EEPROM until 'Mw' command is issued!

Check current speed

To check current speed, the following command will be used:

u?
UART speed:   230,400

List available serial port speed settings

To list available speed settings for serial communication use:

ul
0 - 38,400
1 - 57,600
2 - 115,200
3 - 230,400
4 - 460,800
5 - 921,600

Change serial port speed

To change serial port speed use:

u<speed code>

Where:
speed code – is one of the following (information available using”ul“):

  • 0 – 38,400
  • 1 – 57,600
  • 2 – 115,200
  • 3 – 230,400
  • 4 – 460,800
  • 5 – 921,600

Example: to change serial speed to a 921,600 baud, the following command can be used (note that this is real-time, as such communication with CTS module will be lost when doing this):

u5

To check, change host’s speed to 921,600 baud then run:

u?
UART speed:   921,600
NOTE: This change become persistent ONLY if saved in EEPROM after change and before restart.

Check current version

To check current firmware version and AVR chip installed, run the following command:

v?

The output will look something like (XXYYVMMM):

 Version:      0409d128

Where

  • XX – is the major version (e.g.: 0.4 in above example, running on v0.4 boards);
  • YY – is the minor version (e.g.: 09 in above example, will determine build version of the board);
  • V – is the version (e.g.: “d” for Development and “p” for Production);
  • MMM – AVR chip model (e.g.: 128 or Atmega1284P in above example. Can also be 16A for Atmega16A or 644 for Atmega644P, etc).

Check status for various commands

Some commands will accept status check option. Status will be shown for current settings (SRAM) and not for settings stored in EEPROM.

For example, to check AWB setting, send:

a?

This will return AWB current setting:

AWB:          on

To check status for all parameters can use Configuration Check Status (see above).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s