Blog: May 2015

Labday event: SPI Shock

| Oliver

Once or twice a month we all take a day or two out of our ordinary business and organize a lab-day. This is primarily meant to give everybody the chance to work on topics not related to the daily work, learn about new technologies & techniques and to have some fun developing something. Last week we had a 2 day event because there was a pressing issue that could not wait: Some people needed to be saved. Here is the excerpt of the story:

It is the year of 2072. You and your team are a special force hacker commando whose task is to free the people from the Citadel Space station where the special AI computer Shodan had captured several people. A hacker has disabled the Shodan Robot Law interfaces, thus Shodan went beserk. Shodan has turned off the life support on the Space Station. Currently the oxygen reserves are for 2 days, after this all people will be die. Your team have a limited time to access the main frame where Shodan is located and to upload a shutdown code to the kernel that will turn off the main AI process. Unfortunately Shodan has disabled all the terminals, closed all SSH ports. The only possibility to upload the shutdown sequence is over a special SPI HW Interface which is used for emergency cases. Thus you have to access the flash drives over the SPI protocol. For this task your team is given a super-mega-mini-powerful Raspberry PI mini computer. This will be the master interface. For the emergency slave interface an Arduino Board will be used as an emulation. Feel free to chose the compiler/programming language.

spilabdays4

SPI is a technology that is widely used in the embedded space and we need it in almost every project. Still not very many people are familiar with the details of the protocol. Two of our developers that actually do know the details took the time to prepare a labsession a couple of weeks ago and presented a talk about SPI. With this as background information all of us had at least a basic grasp of the SPI protocol. Hearing about a technology is good but nothing beats actually doing it yourself. So we decided to implement our own SPI driver just for fun using a Raspberry and an Arduino Uno to talk to.

spilabdays2 spilabdays1

The labdays provided a good context to work on it. And 2 full days are a very suitable timeframe to actually get something working. We grouped in teams of 4 and started hacking. As always it took some time to setup the hardware together with the basic development tools and to get used to the process of coding, testing and deploy the software to the target(s). For the Arduino this is made incredibly simple by the tools that are readily available for the major OSs. Just implement some functionality in C, compile & flash to target via USB. Couldn’t be simpler. For the raspberries a SSH connection is all you need to deploy your code. Some teams used C++ for their implementation, others used python or even go. All in all the developing experience with both the hardwares is rather smooth if you compare it to the hardware that we usually have to deal with.

spilabdays6

After the 2 days of implementation and disbelievingly starring at oscilloscope screens some teams finally cracked the challenge and were able to upload the virus to Shodan to kill it. All people got out alive and it actually was a really helpful exercise to dive down into a very important embedded protocol. Looking forward to the next session!