Device Guide¶
The DTN1 main communication interface is the NFC Type 5 Memory, which holds NDEF Formatted data, and a special command interface used to control the device.
NFC Type 5, or ISO15693 is compatible with most Android Mobile devices ( Android > 8.1), Iphones (iOS > 11), and some USB NFC Readers are also available.
Developer Tools and Documents¶
- USB NFC Type 5 Reader: Identiv U3720F
- Apple Core NFC API: https://developer.apple.com/documentation/corenfc?language=objc
Device overview¶
NFC Interface¶
The NFC memory is supported by an ST Micro ST25DV64KC IC, providing up to 64Kb/8kB memory. The main memory area is formatted with NDEF TLV blocks, allowing automatic reading and decoding on Apple/iOS devices, making data readout quite straightforward.
Additionally, the ST25DV IC provides a special Mailbox memory, which can be written to with commands used to configure the device. For example modify the logging interval or start/stop logging.
Memory Structure¶
The NFC Memory is structured using an NDEF message, so that data records can be read and pre-decoded automatically from the Mobile Device core API.
The NDEF message is divided in three records:
- Device Information: This text record is a set of KEY=VALUE entries reporting information and status of the device. See Reference
- Data Points: The Byte Level ledger containing all the temperature points. See Reference
For applications where byte-level decoding is required, users must extract the NDEF payload length from the TLV header, then split the records according to the NDEF record format.
NFC Commands¶
Most users won't require read or write commands themselves, since mobile devices will read and pre-decode NDEF messages. However, device-specific commands like writing to the Mailbox will require users to transmit RF commands at the byte level.
The following table provides a summary of the most relevant commands, for a complete list, refer to the Datasheet
Command | Description | Request Format | Response Format |
---|---|---|---|
Write Message | Writes up to 256 bytes in the device Mailbox | [ReqFlags, 0xAA, 0x02,LEN,DATA (LEN + 1 bytes)] | [ResFlags,Error?] |
Legend:
- ReqFlags: The request flags for the NFC chip, typically set to 0x02 - see datasheet for custom behavior.
- ResFlags: The response flags, see datasheet for meaning
- Error?: If a command failed and the response flags signal the presence of an Error code, this byte contains the command-specific error
Write Message ¶
Device Commands¶
Device Commands are simple strings processed by the device to allow configuration and state management, like Start/Stop.
The commands presented bellow must be send to the device using the described text format, via the NFC Write Message command.
To do so, just construct a device command, convert it to US-ASCII bytes, and send it as payload of the Write Message command.
Command | Description | Format |
---|---|---|
Start | Start logging | promd start TIMESTAMP |
Stop | Stop logging | promd stop TIMESTAMP |
Set interval | Change the interval | promd interval:set INTERVAL |
Legend:
- TIMESTAMP: Epoch in seconds (Unix timestamp, number of seconds since 01/01/1970)
- INTERVAL: Logging interval in seconds
Start ¶
Command format:
1 |
|
This command starts logging, the start TIMESTAMP must be provided, and should be the actual time from a trusted time source.
As a rule of thumb, the clock status of the device should not be trusted, as it may have been stopped during storage, and also doesn't have any network connection allowing to regularly re-synchronise.
Typically, if starting using a mobile phone, the clock of the terminal will be synchronised with the network time, and thus can be trusted.
Stop ¶
Command format:
1 |
|
Stops the device, the TIMESTAMP must be provided, and should be the actual time from a trusted time source.
As for the start command, the timestamp is used to record a trusted stop time. The combination of start and stop time can be used to correct the actual clock speed of the device, which may drift from actual trusted time sources.
Set Interval ¶
Command format:
1 |
|
INTERVAL: Logging Interval in seconds, 0 < INTERVAL < 999999 (277 hours)
Changes the interval of the device, only on stopped device.