I sell on Tindie
Map
Grand Prize Winner
(Dec 2012)
Second Prize Winner
(July 2012)












DefendLineII. Terminal commands

A great deal of DefendLineII configuring might be done over a terminal. To use this option the board must be connected to PC via USB cable and serial selector JP1 must have pins 1 and 2 connected together. As a terminal program standard Windows HyperTerminal can be used but it is not very convenient tool, we recommend to download Tera Term Open Source project. Again, set up your terminal to open the right virtual COM port with 115200 bps baud rate, 8 bit data, none for parity, 1 stop bit and none for flow control. All commands are case sensitive and must be ended with Enter. Parameters (if any) are entered after command and separated by spaces. List of available commands might be obtained by help command, the output is below:

help

=== DefendLineII V1.0, October, 2010 ===
=== visit http://magictale.com ===
Device name: DLII_SYD_01

Avail.commands: test, bootldr, ls, mkdir, cd, rm, df, cat, touch, sync, takephoto, write, set time, get sensor descr, set sensor descr, get device name, set device name

test command retrieves board’s configuration and tests some components and external devices. Typical command output is given below:

->test
AVR ATMEGA1280 CPU
Temperature sensor DS1621 – detected, current temperature: 33.0 degrees C
RealTime clock PCF8563 – detected, current time: 20:17:24 14/11/2010
MicroSD card – detected
SerialCamera – detected
SerialCamera initial – success
SerialCamera setPackageSize – success
SerialCamera snapshot – success

The information above means that main board CPU is ATMEGA1280, temperature sensor is installed and works, realtime clock chip is installed and works and both MicroSD card and JPEG serial camera are detected and successfully passed initialization.

bootldr command forcibly launches bootloader but please note that avrdude won’t have access to the serial port until terminal application is running, you will be given 5 seconds to close the terminal and run avrdude command. More convenient way is to press SB1 button and hold it until avrdude command is performed, of course in this case terminal application must be closed as well. The command output is given below:

->bootldr
Bootloader will be starting in 5 seconds…

ls command displays the content of current MicroSD card directory in format file(directory) name and file length. Typical output is given below:

->ls
2010/ 0
2009/ 0
2008/ 0
test01.jpg 9788
test02.txt 17

mkdir [dirname] command creates a new directory. First and the only parameter is directory name. Currently names with spaces are not supported, typical output is:

->mkdir 2007
success

cd [dirname] command changes current directory. To return to root directory cd .. command should be used. A typical command output is given below:

->cd 2010
success

->ls
./ 0
../ 0
test01.jpg 0

rm [name] command removes file or directory.First and the only parameter is file or directory name. Typical output:

->ls
2010/ 0
2009/ 0
2008/ 0
2007/ 0

->rm 2007
success

->ls
2010/ 0
2009/ 0
2008/ 0

df command retrieves system information about MicroSD card. Typical output:

->df
manuf: 0x3
oem: SD
prod: SU02G
rev: 80
serial: 0x4D7C004
date: 3/10
size: 1886MB
copy: 1
wr.pr.: 0/0
format: 0
free: 1973747712/1975287808

cat [filename] command displays file content. Text files will be displayed as text, all other types – as dump of bytes. Typical output:

->cat test11.jpg
0: FF D8 FF E0 0 11 4A 46
8: 49 46 0 1 2 3 4 5
10: 6 7 8 9 A FF DB 0
18: 43 0 10 C C E C A
20: 10 E E E 12 12 10 14
28: 18 28 1A 18 16 16 18 32
30: 24 26 1E 28 3A 34 3E 3C
38: 3A 34 38 38 40 48 5C 4E
40: 40 44 58 46 38 38 50 6E

touch [filename] command creates a new empty file with given name. Typical output:

->ls
./ 0
../ 0

->touch myfile.txt
success

->ls
./ 0
../ 0
myfile.txt 0

sync command performs MicroSD card synchronization. Useful if the card has been inserted/replaced without switching the board off. Typical output:

->sync
success

takephoto [filename] command takes photo and stores it in a file with given name. Note, that this command works only if a JPEG serial camera is connected to a COM port (currently COM1). More information will be provided in a separate article.

write [filename] command reads text lines from terminal and writes into previously created file. Currently does not append into the end of file, previous file content will be rewritten if exists. Typical output:

->touch test03.txt
success

->write test03.txt
opening file…
please type file content, double to finish file appending
line1
line2
line3

success

->cat test03.txt
line1
line2
line3

set time [HH:mm:ss DD/MM/YYYY] command sets RTC chip date and time, typical output is given below:

->set time 10:55:00 14/10/2010
success

get sensor descr [sensor_num] command retrieves user defined sensor description which simplifies event identifications. This data is stored in EEPROM memory segment and won’t be lost during power outages. Maximum name length is 16. Sensor_num parameter is in range 0..3. Typical output is given below:

->get sensor descr 1
curr. value: Main door
success

set sensor descr [sensor_num] [description] command stores user defined sensor description into EEPROM memory segment. Sensor_num is in range 0..3 and description is a textual sensor description.

get device name command retrieves user defined board name. This data is stored in EEPROM memory segment and won’t be lost during power outages. Maximum name length is 16. Typical output:

->get device name
Device name: DLII_SYD_01
success

set device name [device_name] command stores user defined board name into EEPROM memory segment. Device_name is a textual string.

Previous article: DefendLineII. Building firmware;

Additional info: DefendLineII Kit;