Atmel Software Framework

Accessing the Control Panel through its shell interface on UART_0

In this scenario, you are a local user who wishes to access the Control Panel through its UART_0 shell interface. You are equipped with a laptop. Over this interface, you have administrator right-access to the Control Panel's internal file system (read, write, execute), and you have access to several functions that interact with sensors & actuators.

1) Connecting to the shell.

  • With a male-female serial cable, join your laptop COM port to the Control Panel's UART_0 COM port.
  • On your laptop, launch hyperterminal:

    ShellLaunchHyperT.gif

  • Name the new connection, choose any icon:

    ShellHyperTNewConnDescription.gif

  • Select COM1 (or rather the identifier of the COM port you chose on your laptop):

    ShellHyperTChooseCom.gif

  • Fill-in the following properties to match the Control Panel's UART_0 settings (Bits per second=57600, Data bits=8, Parity=None, Stop bits=1, Flow control=None):

    ShellHyperTComProperties.gif

    Click on Apply then on OK. Your hyperterminal is now configured.
  • Type enter in Hyperterminal; the invite prompt $> of the shell should appear:

    ShellHyperTPrompt.gif

2) Listing all available commands.

Type help followed by enter: this will execute the help command that lists all available commands and a short description for each:

ShellHelpOutput.gif


Note that the prompt $> appears again after completion of the command, waiting for the next command. There are three main families of function:

  • one family deals with the actuators and the sensors (get/set an actuator current value, get/set the configuration of a sensor, get a sensor current value),
  • another family deals with the Control Panel file system (operations on files and directories),
  • another family deals with some system configuration variables (e.g. Control Panel's IP address, HTTP port).

3) An example of an actuator command : write a string to the LCD user message zone.

Type on the shell: set_actuator_value actuator=lcd usrmsg="Hello Goodbye!" time=10 This command writes the string "Hello Goodbye!" to the LCD user message zone (i.e. the 4th line) in 10 seconds from the moment you hit enter. The "time=10" argument is optional.

4) An example of a sensor command : get the current temperature.

Type on the shell: get_sensor_value sensor=temp Once enter is hit, this command will display on the next line of the shell the current temperature log. Example:

ShellGetTempVal.gif


The above displayed log is made of three fields: the sensor name, the current date, the sensor value.

5) Examples of file system commands.

  • Suppose we want to see the content of the /WEB directory(i.e. the Web server files):
    • The Control Panel supports multiple drives. By default, there is only one available drive, that is the dataflash. Let's display the available drives:

      ShellDfCmd.gif

      We see that we currently have only one drive, the drive a.
    • Mount the a drive:

      ShellMntCmd.gif

    • Display the current content of the top / directory on the a drive:

      ShellLs1Cmd.gif

    • Go to the WEB directory: type cd WEB then enter. Then display the content of the WEB directory.

      ShellLs2Cmd.gif

      We can see that the WEB directory contains 10 files and one sub-directory.
  • Suppose we want to activate the logs activity of the Control Panel: As long as the /LOG directory doesn't exist, the Control Panel doesn't save the data logs into log files (all log files are saved into this directory).
    • Mount the a drive:
    • Display the current content of the top / directory on the a drive:
      We can see that the LOG directory doesn't exist. Let's create it.
    • Create the LOG directory(with the mkdir command):

      ShellCreateLogDir.gif

      The next ls command shows that the LOG directory has been created.
    • Let's wait a little while and then list the content of the LOG directory. At least one log file should have been created : the Control Panel has started logging data logs.

      ShellLogDirLs.gif

      The file listed is a data log file. Let's list its current content (with the cat command).Here is an excerpt of the output of the "cat t021307_0901.log" command:

      ShellCatLog.gif

      We can see that a data log file is made of several sensors and actuators logs.

Contact Information

For further information, visit Atmel AVR32.