Bus
bus.command.read_timeout
Abbreviation
bu c t
Access
get/set
Description
Controls the maximum amount of time that the read command waits to complete a read.
The amount of data to be read is specified in the parameters of the read command.
Note : a timeout still returns success.
Arguments
<timeout ms>
where:
-
<timeout ms>
- timeout duration specified in milliseconds. Range: 0 - 65535
Default
100
Platforms
- WGM160P
Properties
- takes effect immediately
Gecko OS Plugin
Get example
> get bu c t
R000005
100
Set example
> set bu c t 256
R000008
Set OK
bus.command.rx_bufsize
Abbreviation
bu c r
Access
get/set
Description
Configure the size of the UART rx buffer in command mode.
Note : in stream mode if bus.stream.flush_count > 0 then the UART RX buffer size is set to:
buffer size = MAX(bus.stream.flush_count, bus.command.rx_bufsize)
This greatly helps data throughput in flushed stream mode. See bus.stream.flush_count .
Arguments
<buffer size>
Range
256
to
10000
bytes
Default
4096
Platforms
- WGM160P
Properties
Gecko OS Plugin
Get example
> get bu c r
R000006
4096
Set example
> set bu c r 512
R000008
Set OK
bus.command.write_check_enabled
Abbreviation
bu c c
Access
get/set
Description
This
bus.command.write_check_enabled
variable determines whether the
write buffer
is checked when the
stream_write
is executed.
This allows writing data to a network stream with the certainty that, if the write fails, no data was read or sent.
If
bus.command.write_check_enabled
=
1
the check takes place. The check ensures that there is enough room to hold all of the read data. The check takes place before data is read from the data bus. If the
write buffer
does not have enough room to hold the requested read amount after
bus.command.write_timeout
milliseconds, the
stream_write
command fails with an error code:
9
=
Bounds error
. See
Serial Interface, Response Format
.
If the
stream_write
command fails with error code
9
=
Bounds error
, then no data issued in the
stream_write
command was read or sent.
To query how much data is available in the
write buffer
, issue the
poll
write buffer
.
The
write buffer
is dependent on the stream type and only available for network connections.
For network connections using a TCP socket, the
write buffer
is the minimum of:
- TCP TX window - the amount of buffer the remote TCP connection advertises it can receive
- Network TX buffer - The TX portion of the buffer specified by network.buffer.size and network.buffer.rxtx_ratio
The following streams use a TCP socket:
- TCP server/client
- TLS server/client
- Websocket server/client
A UDP client/server stream
write buffer
is dependent only on the TX portion of the network buffer.
The following example shows how the variable is used.
Assume a TCP stream
0
is opened, and issuing the
poll 0 -t
command returns:
poll 0 -t
0,3345
This indicates the write command can accept no more than
3345
bytes without waiting for more buffer space from the remote side.
If
bus.command.write_check_enabled
=
1
, the check takes place, and issuing
write 0 6000
fails after
bus.command.write_timeout
milliseconds if the remote TCP connection does not update its TCP window:
write 0 6000
<6000 bytes of data>
R900014
Bounds error
In this case, none of the 6000 bytes of data was read from the bus and thus none of the data was sent.
Note
: If
bus.command.write_check_enabled
=
0
then the behavior is as in previous releases: Gecko OS immediately reads the data bus and attempts to write the data within
bus.command.write_timeout
milliseconds. If the write times out then the amount of data actually sent to the remote side is unknown. An error code of
1
=
Command Failed
is returned if the write times out.
See also:
Arguments
1|true|on/0|false|off
where
-
0
orfalse
oroff
: write buffer checking does NOT take place -
1
ortrue
oron
: write buffer checking takes place
Default
0
Platforms
- WGM160P
Properties
- takes effect immediately
Gecko OS Plugin
Get example
> get bu c c
Set example
> set bu c c 1
Set OK
bus.command.write_timeout
Abbreviation
bu c w
Access
get/set
Description
Controls the maximum amount of time the write command blocks waiting for more data to be read from the data bus.
Note : On timeout the command fails.
Arguments
<timeout ms>
where:
-
<timeout ms>
- timeout duration specified in milliseconds. Range:0 - 65535
ms
Default
25000
Platforms
- WGM160P
Properties
- takes effect immediately
Gecko OS Plugin
Get example
> get bu c w
R000007
25000
Set example
> set bu c w 60000
R000008
Set OK
bus.data_bus
Abbreviation
bu d
Access
get/set
Description
The serial data bus to use for communication with a host.
Arguments
<uart0/uart1>
Default
<platform dependent>
Platforms
- WGM160P
Properties
- save and reboot to apply change
- available in Safe Mode
- preserved by NVM Backup
- lockable: see system.variable_lock
Gecko OS Plugin
Get example
> get bu d
R000007
uart1
Set example
> set bu d uart0
R000008
Set OK
bus.log_bus
Abbreviation
bu l
Access
get/set
Description
All log messages are sent to this serial bus regardless of bus mode.
Arguments
<uart0/uart1>
Default
<platform dependent>
Platforms
- WGM160P
Properties
- save and reboot to apply change
- available in Safe Mode
- preserved by NVM Backup
- lockable: see system.variable_lock
Gecko OS Plugin
Get example
> get bu l
R000007
uart1
Set example
> set bu l uart0
R000008
Set OK
bus.mode
Abbreviation
bu m
Access
get/set
Description
The serial bus mode.
Arguments
<command/stream>
Default
command
Platforms
- WGM160P
Properties
- save and reboot to apply change
- available in Safe Mode
- preserved by NVM Backup
- lockable: see system.variable_lock
Gecko OS Plugin
Get example
> get bu m
R000009
command
Set example
> set bu m command
R000008
Set OK
bus.stream.cmd_gpio
Abbreviation
bu s g
Access
get/set
Description
The GPIO used to force the module into command mode (from stream mode). A value of -1 disables this feature.
Arguments
<[GPIO#]/[-1]>
where:
- Available GPIO numbers depend on platform
-
-1
means no GPIO is assigned and feature is disabled
Default
-1
Platforms
- WGM160P
Properties
Gecko OS Plugin
Get example
> get bu s g
R000003
0
Set example
> set bu s g 6
R000008
Set OK
bus.stream.cmd_seq
Abbreviation
bu s s
Access
get/set
Description
Break-in sequence for stream mode. After 3 seconds of inactivity on the serial interface, sending the break-in sequence changes stream mode to command mode; send 'exit' to return to stream mode.
Note : The length of the break-in sequence affects the allowed minimum value of bus.stream.flush_count .
This feature may be disabled with the following command:
set bus.stream.cmd_seq ""
When disabled, the break-in sequence is disabled. This allows for binary data streams or for any streams which may be interpreted incorrectly as the break-in sequence.
Note : If this feature is disabled it's strongly recommended to enable bus.stream.cmd_gpio and/or another remote command feature, such as the remote terminal or the Gecko OS Web App .
Otherwise the Gecko OS command console will be inaccessible until the module is factory reset.
Arguments
<1-15 characters>
Default
$$$
Platforms
- WGM160P
Properties
Gecko OS Plugin
Get example
> get bu s s
R000005
$$$
Set example
> set bu s s ###
R000008
Set OK
bus.stream.flush_count
Abbreviation
bu s c
Access
get/set
Description
Number of bytes received on the serial bus before flushing to the network stream.
In
stream mode
, if the value of
bus.stream.flush_count
is greater than
bus.command.rx_bufsize
, the buffer size is set to the
bus.stream.flush_count
value. See
bus.command.rx_bufsize
.
Arguments
<count>
where
<count>
can range from
minimum value
to
maximum value
:
-
minimum value
:
MAX(16, len(bus.stream.cmd_seq)*2)
i.e. the minimum value is the maximum of 16 and 2 x the length of the bus.stream.cmd_seq variable
For example, ifbus.stream.cmd_seq
is the default$$$
, its length is 3, so minimum value is the maximum of 16 and 2*3 = 16. - maximum value : 1460
Default
1460
Platforms
- WGM160P
Properties
Gecko OS Plugin
Get example
> get bu s c
R000006
1460
Set example
> set bu s c 1450
R000008
Set OK
bus.stream.flush_time
Abbreviation
bu s t
Access
get/set
Description
Timeout in milliseconds before bytes are automatically flushed to the network stream.
If set to 0, automatic flush is disabled.
To achieve optimal throughput, set flush time to
0
. Gecko OS transfers data with 'Zero Copy'. i.e. a data packet is directly transferred from the bus to network or network to bus.
Arguments
<0-65535>
Range:
0 - 65535
Default
50
Platforms
- WGM160P
Properties
Gecko OS Plugin
Get example
> get bu s t
R000004
20
Set example
> set bu s t 10
R000008
Set OK
bus.stream.flush_time_reset
Abbreviation
bu s r
Access
get/set
Description
Flag whether to reset the flush timer if data is received before the flush timeout expires. When this variable is set and data is streaming, data is flushed only when the buffer is full. This allows for efficient use of the packet buffer and prevents packet fragmentation. When the variable is reset, the buffer is flushed at intervals of bus.stream.flush_time and also when the buffer is full. This allows data to be sent at consistent intervals.
Arguments
1|true|on/0|false|off
Default
0
Platforms
- WGM160P
Properties
Gecko OS Plugin
Get example
> get bus.stream.flush_time_reset
0
Set example
> set bus.stream.flush_time_reset 1
Set OK