d /  misc /  newton / sharp-ask

Protocol Specification

Infrared Characteristics
Communications Specification
Packet Specifications
Protocol


Infrared Characteristics

Transmission distance less than 1 meter
Carrier infrared 900 - 1050 nm peak
Subcarrier 500KHz (450 - 550KHz)
Modulation ASK


Communications Specification

Baud Rate 9600 bps
Data Length 8 bits
Parity Odd
Stop Bits 1


Protocol - Data Packets

Field Value Length Comments
Sync Dummy 0x00 5 Receivers wait for 0x00 0x00 0x96
Start ID 0x96 1
ID Code 1 0x81 or 0x91 1 bits 7-4 are target equipment type, bits 3-0 are type of packet
Version Number 0x10 1 Only bits 7-4 should be checked by receiver
Block Number 0x0001 - 0xffff 2 Last block always 0xffff (low/high)
Control Code 0x01 1 Not checked by receiver
Device Code 0x40 1
ID Code 2 0xfe 1
Data Length 0x0000 - 0x0200 2 If data is exactly 512 bytes, two packets are required, with 0 bytes in second packet.
Data   0 - 512  
Check Sum   2 Check sum of data part (low/high)

Protocol - Control Packets

Field Value Length Comments
Sync Dummy 0x00 5 Receivers wait for 0x00 0x00 0x96
Start ID 0x96 1
ID Code 1 0x82 or 0x92 1 bits 7-4 are target equipment type, bits 3-0 are type of packet
Control Data 0x05 1 ENQ - Request to send
0x16 SYN - Clear to send
0x06 ACK - Completion of receiving data
0x15 NAK - Failed to receive data
0x18 CAN - Interruption of receiving data


Protocol

You really need this
      image

Annotations

  1. Sending Side
    Send ENQ every 0.5 seconds waiting for SYN for normally 6 minutes (in case of a retry process, 10 seconds). If CAN is received or no answer is received, the sending side aborts data transmission. If any other data is received, the sending side moves to a retry process.

  2. Receiving Side
    Wait for ENQ for normally 6 minutes (in case of a retry process, 10 seconds). If no ENQ is received, the receiving side aborts data transmission.

  3. Receiuing Side
    SYN must be sent within 0.3 seconds after receiving ENQ. If the receiving side wants to abort data transmission, it should send CAn instead of SYN.

  4. Receiving Side
    If no Data packet is received within 0.4 seconds after sending SYNs the receiving side moves to a retry process.

  5. Sending Side
    Sending side must start sending Data packet within 0.2 seconds after receiving SYN.

  6. Receiving Side
    ACK must be sent within 0.4 seconds after receiving the last byte of the Data packet.

  7. Sending side
    If ACK is not received within 1 second or other data (including NACK) is received, the sending side moves to a retry process.

  8. Sending side
    The sending side must finish sending one Data packet within 4 seconds.

    Receiving side
    If the last byte of the Data packet is not received within 5 seconds after receiving the first byte of the packet, the receiving side moves to a retry process. If a communication error is detected, the receiving side must skip all received data until:

    • no more data is received for 0.4 seconds or
    • 5 seconds pass after receiving the first byte of the packet, and then moves to a retry process.

    In case of a checksum error, send NACK within 0.4 seconds and move to a retry process ...

  9. Sending and Receiving side
    If a communication error occurs, both sides try to transfer the same block again (retry process). The sending side backs to the stage of sending ENQ, the receiving side backs to the stage of receiving ENQ. In this case, the time-out (6 minutes) is reduced to 10 seconds. Retry process must be performed within 1 second after the communication error is confirmed. Retry process can be done up to 2 times (3 times in total).

Notes

  1. Continuous two bytes in one packet must be sent within 0.2 seconds, If continuous two bytes are not received within 0.4 seconds the receive side should detect a communications error.

  2. Switching from send mode to receive mode must be done within 2 milliseconds.. In other words, equipment must be ready for receiving data within 2 milliseconds after sending the last byte. No data must be sent within 3 milliseconds after receiving the last byte.

  3. Each packet (both Data and Control) is considered to start when continuous 3 bytes (OOh, OOh, 96h) are detected. Other data are ignored before detecting these continuous 3 bytes.

  4. If a non-sequential block number (i.e., a value other than the last block number received + 1 or OFFFFh) is received in the Block No. field, the receiving side should detect an error and start a retry process. It is also the sam case when the same Block No. as the previous one is received (this will happen if the sending side cannot receive ACK from the receiving side).