## 2 Materials and Methods
### From DVS to SpiNNaker  
DVS only sends the addresses of pixels whose temporal change of intensity is higher than a preset threshold [5]. Therefore, the microcontroller receives the horizontal (x) and vertical (y) coordinates of events. The resolution of DVS is \(128\times 128\), which requires 7 bits to encode the x and y coordinates of the event address. For example, in Table 1, the packet corresponding to the event at pixel at the position (68,98) is encoded as:  
The first bit of header is the parity bit, it is set to ensure the whole packet has odd parity. The rest of header bits and the two unused bits in the packet data are set to 0. For SpiNNaker, the spikes are encoded as packets, in the following form (Table 2): \begin{table}
\begin{tabular}{c c c c c} \hline
**1000 0000** & **0010001** & **0100011** & **00** & **0010 1100 0100** \\ \hline header & x & y & unused & virtual routing key \\ \hline \end{tabular}
\end{table} 
Table 1: Encoding scheme for DVS events. Figure 1: Functional blocks of the neuromorphic platform consisting of dynamic vision sensor (DVS), SpiNNaker board, and servo motor, with the microcontroller implemented as an interface between these blocks. Figure 2: DVS recording of a ping-pong ball passing. A packet contains: Header to indicate its specification, Packet Data which stores information about the spikes, and an optional PayLoad to carry more information, such as membrane voltage [8]. The packet format used in the designed system is 40-bit multi-cast packet without payload. Furthermore, SpiNNaker regards external devices as virtual chips on its system [25]. Thus, a virtual routing key should be defined as the delivery address of the injected spikes. In the designed system, the virtual routing key consists of four Hex numbers ('0 \(\times\) 1', '0 \(\times\) 2', '0 \(\times\) 3' and '0 \(\times\) 4'). The decimal to binary conversion of SpiNNaker packets starts from the least significant bit, and the order of virtual routing key is reversed. The reason is that SpiNNaker reads packets from the end. The events received by the microcontroller can be sub-sampled or preprocessed to increase the processing speed and filter random noise. The resolution reduction is also important for reducing the size of the neural network needed to handle the DVS events. As shown in Figure 3, an average mask of \(8\times 8\) has been applied to the received events and a new threshold is set to the averaged pixel value to define whether the'superpixel' is generating an event or not. Through the resolution reduction, only 4 bits are needed to encode x and y of the events, respectively. For instance, the packet corresponding to the event at superpixel (3,15) is shown in Table 3.  
After receiving the raw pixel data from the DVS, the microcontroller is converting them first into superpixel events, and then into 40-bit packets appropriate for the SpiNNaker system. The microcontroller will send the packets into SpiNNaker by using 2-of-7 coding and 2-phase \begin{table}
\begin{tabular}{c c c c} \hline \hline Header (8 bits) & Packet Data (32 bits) & PayLoad (32 bits, optional) & EOP \\ \hline \hline \end{tabular}
\end{table} 
Table 2: SpiNNaker data packet structure. Figure 3: DVS data are preprocessed, and overall resolution reduced from \(128\times 128\) to \(16\times 16\), where each ‘superpixel’ represents a block of 64 (\(8\times 8\)) original pixels. The decision whether there is spike at a ‘superpixel’ is based on having a set number of spikes in the pixels that it covers within a specific time window. If the first layer of the SNN has one neuron for each pixel, then required number of neurons is reduced from 16,384 to 256—some loss of resolution but a significant advantage for the neural network training phase. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**0000 000** & **1100** & **1111** & **0000 0000** & **0010 1100 0100** \\ \hline header & x & y & unused & virtual routing key \\ \hline \hline \end{tabular}
\end{table} 
Table 3: DVS resolution reduction event data encoding. handshaking protocol.