Sniff (Telemetry)

Our MDB devices have a sniffing method which allows to have a detailed overview of what is happening in the MDB bus.

To start the sniffer instance just issue the following command:

Enable MDB Sniffing
Copy

Answer:

  • x,ACK

The device is now in sniffing mode.

Every line logged by the sniffer has the following structure:

MDB Sniffing Message Format
Copy

Where:

  • x - message was sent from sniffer instance
  • aa - the block status (two character hex), where the first hex dight (0x80 or 0x00) identifies if message was sent by master (0x00) or slave (0x80), and lower bits have error information (if any, should be 0 normally, but for further reference, please check the error codes section below).
  • tttttttttt - 10-digit timestamp in 0.1ms resolution for when the block was received
  • yy - command code of the device to which the message is sent (if sent from master)
  • data - the data bytes or just ACK

If you place an MDB-USB sniffing a bus where a VMC and a standard cashless peripheral are connected to, the sniffer will log something which looks like the following:

We removed some polls to make the output below a bit shorter and therefore, the timestamps may not be the exact ones that were logged.

What follows after the "#" is a comment is only a comment to help you understand the example. It will not appear in the captures.

MDB Sniffing Capture Example
Copy
Disable MDB Sniffing
Copy

The messages on the ports are independently received, and when they are 'ready' (complete) they are put into their respective processes for handling. The timestamp is taken when the message starts, so it is the correct reference for the message, when it gets into the usb transmit queue is not guaranteed. The messages won't coming 50ms later of course but few ms can happen - sorting by timestamp guarantees the messages are in the right sequence.

Bus error detection

Sometimes, MDB Equipments, either the Peripherals, or the VMCs do not follow the MDB Specification entirely, either by being slightly off the timing constraints, or by setting wrong bits on the checksum bytes. Sometimes this leads to equipments which are incompatible with other equipments from different vendors. When that happens, if we put up an MDB Device (Pi Hat or MDB USB) adn look at the sniffing, we will be able to observe some messages as shown below:

Errors detected on the Peripheral Direction

Errors in Peripheral
Copy

What each field means:

  • timestamp: 10-digit timestamp in 0.1ms resolution for when the block was received
  • data: The bytes received in that packet.
  • checksum: The checksum of the packet just received.
  • error_info: From the received bytes, which sort of error was found in each one.
Example
Copy

In the example above, the error indicates that the first 12 was received as data, the second 12 received as checksum, and there was an error on the 9th bit (not visible in the sniffer data) which invalidated the checksum correct reception. This 9th bit is called a mode bit.

Errors detected in the Master direction

Errors in VMC
Copy

What each field means:

  • timestamp: 10-digit timestamp in 0.1ms resolution for when the block was received
  • data: The bytes received in that packet.
  • checksum: The checksum of the packet just received.
  • error_info: From the received bytes, which sort of error was found in each one.
Example
Copy

In the example above, this error means that on the 8 bytes received, there was a checksum error on all the bytes, and also a mode bit error on this data "packet".

Example
Copy

In the example above, there was a timeout, checksum and bit mor error. 7 it's bits added: 1 + 2 + 4

Error Types shown on sniffer

ErrorCodeDescription
1Bit Mode ErrorOn MDB, each data byte is composed by a start bit, 8 data bits, followed by a mode bit, and a stop bit. The mode bit, when sent from VMC to peripherals, to differentiate between address and data bytes. When this bit is set to 1 , the packet is an address byte, when it is set to 0, the packet is a data byte.
2Checksum errorAccording to MDB specification, any communication data block (excluding ACK and NACK), must be followed by a checksum byte. This byte consists of the addition (sum) of all the bytes within the data block, with the carry out bit ignored. If this value is incorrect, then this error code will be shown in the sniffer console.
4Timeout errorThis error code will be shown any time the MDB timing constraints are not respected. For further information, please refer to sectiomn 3.2 of the MDB Specification version 4.3.
8Framing errorThis error occurs when the MDB framing of the received byte is not according to the definition in the MDB Specification (each data byte must have 1 start bit, 8 data bits, 1 mode bit and 1 stop bit).
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard