- PJON (Padded Jittering Operative Network) Protocol specification: v3.0
- PJON Acknowledge specification: v1.0
- PJON Dynamic addressing specification: v2.0
- PJON Network services: list
- PJDL (Padded Jittering Data Link) specification: PJDL v2.0 - PJDLR v2.0 - PJDLS v2.0
- TSDL (Tardy Serial Data Link) specification: TSDL v2.0
- SFSP (Secure Frame Separation Protocol) specification: SFSP v1.0
/*
Milan, Italy
Originally published: 02/10/2016
Latest revision: 14/12/2017
PJON® dynamic addressing specification v2.0
Invented by Giovanni Blu Mitolo,
released into the public domain
Related implementation: https://github.com/gioblu/PJON/
Compliant versions: PJON v9.0 and following
Inspired by the thesis of Thomas Snaidero:
"Modular components for eye tracking, in the interest of
helping persons with severely impaired motor skills."
Master Thesis, IT University of Copenhagen
Denmark, September 2016
Changelog:
- Switched from PJON_ADDRESS_BIT to port identifier
*/
This document defines the dynamic addressing procedure used by a device in multi-master configuration or the one imposed and regulated by master in a master-slave configuration. All communication related to the addressing procedure must be transmitted on the PJON_DYNAMIC_ADDRESSING_PORT
or port 1
.
_________ _________ _________ _________
| ID 1 | | ID 2 | | ID 3 | | ID 4 |
| RID 101 | | RID 41 | | RID 945 | | RID 22 | __________
|_________| |_________| |_________| |_________| | MASTER |
____|____________|____________|____________|_______| ID 254 |
___|_____ ___|_____ ___|_____ ___|_____ |__________|
| ID 5 | | ID 6 | | ID 7 | | ID 8 |
| RID 723 | | RID 35 | | RID 585 | | RID 66 |
|_________| |_________| |_________| |_________|
- Master's id is
PJON_MASTER_ID
(decimal 254) - Master has a caducous internal slave ids archive
- Broadcasts
PJON_ID_LIST
to getPJON_ID_REFRESH
requests from already approved slaves - Handles
PJON_ID_REQUEST
requests from slaves requiring id assignment - Sends
PJON_ID_NEGATE
request to slaves if rid o id collision occurs - Handles
PJON_ID_NEGATE
requests from slaves who are leaving the bus
- Slave's initial id is
PJON_NOT_ASSIGNED
(decimal 255) - Slaves have a unique random generated 4 bytes rid or randomly generated identifier
- Sends
PJON_ID_REFRESH
request to master if required by masterPJON_ID_LIST
broadcast - Sends
PJON_ID_REQUEST
to master if id assignment is necessary - Regenerates rid and restarts the process if
PJON_ID_NEGATE
is received from master - Sends
PJON_ID_NEGATE
before shut down or leaving the bus - Fall back to multi-master procedure if no master is present
All communication to dynamically assign or request ids must be transmitted using CRC32 and PJON_DYNAMIC_ADDRESSING
port (see the known protocols list v1.0).
Slave sends a PJON_ID_REQUEST
to get a new id:
______ ________ ______ ___ ________ ____ __________ ___ ___ ___
|MASTER| HEADER | | | NOT |PORT| |RID| || |
| ID |00110110|LENGTH|CRC|ASSIGNED| 1 |ID_REQUEST| |CRC||ACK|
|______|________|______|___|________|____|__________|___|___||___|
If master detects a rid collision, sends a PJON_ID_NEGATE
request to PJON_NOT_ASSIGNED
device id to force the still not approved slave to regenerate a rid:
________ ________ ______ ___ ______ ____ _________ ___ ___ ___
| NOT | HEADER | | |MASTER|PORT| |RID| || |
|ASSIGNED|00110110|LENGTH|CRC| ID | 1 |ID_NEGATE| |CRC||ACK|
|________|________|______|___|______|____|_________|___|___||___|
Master broadcasts a response containing the rid and the new device id reserved for the requester:
_________ ________ ______ ___ ______ ____ __________ ___ __ ___
| | HEADER | | |MASTER|PORT| |RID| | |
|BROADCAST|00110010|LENGTH|CRC| ID | 1 |ID_REQUEST| |ID|CRC|
|_________|________|______|___|______|____|__________|___|__|___|
Slave confirms the id acquisition:
______ ________ ______ ___ __ ____ __________ ___ __ ___ ___
|MASTER| HEADER | | | |PORT| |RID| | || |
| ID |00110110|LENGTH|CRC|ID| 1 |ID_CONFIRM| |ID|CRC||ACK|
|______|________|______|___|__|____|__________|___|__|___||___|
If master detects a slave's rid already present in its reference, sends a PJON_ID_NEGATE
request to the slave who transmitted the ID_CONFIRM
request to force it to regenerate a rid and try again:
__ ________ ______ ___ _________ ____ _________ ___ ___ ___
| | HEADER | | | |PORT| |RID| || |
|ID|00110110|LENGTH|CRC|MASTER_ID| 1 |ID_NEGATE| |CRC||ACK|
|__|________|______|___|_________|____|_________|___|___||___|
If master experiences temporary disconnection or reboot, at start up sends a PJON_ID_LIST
broadcast request:
_________ ________ ______ ___ _________ ____ _______ ___
| | HEADER | | | |PORT| | |
|BROADCAST|00110010|LENGTH|CRC|MASTER_ID| 1 |ID_LIST|CRC|
|_________|________|______|___|_________|____|_______|___|
Each slave answers to a PJON_ID_LIST
broadcast request dispatching a PJON_ID_REFRESH
request for master:
______ ________ ______ ___ __ ____ __________ ___ __ ___ ___
|MASTER| HEADER | | | |PORT| |RID| | || |
| ID |00110110|LENGTH|CRC|ID| 1 |ID_REFRESH| |ID|CRC||ACK|
|______|________|______|___|__|____|__________|___|__|___||___|
If the id requested is free in the master's reference, id is approved and the exchange ends.
If the id is already in use, master sends a PJON_ID_NEGATE
request forcing the slave to
acquire a new id through a PJON_ID_REQUEST
:
Master sends PJON_ID_NEGATE
request to slave:
_____ ________ ______ ___ _________ ____ _________ ___ ___ ___
|SLAVE| HEADER | | | |PORT| |RID| || |
| ID |00110110|LENGTH|CRC|MASTER_ID| 1 |ID_NEGATE| |CRC||ACK|
|_____|________|______|___|_________|____|_________|___|___||___|
Slaves must send a PJON_ID_NEGATE
request to master to free the id before leaving the bus:
______ ________ ______ ___ __ ____ _________ ___ __ ___ ___
|MASTER| HEADER | | | |PORT| |RID| | || |
| ID |00110110|LENGTH|CRC|ID| 1 |ID_NEGATE| |ID|CRC||ACK|
|______|________|______|___|__|____|_________|___|__|___||___|
_______ _______ _______ _______ _______
| | | | | | | | | |
| ID 0 | | ID 1 | | ID 2 | | ID 3 | | ID 4 |
|_______| |_______| |_______| |_______| |_______|
_____|___________|___________|___________|___________|____
___|___ ___|___ ___|___ ___|___
| | | | | | | |
| ID 5 | | ID 6 | | ID 7 | | ID 8 |
|_______| |_______| |_______| |_______|
In a multi-master setup, all devices, are actively looking for a free device id:
- The device extracts a random device id and tries to contact that device
- If an answer is received, it adds one to the id and tries again
- If no answer is obtained from a device id, that is reserved
- The device receives for a random time to be able to answer to other devices interested in that device id
- The device tries to contact itself to probe collision, if no answer is received the device id is taken.