RP6 ROBOT SYSTEM - 4. RP6 CONTROL M256 WIFI Library
4.1.10.2. Command Mode
The following functions are not necessary for the data communication with the PC.
Once the module has been properly set up via RobotLoader, it becomes almost trans-
parent for transmissions and can be used like a serial interface for the microcontroller.
Some other advanced functions that the WLAN module offers, may be included in a
future library version.
The command mode of the WLAN module is activated by the following function:
void enter_cmd_mode_WIFI(void)
Once this function has been executed, the WLAN module is in command mode. De-
pending on the firmware version running on the WLAN module, the change into com-
mand mode happens either by sending $$$ plus a 250ms delay, or alternatively
(much faster) via an I/O port (GPIO14). Firmware version 2.32 and later introduce a
GPIO cmd mode that can be activated in the source code of the library (configure the
module accordingly, this function is normally deactivated). The newest version of the
M256 library configures itself automatically via the configuration data that RobotLoad-
er stores in EEPROM. Therefore you can simply activate the use of the GPIO14 pin in
the WLAN configuration dialog in RobotLoader!
With
void leave_cmd_mode_WIFI(void)
you leave the command mode. You always have to leave the cmd mode before you
can send data again.
Basically you can send commands to the module via the normal writeString / Char
_WIFI functions – these must always be terminated by \r (=CR, Carriage Return). Be
careful here, \n does not work! Alternatively you may also use \r\n.
In command mode, the module returns every received character as an echo. This can
be used to check the correct transmission and is also useful to wait until the command
has been completely received by the module.
If you want to send a command to the WLAN module and check the echo, you can use
the function
int8_t writeCommand_WIFI(char * cmd)
However this checks only if the echo of the command has been received on return.
The WLAN module sends every single character back immediately and this is checked
by this function. This only makes sure that the command has been completely trans-
mitted after having left the function. However a confirmation message or any other
output is not checked.
The return value is 1 for successful and 0 for failure.
- 38 -