/      日本語

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.


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

Setting functions using the 0xDB command in format mode (binary) without using Interactive Mode