
PAN1322
Application Note
20
Revision 1.2, 2013-12-18
Design Guide
4.3
Switch from Command Mode to Stream Mode
After a Bluetooth SPP connection has been established, the host can send the command AT+JSCR in
command mode to switch the eUniStone to stream mode. A transparent communication will be
enabled if both sides of the connection are using stream mode.
4.4
Switch from Stream Mode to Command Mode
The host can send the escape string “^ ^ ^” to switch the eUniStone back to command mode. The
string must be sent with the following timing:
Pause time between each “^ “ sign: T1 = 100ms to 1 sec.
Pause time after the last “^” sign: T0 > 1sec.
If the remote device disconnects the link when the eUniStone module is in stream mode, the
eUniStone module will immediately send a „Disconnect Indication“ +RDII to the host and switch back
to command mode automatically.
If the remote device is off (e.g. powered off or out of range) when the eUniStone module is in stream
mode, stream data cannot be transmitted any more on the air. Hardware flow control stops any
further UART communication as soon as the module’s UART input buffer is full. After the link
supervision timeout of 20 s, the module sends a „Disconnect Indication“ +RDII to the host. At that
instant, Any UART data is flushed and the device switches back to command mode automatically.
The host has to wait during the supervision timeout of 20 s. As soon as the UART buffer is full, it is not
possible to leave stream mode or to disconnect the link locally before the supervision timeout expires.
There are two ways to detect a disconnection in stream mode:
1.
The host is searching for “+RDII“ in the data stream from the module. The host shall
switch from stream mode to command mode when it recognizes the “+RDII“
indication. Any stream data sent after the “+RDII“ indication will be answered by an
error message “ERR=-1“ (syntax error). If the host after that sends a first command
it will be responded with “ERR=-1“, since the UART is out of sync. The second
command will get the expected response (e.g. “OK”).
2.
The GPIO pin P0.1 (pin E5) is used to indicate the connection status. P0.1 is HIGH
when eUniStone device is connected and LOW when there is no connection. The
transition from HIGH to LOW happens prior to sending the “+RDII” indication via
UART. Hosts that cannot monitor the incoming data stream for the "+RDII"
indication in stream mode may monitor P0.1 in eUniStone.
P0.1 is configured as input pin by default. To use this feature the host shall send the AT command
“AT+JGPC=FFFD,0000,0000,0000,FFFD” which configures P0.1 as an output pin.