This is the multi-page printable view of this section. Click here to print...

Return to the regular view of this page

As of 2025-07-24

Serial Communication App Manual

v1.5.1 GOLD Latest version

Download

To install the Serial Communication App (App_Uart), install the TWELITE STAGE SDK and rewrite using the TWELITE STAGE App.

1 - Pin Assignments of Serial Communication App

Functions of pins used by the Serial Communication App

TWELITE / TWELITE DIP

The functions of pins used by the Serial Communication App are represented using the pin names from the Super Simple! Standard App Pins shown in the figure below.

Super Simple! Standard App Pin Assignment Table

Super Simple! Standard App Pin Assignment Table

Serial CommunicationSuper Simple! StandardFunction
VCC GNDVCC GNDPower Input
TX RXTX RXSerial Input and Output
TX_SUB RX_SUBSCL SDASerial Sub Input and Output
RTSPWM1Serial Input Permission
M1M1Parent/Child Selection
M2M2Adding Relay Function to Child
M3M3Sleep
EX1AI2Overwriting Operation Mode
BPSBPSEnabling Alternative Baud Rate Setting
RSTRSTReset Input
SETDI1Enter interactive mode

Power Input

Connect a 3.3V (2.0-3.6V) power supply to VCC/GND.

Serial Input and Output

TX/RX are used for transmitting and receiving serial communication (UART).

Serial Sub Input and Output

TX_SUB (SCL) / RX_SUB (SDA) can be used as sub-ports for serial input and output.

Serial Input Permission

When RTS (PWM1) is at Low level, it indicates that serial input to RX is being accepted.

Parent/Child Selection

Connecting M1 to GND sets the device as a parent, while leaving it open or connecting to VCC sets it as a child.

Adding Relay Function to Child

When M2 is connected to GND in child mode, relay functionality can be added.

Sleep

Connecting M3 to GND puts the device into sleep mode.

Overwriting Operation Mode

By connecting EX1 to GND at startup, the operation mode can be overwritten to format mode (binary).

Enabling Alternative Baud Rate Setting

Connecting BPS to GND enables the alternative baud rate setting specified in interactive mode.

Reset Input

By connecting a push button between RST and GND, a reset button can be implemented. RST has an internal pull-up resistor.

Enter interactive mode

By connection SET to GND on startup, the interactive mode will be ready.

TWELITE UART

The functions of pins used by the Serial Communication App are represented using the pin names of the 7P interface printed on the board (② in the figure below).

Board Antenna Type

Board Antenna Type

Coaxial Connector Type

Coaxial Connector Type

SilkscreenFunction
VCC GNDPower Input
TXD RXDSerial Input and Output
SETOverwriting Operation Mode
RSTReset Input

Power Input

Connect a 3.3V (2.0-3.6V) power supply to VCC/GND.

Serial Input and Output

TX/RX are used for transmitting and receiving serial communication (UART).

Overwriting Operation Mode

By connecting SET to GND at startup, the operation mode can be overwritten to format mode (ASCII).

Reset Input

By connecting a push button between RST and GND, a reset button can be implemented. RST has an internal pull-up resistor.

2 - Communication Modes of Serial Communication App

Explanation of each communication mode
The Serial Communication App (App_Uart) has five communication modes.

List of Communication Modes

Each mode is switched by Interactive Mode (some modes can be set via pin input).

IDMode
AFormat Mode (ASCII)
BFormat Mode (Binary)
CChat Mode
DTransparent Mode
EHeader Transparent Mode

Initial state is Header Transparent Mode.

A: Format Mode (ASCII)

When data is input to the transmitting terminal according to a specific format, the receiving terminal outputs data according to the same specific format.

Data represented in hexadecimal is expressed as ASCII strings.

Input on Transmitting SideOutput on Receiving Side
Simple/Extended format dataSimple/Extended format data

In TWELITE UART, this mode is enabled when started with the SET pin connected to GND.

There are two formats to represent data.

  • Simple format: Uses only logical device ID. Super simple! Compatible with the standard app’s UART transmission function.
  • Extended format: Uses transmission options such as serial ID and retransmission count in addition to logical device ID.

For example, 5-byte binary data 0x48 0x45 0x4C 0x4C 0x4F can be sent using the simple format as follows.

[Transmitting Side]

:000148454C4C4F8B  <- Input
:DBA1800103  <- Output

[Receiving Side]

:780148454C4C4F13  <- Output

In format mode, settings such as application ID can be dynamically applied not only by Interactive Mode but also by commands via UART (ASCII format).

B: Format Mode (Binary)

When data is input to the transmitting terminal according to a specific format, the receiving terminal outputs data according to the same specific format.

Data represented in hexadecimal is expressed in binary format as is.

Input on Transmitting SideOutput on Receiving Side
Simple/Extended format dataSimple/Extended format data

In TWELITE / TWELITE DIP, this mode is enabled when started with the EX1 pin connected to GND.

Like Format Mode (ASCII), there are two formats to represent data.

For example, 5-byte binary data 0x48 0x45 0x4C 0x4C 0x4F can be sent using the simple format as follows.

[Transmitting Side]

0xA5 0x5A 0x00 0x07 0x00 0x01 0x48 0x45 0x4C 0x4C 0x4F 0x43 0x04    <- Input
0xA5 0x5A 0x00 0x04 0xDB 0xA1 0x80 0x01 0xFB 0x04  <- Output

[Receiving Side]

0xA5 0x5A 0x00 0x07 0x78 0x01 0x48 0x45 0x4C 0x4C 0x4F 0x3B 0x04  <- Output

In format mode, settings such as application ID can be dynamically applied not only by Interactive Mode but also by commands via UART (binary format).

C: Chat Mode

Enables text chat.

Input on Transmitting SideOutput on Receiving Side
Any stringAuxiliary information + any string

Displays prompt and echoes back (outputs the entered characters). All terminals act as child devices and perform broadcast communication.

For example, when a terminal sends the string Hello to other terminals, the behavior is as follows.

[Transmitting Side]

810A4778:0> Hello  <- Input
810A4778:1>  <- Output

[Receiving Side]

[810A4778:0] Hello  <- Output
82018CA0:0>  <- Output

In the above example, the prompt shows the serial ID, but you can also use any handle name.

D: Transparent Mode

When arbitrary data is input to the transmitting terminal, the receiving terminal outputs the received data as is.

Input on Transmitting SideOutput on Receiving Side
Any dataAny data

Since no format is required, existing UART communication can be easily wirelessized.

On the other hand, data boundaries become ambiguous, and the receiving output cannot identify the sender, which are drawbacks.

By default, data input to the transmitting side is separated by CRLF, and data before CRLF is sent.

For example, when Hello<Enter> is input on the transmitting terminal, the receiving terminal outputs Hello as is.

[Transmitting Side]

Hello  <- Input

[Receiving Side]

Hello  <- Output

E: Header Transparent Mode

When arbitrary data is input to the transmitting terminal, the receiving terminal outputs the received content with auxiliary information added in a specific format.

Input on Transmitting SideOutput on Receiving Side
Any dataAny data + auxiliary information

By default, data input to the transmitting side is separated by CRLF, and data before CRLF is sent.

For example, when Hello<Enter> is input on the transmitting terminal, the receiving terminal outputs Hello in a format including auxiliary information. The transmitting terminal also outputs a format that conveys a transmission completion message.

[Transmitting Side]

Hello  <- Input
;U;00004;219;0x820163B2;000;000;0,1,Hel...;6E;  <- Output

[Receiving Side]

;U;00003;000;0x820163B2;255;000;Hello;42;  <- Output

The auxiliary information output by the receiving side includes the sender’s address, received signal strength, checksum, etc. The format of auxiliary information can be customized.

2.1 - Serial Communication App Format Mode (ASCII)

Mode that adds headers to both transmitted and received outputs (ASCII format)
Format mode adds headers to both transmitted and received outputs. In ASCII format, data is represented as hexadecimal strings.
Example network configuration with format mode

Overview

When data formatted in a specific manner is input on the transmitting side, the receiving side outputs data formatted in the same manner.

Data is represented as hexadecimal ASCII strings.

Transmitting Side InputReceiving Side Output
Simple/Extended format dataSimple/Extended format data
  • In TWELITE UART, format mode (ASCII) is enabled by starting up with the SET pin connected to GND.
  • In TWELITE / TWELITE DIP, format mode (binary) is enabled by starting up with the EX1 pin connected to GND.

There are two types of formats that can be handled.

  • Simple format: uses only the Logical Device ID. Extremely Simple! Compatible with the UART transmission function of the standard app.
  • Extended format: uses Logical Device ID plus transmission options such as Serial ID and retry count.

For example, 5-byte binary data 0x48 0x45 0x4C 0x4C 0x4F can be sent using the simple format as follows.

[Sending side]

:000148454C4C4F8B  <- Input
:DBA1800103  <- Output

[Receiving side]

:780148454C4C4F13  <- Output

Basic Format

When sending data sequences expressed in basic or extended formats, they are converted to ASCII strings (0-9, A-F).

The format is extremely simple! It starts with : and ends with CRLF, just like the output of the standard app (App_Twelite) or the parent device output of the parent/repeater app (App_Wings).

HeaderPayloadChecksumFooter
:Repeated 00-FFLRC8 of payloadCRLF
  • All ASCII characters
  • Starts with : (0x3A)
  • Checksum is the two’s complement of the sum of the payload
  • Ends with CRLF (\r\n/0x0D 0x0A)
  • Big-endian

For example, binary data 0x00 0x11 0x22 0x33 0xAA 0xBB 0xCC is expressed as follows.

:00112233AABBCC69<CR><LF>

Distinguishing Parent and Child Devices

Format mode distinguishes between parent and child devices.

The Application ID and frequency channel must be matched between parent and child devices.

Source Identification

Format mode allows identifying the source from the received data.

The simple format uses the Logical Device ID, and the extended format uses the Logical Device ID plus the extended address.

Simple Format

When using the simple format of format mode, follow the format below.

Transmitting Side Input

#DataDescriptionNotes
charHeaderOnly :
0uint8Destination Logical Device IDParent 0x00, child 0x01-0x64, all children 0x78
1uint8Command numberAny value less than 0x80
2[uint8]Arbitrary dataByte sequence of length (N) (recommended (N \leqq 80))
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

Receiving Side Output

#DataDescriptionNotes
charHeaderOnly :
0uint8Source Logical Device IDParent 0x00, child 0x01-0x64, unset child 0x78
1uint8Command numberValue less than 0x80 specified by the sender
2[uint8]Arbitrary dataByte sequence of length (N)
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

Transmitting Side Output (Response Message)

#DataDescriptionNotes
charHeaderOnly :
0uint8Source Logical Device IDOnly 0xDB: indicates itself
1uint8Command numberOnly 0xA1
2uint8Response IDContinuation number in the range 128-255 (0x80-0xFF)
3uint8ResultSuccess 1, failure 0
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

Example Usage

An example of sending byte sequence 0x11 0x22 0x33 0xAA 0xBB 0xCC from the parent to all children is shown.

[Sending side: Parent]

:7801112233AABBCCF0<CR><LF>  <- Input
:DBA1800103<CR><LF>  <- Output

The trailing 0xF0 is the checksum: the two’s complement of the sum from 0x78 to 0xCC (LSB 8 bits).

[Receiving side: All children]

:0001112233AABBCC68<CR><LF>  <- Output

The trailing 0x68 is the checksum: the two’s complement of the sum from 0x00 to 0xCC (LSB 8 bits).

Extended Format

When using the extended format of format mode, follow the format below.

Transmitting Side Input

When specifying destination using Logical Device ID

#DataDescriptionNotes
charHeaderOnly :
0uint8Destination Logical Device IDParent 0x00, child 0x01-0x64, all children 0x78
1uint8Command numberOnly 0xA0
2uint8Response IDAny value
3[uint8]OptionsOption list of length (N) (Details of option list)
3+(N)[uint8]Arbitrary dataByte sequence of length (M) (recommended (M \leqq 80))
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

When specifying destination using Extended Address

#DataDescriptionNotes
charHeaderOnly :
0uint8Extended Address SpecifierOnly 0x80
1uint8Command numberOnly 0xA0
2uint8Response IDAny value
3uint32Destination Extended AddressSerial ID with 0x8 added at the front
7[uint8]OptionsOption list of length (N) (Details of option list)
7+(N)[uint8]Arbitrary dataByte sequence of length (M) (recommended (M \leqq 80))
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

Details of Option List

In the extended format, you can specify fine settings by specifying the option list.

The option list is represented by repeating option IDs and their arguments. The end is 0xFF.

IDArgumentDefaultDescription
0x01NoneDisabledEnable MAC ACK
0x02uint80x00Enable application retry
0x03uint160x0000Minimum initial transmission delay
0x04uint160x0000Maximum initial transmission delay
0x05uint1610Application retry interval
0x06NoneDisabledAllow parallel requests
0x07NoneDisabledDisable response messages
0x08NoneDisabledSleep after transmission
0x01: Enable MAC ACK

Enables MAC layer ACK (acknowledgment).

Not suitable for frequent data transmission, but can improve reliability.

0x02: Enable Application Retry

When using MAC ACK, specify 0x00-0x0F. Retries 0-16 times respectively until the transmission succeeds.

When not using MAC ACK, specify 0x81-0x8F. Always retries 1-16 times.

Response messages are output after all retries are completed.

0x03: Minimum Initial Transmission Delay

Specifies the minimum delay before the first transmission in milliseconds.

0x04: Maximum Initial Transmission Delay

Specifies the maximum delay before the first transmission in milliseconds.

0x05: Application Retry Interval

Specifies the retry interval in milliseconds when application retry is enabled.

0x06: Allow Parallel Requests

Allows parallel requests.

When allowed, the next request can be accepted without blocking until the current request completes.

For example, if three requests with a 0.5-second delay are input consecutively, normally they are processed sequentially at 0.5s, 1.0s, and 1.5s. When parallel requests are allowed, they are processed in no particular order after 0.5s. Note that it cannot be used when packet fragmentation is required.

0x07: Disable Response Messages

Disables the response messages output when data is input on the transmitting side.

0x08: Sleep After Transmission

Immediately puts the device to sleep after transmission.

When RX detects a rising edge, it wakes up from sleep. Please input any 1 byte of data.

After waking up, UART initialization completes and input is accepted.

Receiving Side Output

#DataDescriptionNotes
charHeaderOnly :
0uint8Source Logical Device IDParent 0x00, child 0x01-0x64, unset child 0x78
1uint8Command numberOnly 0xA0
2uint8Response IDValue specified by the sender
3uint32Source Extended AddressSerial ID with 0x8 added at the front
7uint32Destination Extended Address0xFFFFFFFF if using Logical Device ID
11uint8LQIRadio communication quality at reception
12uint16Length of following byte sequenceNumber of bytes (M)
14[uint8]Arbitrary dataByte sequence of length (M)
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

Transmitting Side Output (Response Message)

#DataDescriptionNotes
charHeaderOnly :
0uint8Source Logical Device IDOnly 0xDB: indicates itself
1uint8Command numberOnly 0xA1
2uint8Response IDValue specified at input
3uint8ResultSuccess 1, failure 0
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

Example Usage

An example of sending byte sequence 0x11 0x22 0x33 0xAA 0xBB 0xCC from the parent to a child is shown.

Example specifying Logical Device ID

An example sending from the parent to the child with Logical Device ID 0x42.

  • Response ID is 0x01
  • No options
  • Parent’s extended address is 0x81000000 (Serial ID 0x1000000)

[Sending side: Parent]

:42A001FF112233AABBCC87<CR><LF>  <- Input
:DBA1010182<CR><LF>  <- Output

The trailing 0x87 is the checksum: the two’s complement of the sum from 0x42 to 0xCC (LSB 8 bits).

[Receiving side: Child]

:00A00181000000FFFFFFFFC80006112233AABBCC7D<CR><LF>  <- Output

The trailing 0x7D is the checksum: the two’s complement of the sum from 0x00 to 0xCC (LSB 8 bits).

Example specifying Extended Address

An example sending from the parent to the child with extended address 0x81000001 (Serial ID 0x1000001).

  • Response ID is 0x01
  • No options
  • Parent’s extended address is 0x81000000 (Serial ID 0x1000000)

[Sending side: Parent]

:80A00181000001FF112233AABBCCC7<CR><LF>  <- Input
:DBA1010182<CR><LF>  <- Output

The trailing 0xC7 is the checksum: the two’s complement of the sum from 0x80 to 0xCC (LSB 8 bits).

[Receiving side: Child]

:00A0018100000081000001C80006112233AABBCCF7<CR><LF>  <- Output

The trailing 0xF7 is the checksum: the two’s complement of the sum from 0x00 to 0xCC (LSB 8 bits).

Example using MAC ACK

An example sending from the parent to the child with Logical Device ID 0x42 using MAC ACK.

  • Response ID is 0x01
  • Option 0x01: Enable MAC ACK specified
  • Parent’s extended address is 0x81000000 (Serial ID 0x1000000)

[Sending side: Parent]

:42A00101FF112233AABBCC86<CR><LF>  <- Input
:DBA1010182<CR><LF>  <- Output

The trailing 0x86 is the checksum: the two’s complement of the sum from 0x42 to 0xCC (LSB 8 bits).

[Receiving side: Child]

:00A00181000000FFFFFFFFC80006112233AABBCC7D<CR><LF>  <- Output

The trailing 0x7D is the checksum: the two’s complement of the sum from 0x00 to 0xCC (LSB 8 bits).

Example using delay

An example sending from the parent to the child with Logical Device ID 0x42 with a 768ms delay.

[Sending side: Parent]

:42A001030300FF112233AABBCC81<CR><LF>  <- Input
:DBA1010182<CR><LF>  <- Output

The trailing 0x81 is the checksum: the two’s complement of the sum from 0x42 to 0xCC (LSB 8 bits).

[Receiving side: Child]

:00A00181000000FFFFFFFFC80006112233AABBCC7D<CR><LF>  <- Output

The trailing 0x7D is the checksum: the two’s complement of the sum from 0x00 to 0xCC (LSB 8 bits).

0xDB Command

Instead of setting interactive mode, you can operate and configure the module by inputting the 0xDB command from UART.

2.1.1 - 0xDB Command in Serial Communication App Format Mode (ASCII)

Setting functions using the 0xDB command in format mode (ASCII) without using Interactive Mode
In format mode, dynamic configuration can be performed from devices connected via UART by using the 0xDB command instead of Interactive Mode.

Input Format

#DataContentRemarks
charHeader: only
0uint8Destination logical device IDOnly 0xDB itself
1uint8Command numberSelected from values below
2[uint8]ParameterOptional length N bytes representing setting values
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

List of Command Numbers

Function
0xF0Enable ACK
0xF1Get Device Info
0xF2Apply Device Settings
0xF3Get Device Settings
0xFDErase Device Settings
0xFESave Device Settings
0xFFReset Device

0xF0: Enable ACK

Requests an ACK response.

No parameters.

Response Format

#DataContentRemarks
charHeader: only
0uint8Destination logical device IDOnly 0xDB
1uint8Command numberOnly 0xF0
2uint8DataOnly 0x01
uint8Checksum0x34: LRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

0xF1: Get Device Info

Displays address and other information. Also output at startup.

No parameters.

Response Format

#DataContentRemarks
charHeader: only
0uint8Destination logical device IDOnly 0xDB
1uint8Command numberOnly 0xF1
2uint32Default Application ID67720103
6uint32Version numberFor 1.4.7, 00010407
10uint8Logical device ID
11uint32Serial ID
15uint8Silent mode statusEnabled 1, Disabled 0
16uint8Network statusUP 1, DOWN 0
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

0xF2: Apply Device Settings

Applies the settings.

Response Format

On Success
#DataContentRemarks
charHeader: only
0uint8Destination logical device IDOnly 0xDB
1uint8Command numberOnly 0xF3
2[uint8]Settings contentIdentifier
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')
On Failure
#DataContentRemarks
charHeader: only
0uint8Destination logical device IDOnly 0xDB
1uint8Command numberOnly 0xF3
2uint8ErrorOnly 0xFF
uint8Checksum0x33: LRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

0xF3: Get Device Settings

Gets the settings.

Response Format

#DataContentRemarks
charHeader: only
0uint8Destination logical device IDOnly 0xDB
1uint8Command numberOnly 0xF3
2[uint8]Settings contentIdentifier and data
uint8ChecksumLRC8
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')

0xFD: Erase Device Settings

Resets device settings and resets the device.

No parameters or response.

0xFE: Save Device Settings

Saves applied settings and resets the device.

No parameters or response.

0xFF: Reset Device

Discards applied settings and resets the device.

No parameters or response.

Parameter List (0xF2 / 0xF3)

Parameters for 0xF2: Apply Device Settings and 0xF3: Get Device Settings are represented by repeated pairs of identifiers and data (big endian).

IdentifierDataContent
0x00uint32Application ID
0x01uint32Frequency Channel Mask
0x02uint16Retry Count and Output
0x03uint8Logical Device ID
0x04uint8Role
0x05uint8Relay Layer
0x06uint8Communication Mode
0x07uint32Baud Rate
0x08uint8Parity
0x09uint8Encryption Function
0x0A[uint8]Encryption Key
0x0B[uint8]Header / Handle name
0x0Cuint16Delimiter Character
0xFFuint8Error

0x00: Application ID

Specifies the application ID.

0x01: Frequency Channel Mask

Specifies the bit mask of frequency channels.

Set bits for channels to be used. For example, to use channel 11, specify 1<<11.

0x02: Retry Count and Output

Specifies the radio transmission output and the number of additional packet transmissions in transparent mode and header-attached transparent mode.

Only the lower 1 byte is used. The upper 4 bits represent the retry count (0-9), and the lower 4 bits represent the transmission output (0-3). For example, 8 retries / output 3 is 0x0083.

0x03: Logical Device ID

Specifies the logical device ID.

0x04: Role

Effective only for slave devices. Specify one of the following values. Normally, select a delivery method that does not use the network layer.

Delivery Methods Without Network Layer

  • 0: Normal designation (parent or child device)
  • 1-3: Relay slave devices (logical device IDs are 1-100 or 120). Numbers 1-3 indicate the maximum relay hop count. This method retransmits up to the maximum relay hops, which may cause duplicate packets depending on relay device placement and count.

Delivery Methods Using Network Layer

  • 11: Parent device
  • 12: Relay device
  • 13: Child device

0x05: Relay Layer

The relay layer number. Relay devices attempt to connect to relay devices or parent devices in upper (smaller value) relay layers. Effective only when Role is set to 12.

0x06: Communication Mode

  • 0: Transparent mode
  • 1: Format mode (ASCII)
  • 2: Format mode (Binary)
  • 3: Chat mode
  • 4: Header-attached transparent mode

0x07: Baud Rate

Specifies the UART baud rate.

0x08: Parity

Specifies the sum of settings in the following combination:

  • Bit
    • 0: 8Bit
    • 8: 7Bit
  • Parity
    • 0: None
    • 1: Odd
    • 2: Even
  • Stop
    • 0: STOP 1
    • 4: STOP 2

For example, 7-E-1 is specified as 8+2+0=10(0xA).

0x09: Encryption Function

Specifies whether encryption is enabled.

  • 0: Disabled
  • 1: AES128bit encryption enabled

0x0A: Encryption Key

Specifies a 16-byte encryption key.

Can store binary sequences that cannot be set in Interactive Mode. This may cause display issues in Interactive Mode.

0x0B: Header / Handle name

Specifies a header format on the mode E or handle name on the mode C.

0x0C: Delimiter Character

Specifies the delimiter character (0x00-0xFF).

2.2 - Serial Communication App Format Mode (Binary)

Mode that adds headers to both transmitted and received outputs (binary format)
Format mode adds headers to both transmitted and received outputs. In binary format, data is represented as raw binary.
Example network configuration with format mode

Overview

When data formatted in a specific manner is input on the transmitting side, the receiving side outputs data formatted in the same manner.

Data represented in hexadecimal is output as raw binary.

Transmitting Side InputReceiving Side Output
Simple/Extended Format DataSimple/Extended Format Data
  • On TWELITE UART, format mode (ASCII) is enabled by connecting the SET pin to GND at startup.
  • On TWELITE / TWELITE DIP, format mode (binary) is enabled by connecting the EX1 pin to GND at startup.

There are two types of supported formats.

  • Simple format: uses Logical Device ID only; Extremely Simple! Compatible with UART transmission function of the standard app
  • Extended format: uses Logical Device ID plus options such as Serial ID and retry count

For example, 5 bytes of binary data 0x48 0x45 0x4C 0x4C 0x4F can be transmitted using the simple format as follows.

[Transmitting Side]

A5 5A 80 07 00 01 48 45 4C 4C 4F 43 04    <- Input
A5 5A 80 04 DB A1 80 01 FB 04  <- Output

[Receiving Side]

A5 5A 80 07 78 01 48 45 4C 4C 4F 3B 04  <- Output

Basic Format

When sending data expressed in basic or extended format, handle it as raw binary data.

HeaderLengthPayloadChecksumFooter
A5 5APayload LengthRepeated 00-FFXOR of PayloadEOT
  • All binary
  • Header is 2 bytes: A5 5A
  • Payload length is 2 bytes representing the byte count, OR’ed with 0x8000
  • Checksum is XOR of payload
  • Footer is EOT 0x04 (can be omitted on input)
  • Big-endian

For example, binary data 00 11 22 33 AA BB CC is expressed as follows.

A5 5A 80 07 00 11 22 33 AA BB CC DD 04

Although debugging is troublesome, it offers high efficiency for communication between microcontrollers.

Distinguishing Parent and Child Devices

Format mode distinguishes between parent and child devices.

Parent and child devices must match Application ID and Frequency Channel.

Source Identification

Format mode allows identification of the source from received data.

Simple format uses Logical Device ID, and extended format uses Logical Device ID plus extended address.

Simple Format

When using the simple format of format mode, follow the format below.

Transmitting Side Input

#DataDescriptionNotes
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length\(N\)+2
0uint8Destination Logical Device IDParent 0x00, Child 0x01-0x64, All Children 0x78
1uint8Command NumberAny value less than 0x80
2[uint8]Arbitrary DataByte sequence of length \(N\) (recommended \(N\leqq80\))
uint8ChecksumXOR
uint8FooterEOT (0x04)

Receiving Side Output

#DataDescriptionNotes
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length\(N\)+2
0uint8Source Logical Device IDParent 0x00, Child 0x01-0x64, Unset Child 0x78
1uint8Command NumberValue less than 0x80 specified by sender
2[uint8]Arbitrary DataByte sequence of length \(N\)
uint8ChecksumXOR
uint8FooterEOT (0x04)

Transmitting Side Output (Response Message)

#DataDescriptionNotes
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length4
0uint8Source Logical Device IDOnly 0xDB: indicates itself
1uint8Command NumberOnly 0xA1
2uint8Response IDContinuation number in the range 128-255 (0x80-0xFF)
3uint8ResultSuccess 1, Failure 0
uint8ChecksumXOR
uint8FooterEOT (0x04)

Example

Example of sending byte sequence 11 22 33 AA BB CC from parent to all children.

[Transmitting Side: Parent]

A5 5A 80 08 78 01 11 22 33 AA BB CC A4 04  <- Input
A5 5A 80 04 DB A1 80 01 FB 04  <- Output

The last byte 0xA4 is the checksum: XOR from 0x78 to 0xCC.

[Receiving Side: All Children]

A5 5A 80 08 00 01 11 22 33 AA BB CC DC 04  <- Output

The last byte 0xDC is the checksum: XOR from 0x00 to 0xCC.

Extended Format

When using the extended format of format mode, follow the format below.

Transmitting Side Input

When using Logical Device ID as destination

#DataDescriptionNotes
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length\(N\)+\(M\)+3
0uint8Destination Logical Device IDParent 0x00, Child 0x01-0x64, All Children 0x78
1uint8Command NumberOnly 0xA0
2uint8Response IDAny value
3[uint8]OptionsOption list of length \(N\) (Details below)
3+\(N\)[uint8]Arbitrary DataByte sequence of length \(M\) (recommended \(M\leqq80\))
uint8ChecksumXOR
uint8FooterEOT (0x04)

When using Extended Address as destination

#DataDescriptionNotes
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length\(N\)+\(M\)+7
0uint8Extended Address SpecifierOnly 0x80
1uint8Command NumberOnly 0xA0
2uint8Response IDAny value
3uint32Destination Extended AddressSerial ID with 0x8 added at the front
7[uint8]OptionsOption list of length \(N\) (Details below)
7+\(N\)[uint8]Arbitrary DataByte sequence of length \(M\) (recommended \(M\leqq80\))
uint8ChecksumXOR
uint8FooterEOT (0x04)

Details of Option List

In extended format, detailed settings can be specified by providing an option list.

The option list consists of repeated option IDs and arguments. It ends with 0xFF.

IDArgumentDefaultDescription
0x01NoneDisabledEnable MAC ACK
0x02uint80x00Enable Application Retransmission
0x03uint160x0000Minimum Initial Transmission Delay
0x04uint160x0000Maximum Initial Transmission Delay
0x05uint1610Application Retransmission Interval
0x06NoneDisabledAllow Parallel Requests
0x07NoneDisabledDisable Response Messages
0x08NoneDisabledSleep After Transmission
0x01: Enable MAC ACK

Enables MAC layer ACK (acknowledgment).

Not suitable for frequent data transmissions but can improve reliability.

0x02: Enable Application Retransmission

When using MAC ACK, specify 0x00-0x0F. Retransmits 0-16 times until successful.

When not using MAC ACK, specify 0x81-0x8F. Always retransmits 1-16 times.

Response messages are output after all retransmissions are complete.

0x03: Minimum Initial Transmission Delay

Specifies the minimum delay before the first transmission in milliseconds.

0x04: Maximum Initial Transmission Delay

Specifies the maximum delay before the first transmission in milliseconds.

0x05: Application Retransmission Interval

Specifies the interval between application retransmissions in milliseconds.

0x06: Allow Parallel Requests

Allows parallel requests.

When allowed, the next request can be accepted without blocking until the previous request completes.

For example, if three requests each with 0.5 seconds delay are input consecutively, normally they are processed sequentially at 0.5s, 1.0s, and 1.5s. With parallel requests allowed, they are processed in any order after 0.5s. Note that this cannot be used when packet segmentation is required.

0x07: Disable Response Messages

Disables response messages output when data is input on the transmitting side.

0x08: Sleep After Transmission

Immediately puts the device to sleep after transmission.

RX detects rising edge to wake from sleep. Input any 1 byte of data.

After waking, UART initialization completes and input is accepted.

Receiving Side Output

#DataDescriptionNotes
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length\(M\)+14
0uint8Source Logical Device IDParent 0x00, Child 0x01-0x64, Unset Child 0x78
1uint8Command NumberOnly 0xA0
2uint8Response IDValue specified by sender
3uint32Source Extended AddressSerial ID with 0x8 added at the front
7uint32Destination Extended Address0xFFFFFFFF when using Logical Device ID
11uint8LQIRadio signal quality at reception
12uint16Length of Following BytesByte count \(M\)
14[uint8]Arbitrary DataByte sequence of length \(M\)
uint8ChecksumXOR
uint8FooterEOT (0x04)

Transmitting Side Output (Response Message)

#DataDescriptionNotes
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length4
0uint8Source Logical Device IDOnly 0xDB: indicates itself
1uint8Command NumberOnly 0xA1
2uint8Response IDValue specified on input
3uint8ResultSuccess 1, Failure 0
uint8ChecksumXOR
uint8FooterEOT (0x04)

Examples

Example of sending byte sequence 11 22 33 AA BB CC from parent to child.

Example specifying Logical Device ID

Example of sending from parent to child with Logical Device ID 0x01.

  • Response ID is 0x01
  • No options

[Transmitting Side: Parent]

A5 5A 80 0A 01 A0 01 FF 11 22 33 AA BB CC 82 04  <- Input
A5 5A 80 04 DB A1 01 01 7A 04  <- Output

The last byte 0xC1 is checksum: XOR from 0x42 to 0xCC.

[Receiving Side: Child]

A5 5A 80 14 00 A0 01 82 03 68 41 FF FF FF FF FF 00 06 11 22 33 AA BB CC 2D 04  <- Output

The last byte 0x2D is checksum: XOR from 0x00 to 0xCC.

Example specifying Extended Address

Example of sending from parent to child with Extended Address 0x820163B2 (Serial ID 0x20163B2).

  • Response ID is 0x01
  • No options

[Transmitting Side: Parent]

A5 5A 80 0E 80 A0 01 82 01 63 B2 FF 11 22 33 AA BB CC 51 04  <- Input
A5 5A 80 04 DB A1 01 01 7A 04  <- Output

The last byte 0x51 is checksum: XOR from 0x80 to 0xCC.

[Receiving Side: Child]

A5 5A 80 14 00 A0 01 82 03 68 41 82 01 63 B2 FF 00 06 11 22 33 AA BB CC 7F 04  <- Output

The last byte 0x7F is checksum: XOR from 0x00 to 0xCC.

Example using MAC ACK

Example of sending from parent to child with Logical Device ID 0x01 using MAC ACK.

[Transmitting Side: Parent]

A5 5A 80 0B 01 A0 01 01 FF 11 22 33 AA BB CC 83 04  <- Input
A5 5A 80 04 DB A1 01 01 7A 04  <- Output

The last byte 0x83 is checksum: XOR from 0x01 to 0xCC.

[Receiving Side: Child]

A5 5A 80 14 00 A0 01 82 03 68 41 00 00 01 01 FF 00 06 11 22 33 AA BB CC 2D 04  <- Output

The last byte 0x2D is checksum: XOR from 0x00 to 0xCC.

Example with Delay

Example of sending from parent to child with Logical Device ID 0x01 with 768ms delay.

[Transmitting Side: Parent]

A5 5A 80 0D 01 A0 01 03 03 00 FF 11 22 33 AA BB CC 82 04  <- Input
A5 5A 80 04 DB A1 01 01 7A 04  <- Output

The last byte 0x82 is checksum: XOR from 0x01 to 0xCC.

[Receiving Side: Child]

A5 5A 80 14 00 A0 01 82 03 68 41 FF FF FF FF FF 00 06 11 22 33 AA BB CC 2D 04  <- Output

The last byte 0x2D is checksum: XOR from 0x00 to 0xCC.

0xDB Command

Instead of setting interactive mode, you can operate and configure the module by inputting the 0xDB command from UART.

2.2.1 - 0xDB Command in Serial Communication App Format Mode (Binary)

Setting functions using the 0xDB command in format mode (binary) without using Interactive Mode
In format mode, you can dynamically configure settings from devices connected via UART by using the 0xDB command instead of Interactive Mode.

Input Format

#DataContentRemarks
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length\(N\)+2
0uint8Destination Logical Device IDOnly 0xDB indicating itself
1uint8Command NumberSelected from values below
2[uint8]ParameterByte sequence of length \(N\) indicating setting value (optional)
uint8ChecksumXOR
uint8FooterEOT (0x04)

Command Number List

Function
0xF0Enable ACK
0xF1Get Device Info
0xF2Apply Device Settings
0xF3Get Device Settings
0xFDErase Device Settings
0xFESave Device Settings
0xFFReset Device

0xF0: Enable ACK

Requests ACK response.

No parameters.

Response Format

#DataContentRemarks
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length3
0uint8Destination Logical Device IDOnly 0xDB
1uint8Command NumberOnly 0xF0
2uint8DataOnly 0x01
uint8ChecksumXOR
uint8FooterEOT (0x04)

0xF1: Get Device Info

Displays information such as address. Also output at startup.

No parameters.

Response Format

#DataContentRemarks
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length17
0uint8Destination Logical Device IDOnly 0xDB
1uint8Command NumberOnly 0xF1
2uint32Default Application ID67720103
6uint32Version NumberFor 1.4.7, 00010407
10uint8Logical Device ID
11uint32Serial ID
15uint8Silent Mode StatusEnabled 1, Disabled 0
16uint8Network StatusUP 1, DOWN 0
uint8ChecksumXOR
uint8FooterEOT (0x04)

0xF2: Apply Device Settings

Applies settings.

Response Format

On Success
#DataContentRemarks
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length\(N\)+2
0uint8Destination Logical Device IDOnly 0xDB
1uint8Command NumberOnly 0xF3
2[uint8]Setting ContentIdentifier
uint8ChecksumXOR
uint8FooterEOT (0x04)
On Failure
#DataContentRemarks
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length3
0uint8Destination Logical Device IDOnly 0xDB
1uint8Command NumberOnly 0xF3
2uint8ErrorOnly 0xFF
uint8ChecksumXOR
uint8FooterEOT (0x04)

0xF3: Get Device Settings

Retrieves settings.

Response Format

#DataContentRemarks
uint8HeaderOnly 0xA5
uint8HeaderOnly 0x5A
uint16Data Length\(N\)+2
0uint8Destination Logical Device IDOnly 0xDB
1uint8Command NumberOnly 0xF3
2[uint8]Setting ContentIdentifier and data
uint8ChecksumXOR
uint8FooterEOT (0x04)

0xFD: Erase Device Settings

Initializes settings and resets the device.

No parameters or response.

0xFE: Save Device Settings

Saves applied settings and resets the device.

No parameters or response.

0xFF: Reset Device

Discards applied settings and resets the device.

No parameters or response.

Parameter List (0xF2/0xF3)

Parameters for 0xF2: Apply Device Settings and 0xF3: Get Device Settings are represented as repeated identifier and data (big endian) pairs.

IdentifierDataContent
0x00uint32Application ID
0x01uint32Frequency Channel Mask
0x02uint16Retry Count and Output
0x03uint8Logical Device ID
0x04uint8Role
0x05uint8Relay Layer
0x06uint8Communication Mode
0x07uint32Baud Rate
0x08uint8Parity
0x09uint8Encryption Function
0x0A[uint8]Encryption Key
0x0B[uint8]Header / Handle name
0x0Cuint16Delimiter Character
0xFFuint8Error

0x00: Application ID

Specifies the application ID.

0x01: Frequency Channel Mask

Specifies the bit mask of frequency channels.

Set bits for channels to use. For example, to use channel 11, set 1<<11.

0x02: Retry Count and Output

Specifies the radio transmission output and the number of additional packets to send in transparent mode and header-attached transparent mode.

Only the lower 1 byte is used. The upper 4 bits indicate retry count (0-9), and the lower 4 bits indicate transmission output (0-3). For example, 8 retries/output 3 is 0x0083.

0x03: Logical Device ID

Specifies the logical device ID.

0x04: Role

Valid only for child devices. Specify the following values. Usually, select a delivery method without using the network layer.

Delivery Methods Without Using Network Layer

  • 0: Normal designation (parent or child)
  • 1-3: Relay child devices (logical device IDs 1-100 or 120). Numbers 1-3 indicate maximum relay hops. This method repeats retries up to the maximum relay hops, which may cause duplicate packets depending on relay device placement and number.

Delivery Methods Using Network Layer

  • 11: Parent device
  • 12: Relay device
  • 13: Child device

0x05: Relay Layer

The relay layer number. Relay devices attempt to connect to relay devices or parent devices with higher layers (lower values). Effective only when Role is set to 12.

0x06: Communication Mode

  • 0: Transparent mode
  • 1: Format mode (binary)
  • 2: Format mode (binary)
  • 3: Chat mode
  • 4: Header-attached transparent mode

0x07: Baud Rate

Specifies UART baud rate.

0x08: Parity

Specifies the sum of settings in the following combination.

  • Bit
    • 0: 8Bit
    • 8: 7Bit
  • Parity
    • 0: None
    • 1: Odd
    • 2: Even
  • Stop
    • 0: STOP 1
    • 4: STOP 2

For example, 7-E-1 is 8+2+0=10(0xA).

0x09: Encryption Function

Specifies whether encryption is enabled.

  • 0: Disabled
  • 1: AES128bit encryption enabled

0x0A: Encryption Key

Specifies a 16-byte encryption key.

Allows storing binary sequences that cannot be set in Interactive Mode. In this case, the display in Interactive Mode may be disrupted.

0x0B: Header / Handle name

Specifies a header format on the mode E or handle name on the mode C.

0x0C: Delimiter Character

Specifies the delimiter character string (0x00-0xFF).

2.3 - Serial Communication App Chat Mode

Mode that displays prompts and performs echo back
Chat mode realizes text chat through prompt display and echo back.

By connecting MONOSTICK to a PC etc., chat can be performed among multiple terminals.

Overview

Enables text chat.

Sending Side InputReceiving Side Output
Any stringAny string + auxiliary information

Displays prompt and echoes back (outputs input characters). All terminals operate as child devices, performing broadcast communication.

For example, when sending the string Hello from one terminal to another, it behaves as follows.

[Sending Side]

810A4778:0> Hello  <- Input
810A4778:1>  <- Output

[Receiving Side]

[810A4778:0] Hello  <- Output
82018CA0:0>  <- Output

Chat mode displays prompt and echoes back (outputs input characters entered by itself).

All terminals are treated as child devices and broadcast their transmitted content. Communication is possible with all terminals but destination cannot be specified. Binary data cannot be sent. Only strings are supported (0x00-0x1F, 0x7F cannot be sent).

Relay supports up to 3 hops. Relay is disabled by default.

Distinction between Parent and Child Devices

Chat mode does not distinguish between parent and child devices.

If the Application ID and frequency channel are the same, data entered in any terminal is sent to other terminals.

Network configuration image

Network configuration image

Identification of Source

The auxiliary information in the received output can identify the sender.

If the Interactive Mode’s h: Header format is blank, the 7-digit serial ID with a leading 0x8 is used as the extended address. For example, the following output indicates the sender’s serial ID was 0x10A4778.

[810A4778:0] Hello

If h: Header format is set to an arbitrary string, it is used as the handle name. Handle name consumes data space in the wireless packet.

Sending Side Input Format

Enter message and newline after prompt.

DataContentRemarks
[char]Message0x00-0x1F, 0x7F not allowed
charCR (0x0D/'\r')Allowed alone
charLF (0x0A/'\n')Allowed alone
810A4778:0> Hello

Receiving Side Output Format

Outputs received message following auxiliary info.

Auxiliary information includes the module’s extended address or handle name and a sequence number.

DataContentRemarks
charAuxiliary info header[ only
[char]Identification info8-digit extended address or handle name
charAuxiliary info delimiter: only
[char]Sequence numberStarting from 0
charAuxiliary info footer] only
charSeparatorSpace only
[char]Message
charFooterCR (0x0D/'\r')
charFooterLF (0x0A/'\n')
[810A4778:0] Hello

Other Inputs

Terminals supporting escape sequences can use the following control commands.

  • Ctrl-L: Clear screen
  • Ctrl-C: Cancel input
  • BS/DEL: Move cursor back

2.4 - Serial Communication App Transparent Mode

Mode that purely wirelesss UART
Transparent mode realizes behavior similar to UART connected by wires without adding headers, echo back, or prompt display.
Image connecting external microcontrollers

External microcontrollers can be easily connected, but to optimize communication using formats, format modes (ASCII / Binary) are suitable.

Overview

Purely wirelesss UART.

Sending side inputReceiving side output
Any dataAny data

Since no format is required, existing UART communication can be easily wirelessized.

However, data delimiters are ambiguous and it is impossible to identify the sender from the receiver output.

The initial state specifies CRLF as the transmission trigger character. Therefore, data input to the transmitter is separated by CRLF, and the data before CRLF is transmitted.

For example, entering Hello<Enter> on the transmitting terminal results in Hello being output on the receiving terminal.

[Sending side]

Hello  <- Input

[Receiving side]

Hello  <- Output

Continuous input strings are split and sent in chunks of 80 bytes. Data up to the trigger character should normally be 80 bytes or less.

All terminals are considered child devices, and the transmitted content is broadcast. Communication with all terminals is possible, but the destination cannot be specified. Both ASCII characters and binary data can be sent.

Relay supports up to 3 hops. By default, relay is disabled.

Distinction between Parent and Child Devices

Transparent mode does not distinguish between parent and child devices.

If application ID and frequency channel are the same, data entered into any terminal is sent to other terminals.

Network configuration image

Network configuration image

Identification of Sender

Transparent mode cannot identify the sender.

To identify sender, sender information must be included in data input to the transmitter.

Transmission Trigger

Transmission trigger must be considered, as data is divided and transmitted wirelessly packet by packet.

Therefore, the following transmission triggers must be taken into account:

  • When a timeout after data input is reached
  • When the input data reaches the minimum data size
  • When the transmission trigger character is received

Transmission trigger settings can be specified from the interactive mode k: Transmission Trigger item.

Example Setting

When setting the transmission trigger character to LF, minimum data size to 8 bytes, and timeout to 30 ms, set as follows:

 m: set UART mode (D)
 k: set Tx Trigger (sep=0x0a, min_bytes=8 dly=30[ms])
 o: set option bits (0x00000100)

2.5 - Serial Communication App Header Transparent Mode

Mode that adds headers only to the received output
Header Transparent Mode adds auxiliary information only to the output on the receiving side.

Overview

Enabled by default.

When arbitrary data is input to the transmitting terminal, the receiving terminal outputs data with auxiliary information in a specific format.

Transmitting side inputReceiving side output
Any dataAny data + auxiliary info

By default, data input on the transmitting side is separated by CRLF and data before CRLF is sent.

For example, entering Hello<Enter> on the transmitting side results in output Hello with auxiliary info on the receiving side. The transmitting side also outputs a message indicating transmission completion.

[Transmitting side]

Hello  <- input
;U;00004;219;0x820163B2;000;000;0,1,Hel...;6E;  <- output

[Receiving side]

;U;00003;000;0x820163B2;255;000;Hello;42;  <- output

The auxiliary information output by the receiving side includes the source address, received signal strength, checksum, etc. The format of the auxiliary information can be customized.

Distinction between Parent and Child Devices

Header Transparent Mode does not distinguish between parent and child devices.

If the Application ID and frequency channel are the same, data input to any terminal is sent to other terminals.

Network configuration image

Network configuration image

Identification of Source

The header on the received data includes the logical device ID and serial ID of the sender.

Output Format on Receiving Side

The output format is represented as semicolon (;) separated fields.

[Example output in default state]

;U;00777;120;0x81025A17;120;013;HELLO;79;

This output can be interpreted as follows.

DataDescriptionValue
UcharFixed valueU
00777uint16Timestamp at output777 seconds
120uint8Source logical device ID120 ID-less child device
0x81025A17uint32Source extended address81025A17
120uint8LQI (link quality indicator)120/255
013uint8Source sequence number13
HELLO[uint8]Input dataHELLO
79uint8XOR checksum0x79

Customization by Header Format

The output format on the receiving side follows the header format.

Changing the header format customizes the content of the auxiliary information output and the checksum calculation range.

The header format can be changed via the interactive mode command h: set header format.

Simplest Format

The simplest header format is *\n. It outputs the received data with CRLF line endings.

 h: set header format [*\n]

When sending HELLO in this case, it behaves as follows.

[Receiving side]

HELLO<CR><LF> or HELLO<LF>

[Transmitting side]

HELLO<CR><LF>

Special Characters in Header Format

You can customize the output by including the following special characters in the header format.

General
Description
*Received data
&hlArbitrary ASCII character (e.g., &20 is space)
<Start position for checksum calculation (default is start of string)
>End position for checksum calculation (only from v1.4.6)
Characters following \ (backslash)
Description
\nCRLF (0x0D 0x0A)
\tTAB
\**
\%%
\<<
\>>
\&&
Characters following %
DescriptionLengthData format
%ASource address (32bit)8 charsHexadecimal
%aSource address (32bit)10 charsHexadecimal
%ISource logical address (8bit)2 charsHexadecimal
%iSource logical address (8bit)3 charsDecimal
%TCurrent system time (seconds)4 charsHexadecimal
%tCurrent system time (seconds)5 charsDecimal
%SSource sequence number (hex)2 charsHexadecimal
%sSource sequence number (hex)3 charsHexadecimal
%QReceived signal strength2 charsHexadecimal
%qReceived signal strength3 charsDecimal
%XChecksum2 charsHexadecimal
%xChecksum3 charsDecimal

Checksum Calculation

The checksum is calculated by XOR (exclusive OR) from the start of the data or from the position indicated by < in the header format up to just before %X or %x.

Example in Default State

The default header format is ;U;%t;%i;0x%A;%q;%s;<*;%X;\n, where the checksum calculation range is *;.

That is, when sending HELLO, the binary data HELLO; is targeted, resulting in checksum 0x79.

[Verification code in Python]

from functools import reduce

def main():
    data = "HELLO;"
    checksum = reduce(lambda x, y: x ^ y, data.encode("ascii"))
    print(f"{data} -> {hex(checksum)}")

if __name__ == "__main__":
   main()  # HELLO; -> 0x79

Other Examples

For example, consider the header format ;%I;*;%X.

Since < is not specified, the checksum calculation range is ;%I;*;.

That is, when sending HELLO, the binary data ;000;HELLO; is targeted, resulting in checksum 0x49.

[Verification code in Python]

from functools import reduce

def main():
    data = ";000;HELLO;"
    checksum = reduce(lambda x, y: x ^ y, data.encode("ascii"))
    print(f"{data} -> {hex(checksum)}")

if __name__ == "__main__":
   main()  # ;000;HELLO; -> 0x49

Transmission Trigger

There is no format on the transmitting side input, but data is split and transmitted packet by packet.

Therefore, the following transmission triggers must be considered.

  • When timeout after data input occurs
  • When input data reaches the minimum data size
  • When a transmission trigger character is received

Transmission trigger settings are specified via the interactive mode k: set transmission trigger item.

Example Setting

To set the transmission trigger character to LF, minimum data size to 8 bytes, and timeout to 30 ms, use the following settings.

 m: set UART mode (E)
 k: set Tx Trigger (sep=0x0a, min_bytes=8 dly=30[ms])
 o: set option bits (0x00000100)

3 - Interactive Mode (Serial Communication App)

Configuration via Interactive Mode
You can configure advanced settings of the app via Interactive Mode.

This section describes features specific to the serial communication app (App_Uart). For common functions, refer to the TWELITE APPS Manual Top Page.

Display Example

[CONFIG MENU/App_Uart:0/v1-05-1/SID=8300051A]
a: (0x67720103) Application ID [HEX:32bit]
i: (       120) Device ID [1-100,etc]
c: (18        ) Channel(s)
x: (      0x03) RF Power/Retransmissions [HEX:8bit]
b: (115200,8N1) UART Baud Alt. [XXXXX]
o: (0x00000100) Option bits [HEX:32bit]
r: (      0x00) Role [0-3,11-13]
l: (         1) LayerTree repeat layer [1-63]
m: (E         ) UART mode [ABCDE]
t: (    0x0D0A) Tx trigger character [XX,XXYY]
u: (         0) Minimum data size [0,1-80]
T: (         0) Timeout [0,10-200 msec]
h: (;U;%t;%i;0x%A;%q;%s;<*;%X;\n) Header format / Handle name
C: (         0) Encryption [0,1]
K: (*CRYPT_KEY_HERE*) Encryption key [16chrs]

 [ESC]:Exit [!]:Reset System [*]:Extr Menu [:]:AppSel

Commands

ParameterDefaultRemarks
aApplication ID0x6772010332bit
iLogical Device ID120Parent 121, Child 1-100, No ID Child 120
cFrequency Channel1811-26
xTX Power & Retransmit Count0x03
Retransmit Count01-9 times, 0 disables
TX Power30-3
bUART Alternate Setting115200,`8N1Enable with BPS pin
oOption Bits0x00000000Other detailed settings
rRole0Normal 0, Relay Child 1-3, Other
lLayerTree Relay Layer0x01
mCommunication ModeEA/B/C/D/E
tTX Trigger Characters0x0D0AASCII code of trigger characters
uMinimum Data Size0Disabled 0, 1-80
TTimeout0Disabled 0, 10-200ms
hHeader Format / Handle NameDetails
Header FormatWhen using Header Transmission Mode
Handle NameWhen using Chat Mode
CEncryption0Disabled 0, AES128bit 1
KEncryption Key*CRYPT_KEY_HERE*16 characters

Each command is described in detail below.

a: Application ID

All devices participating in communication must use the same value. This logically separates networks.

i: Logical Device ID

Set this value if it is necessary to distinguish between multiple child devices.

If no distinction is needed or possible, set it to 120. If distinction is required, use any value between 1 and 100 for child devices, and use 121 for parent devices.

c: Frequency Channel

All devices participating in communication must use the same value. This physically separates networks.

x: TX Power & Retransmit Count

Specifies the RF transmission power and the number of retransmissions in Transparent Mode and Header Transmission Mode.

b: UART Alternate Setting

Overrides the default 38400bps alternate baud rate used when booting with the BPS pin connected to GND.

Select from: 9600 / 19200 / 38400 / 57600 / 115200 / 230400.

o: Option Bits

Specify a 32-bit value. Each bit enables a corresponding setting.

BitSetting ItemDefaultABCDE
0x00000001Disable Internal Pull-up of M30️⃣
0x00000100Enable TX Trigger1️⃣
0x00000200Prioritize New Input Stream0️⃣
0x00001000Suppress Response Message0️⃣
0x00004000Relax Duplicate Checker0️⃣
0x00010000Force Apply Alternate Baud Rate0️⃣
0x00020000Simultaneous Output to Sub Port0️⃣
0x00040000Switch Primary Port0️⃣
0x01000000Disable LED0️⃣
0x02000000Disable LED in Standby0️⃣

r: Role

Valid for child devices only. Select one of the following. Normally, use a transmission mode that does not rely on the network layer (LayerTree).

Transmission Modes Not Using the Network Layer

  • 0: Default (Parent or Child)
  • 13: Repeater Child (set Logical Device ID to 1100 or 120). The value indicates the maximum number of relay hops. Duplicated packets may occur depending on placement and number of repeaters.

Transmission Modes Using the Network Layer

Only supported in Header Transmission Mode.

  • 11: Parent
  • 12: Repeater
  • 13: Child

l: LayerTree Relay Layer

Specifies the relay layer number. A repeater attempts to connect to parent or repeater devices with higher relay layers (smaller values). Valid only when Role is set to 12.

m: Communication Mode

  • A: Format Mode (ASCII)
  • B: Format Mode (Binary)
  • C: Chat Mode
  • D: Transparent Mode
  • E: Header Transmission Mode

t: TX Trigger Characters

In Transparent and Header Transmission modes, entering these characters triggers transmission of a packet.

If Minimum Data Size is specified, the characters will be ignored until that size is reached.

u: Minimum Data Size

Specifies the minimum size of data to be handled continuously. TX Trigger Characters are ignored until this size is met.

In Interactive Mode, specify a number between 180 as byte count. Set to 0 to disable. The default is disabled.

T: Timeout

Time to wait from the last input before transmitting a packet.

In Interactive Mode, specify a value between 10200 in milliseconds. Set to 0 to disable. The default is disabled.

h: Header Format / Handle Name

Specifies the header format for Header Transmission Mode, or the handle name for Chat Mode.

Header (Header Transmission Mode)

Specify the Header Format Syntax for use in Header Transmission Mode.

Handle Name (Chat Mode)

Specify the handle name to display on the receiving device.

Up to 23 characters. This consumes part of the data transmission area (80 bytes).

C: Encryption

Specifies whether to enable encryption.

To enable AES128-bit encryption, set this to 1.

K: Encryption Key

Specify a 16-character encryption key when encryption is enabled.

Option Bits Details

This section describes each setting associated with the bits of the Option Bits value.

00000001: Disable Internal Pull-up of M3

Disables the internal pull-up resistor of the M3 pin used for sleep configuration on TWELITE DIP.

00000100: Enable TX Trigger

Enables the TX Trigger setting in Transparent or Header Transmission Mode.

00000200: Prioritize New Input Stream

In Format Mode (ASCII/Binary), Transparent Mode, and Header Transmission Mode, if multiple input streams are received before the previous transmission is complete, the newer input is prioritized.

00001000: Suppress Response Message

In Format Mode (ASCII/Binary) and Header Transmission Mode, suppresses the response message after transmission completes.

00004000: Relax Duplicate Checker

Relaxes the duplicate check conditions on the receiver side.

00010000: Force Apply Alternate Setting

Applies the UART Alternate Setting even if the BPS pin is not pulled low at boot.

00020000: Simultaneous Output to Sub Port

Also outputs serial TX data to the secondary TX_SUB port.

00040000: Switch Primary Port

Switches the serial I/O between the main TX/RX and the sub TX_SUB/RX_SUB ports.

About Repeater Function

When the communication range is insufficient or obstructed, using a repeater can be effective.

A repeater device retransmits packets it receives to other devices.

01000000: Disable LED

Disables the LED on TWELITE STICK and MONOSTICK.

02000000: Disable LED in Standby

Disables the LED on TWELITE STICK and MONOSTICK while in standby.

Configuring Repeater Function

Normally, enter Interactive Mode and change the Role to a value between 1 and 3. The default is 0, which does not enable the repeater function.

r: set Role (0x0)

The values 1 to 3 indicate the maximum number of relay hops. For example, setting it to 3 allows up to 3 hops.

This setting is only valid for child devices, not for parent devices.

Example Configuration

The following network configuration shows an example where the Role of red devices is set to 0, and that of blue devices is set to 3.

Example of relaying via Role setting

Example of relaying via Role setting

By adding more red devices, communication with up to three relay hops between them can be established.

Example of adding transmitters and receivers

Example of adding transmitters and receivers

4 - Notes on Communication in Serial Communication App

Precautions for stable communication
Precautions for achieving stable communication.

UART Data Input and Output

4KB buffers are allocated for UART input and output. When outputting two UART lines, 2KB is used for input and output buffers for each line.

In format mode and chat mode, it is rarely necessary to be aware of buffer sizes, but in header transparent mode and transparent mode when continuously inputting streams, or even in format mode when inputting many streams at once, it is necessary to be aware of the buffer size limits. On the output side, if a slow baud rate is set, the output of data received wirelessly may not keep up.

Data beyond the buffer limits is not protected at the boundary, causing data loss. Especially on the input side, consider referring to the flow control pins described below.

UART Flow Control

Input flow control is implemented to behave like the RTS pin. The pin used is PWM1 (DIO5), targeting the main UART port. When input is not accepted, the state is High; when input is accepted, the state is Low. Output flow control is not supported. Receiving devices should ensure sufficient baud rate and processing speed.

  • After power-on or reset, the pin is High. It becomes Low once UART is initialized.
  • When the UART input buffer exceeds 7/8 full, the pin goes High; it goes Low when below that threshold.
  • In transparent mode, the pin is High during packet transmission.

Countermeasures for Wireless Communication Errors

If data loss occurs on the receiving side, increase the number of wireless retransmissions.

Increasing the number of additional packets sent can improve the success rate of reception.

The number of retransmissions can be set in Interactive Mode (x: set RF Conf).

5 - Custom Default Feature of Serial Communication App

Creating firmware with changed default settings
With the custom default feature, you can change the default parameters included in the firmware.

For example, if you create firmware that changes the baud rate from 115200bps to 9600bps, you can use it at 9600bps from the start.

Configuration Procedure

1. Apply Settings

Change the settings in Interactive Mode and press S to save.

2. Download Settings

Prepare software that can download data using the xmodem protocol.

While still in Interactive Mode (before selecting items), request xmodem download.

If the download succeeds, a 128-byte file is generated (may be smaller depending on xmodem implementation).

3. Creating Custom Binary

Concatenate the downloaded file to the end of the firmware binary file to create a custom binary.

Use command line tools or general file concatenation tools for concatenation.

Example

Example assuming downloaded xmodem file is conf.bin, original binary file is App_Uart_BLUE_L1305_V1-4-X.bin, and custom binary to create is App_Uart_custom_V1-4-X.bin.

【Windows】

copy App_Uart_BLUE_L1305_V1-4-X.bin App_Uart_custom_V1-4-X.bin
type conf.bin >> App_Uart_custom_V1-4-X.bin

【macOS / Linux】


cat App_Uart_BLUE_L1305_V1-4-X.bin conf.bin > App_Uart_custom_V1-4-X.bin

4. Writing Custom Binary

Write the concatenated custom binary to TWELITE.