Debugging external I2C and SPI interface

A project log for High Efficiency MPPT Solar Charger

A 75 watt MPPT Solar Charger with tons of features. Efficiency > 97%, USB interface, data logging, 2 USB charging ports and much more...

Lukas FässlerLukas Fässler 08/15/2018 at 22:030 Comments

I've returned from two weeks of summer holidays on Sunday and have immediately resumed working on this project. Before I went on vacation I did quite some coding on the bootloader in order to get it ready to communicate to the outside world via SPI and I2C. But during all that time, I had no means of testing the software. All I did was to make sure my changes didn't break any existing functionality.

In order to test and debug those interfaces, I first needed another device using them. A RaspberryPi was an obvious candidate. I already had one but I haven't used it for a year or two so I first set it up with the latest version of Raspian and searched for a suitable library to handle the low-level details of the RaspberriPy's SPI and I2C ports.

After consulting google I decided to use the library by Mike McCauley ( and the corresponding Python bindings ( So I was first busy downloading, compiling and installing software packages and to get the RaspberryPi up and running in general. 

When I was half my age, I used to work on Debian and that Linux experience proved valuable in the process. But my knowledge on the subject has rusted since and it took me a while. Finally, I soldered some wires with 100mil connectors to both the Raspy and the charger so they hopefully soon communicate via SPI. This setup allows me to quickly and easily connect and disconnect the two boards and also make it easy to connect a scope in between.

The scope is also set up and triggers on any SPI communication. The python library also seems to work just fine, at least I can configure and access any of the GPIO pins. So I can start now with the real work ;-)