Categories

D-21 : XBEE communication protocol

Here is a post concerning the XBEE communication protocol (hence the title) that we will use to synchronize the different slave tweeters.

We named the different messages to be able to be able to identify them quickly if you have any questions concerning them.

Protocol :

The master broadcasts alternatively two kinds of messages:

  • synchronisation messages “SYNCHRO”
  • configuration messages “CONFIG” detailing :
    • the frequency of the internal timer
    • the length of a cycle
    • ID with beeping configuration of each tweeter

 

When turning ON the master:

  • It waits a cycle length to get the actual configuration of the active tweeters
    • If all the configurations are the same
      -> it recovers this configuration and re-activate the synchronisation signal
    • If configurations are different or no configuration are received
      -> it sends a new configuration and re-activates the synchronisation signal

 

The slaves do the following things:

  • when receiving a synchronisation message “SYNCHRO” -> reset of the timer
  • when they receive a new configuration, they apply the changes concerning the general timer configuration (frequency and cycle length)
    • If their ID is present in the configuration
      -> apply the changes concerning the beeping times
    • If their ID is not present in the configuration
      -> send its ID to the master (to be included in the new configuration)
      in a message called “LOG”
  • during their “beeping interval” they send their ID and the actual beeping configuration according to them to the master in a “OK” message

 

Consequences:

When the master shuts down, the actual configuration is still applied and used for a given time.

When the master turns on: it tries to recover the configuration of each tweeters and if it is consistent (equal for each tweeter) he save it and re-synchronize the tweeters.

When a tweeter shuts down, the master will adjust the configuration accordingly. The master knows a tweeter is shut down because he won’t receive the OK message.

When a tweeter turns on, it waits for a configuration message containing its ID followed by a synchronisation message to start beeping.

If no configuration messages are send, the master is most likely dead and the tweeter cannot resynchronize.
If the configuration message does not contain its ID the tweeter sends a “LOG” message and it will be included in the next configuration file.

Jean-Baptiste Lescher

Commentaires fermés.