Networking and Communication

Week 13

22nd-29th April 2014

This week we were expected to make two or more microcontrollers talk to each other. As a departure point I decided to use Neil's Asynchronous Packet Automata protocol. APA intrigued me first of all because it's an extremely minimalistic protocol, whole functionality of which is contained within 700 lines of code. Secondly - it seemed like a good fit for my final project, as the network topology of my final project is defined by it's physical construction.

In an attempt to minimize travelling time between Brooklyn (home) and Boston (lab) I decided to mill a bunch of APA boards in one go and stuff and program them later. Loading a single batch of six boards seemed like a good idea until I discovered that Modela's table was level enough for a single board, but wasn't quite perfect for six of them.

After that I cut the boards out in two batches of three. Packed all the necessary components in plastic bags and hit the bus to Brooklyn. When soldering them at home I realized that couple components (diode and voltage regulator) indicated on the board were not quite that easy to differentiate from other components in the inventory. And I did spend some time figuring out wheter the 3-pin part that I soldered is a correct voltage regulator or something else.
Eventually I did get the boards populated and programmed, but spent the rest of the time trying to make them communicate. As documentation on the APA protocol is extremely scarce, I had to spend a fair amount of time making sense of the logic behind the protocol from the provided code. After failing to solve this in time for the class - I contacted one of classmates - Takuma Oami who was working with APA as well and he told me one obvious trick that I was too involved to notice earlier. The IN and OUT wires of the cable have to be swapped. That basically did the trick and I got the boards to respond and light up the LEDs.

Expect the unexpected when restoring the toolchain after a lengthy break and a hard drive reformat. Python couldn't find the serial module.

  • pip install pyserial

  • Logic analyzer was VERY HELPFUL in understanding the APA protocol and troubleshooting communication. Here are the photo of the APA network setup with analyzer probes attached, and the screenshots of the terminal and the analyzer window. Every stage of communication is clearly visible.

    Addressing scheme in the APA is derived from the physical network layout. To send the message to a particular node you just type in the sequence of APA port numbers. Bridge node's port is skipped, thus the address of the APA IO1 would be simply empty: '', and to reach the APA IO2, which is attached to the port 2 of the first io board, we need to provide the address '2'.

    In this experiment there's no sensors/actuators attached to the IO ports, thus the only thing we can observe is just the pure network communication.

    Files used this week are the original APA boards and firmware from Neil.

  • Available here