I finally figured out what was going wrong with my I2C peripheral.
In my quest to replace the Adafruit Trellis, I decided to investigate capacitive touch sensing. I created a t44-based board with four different pad layouts for step-response touch sensors: two simple sensors and two sensors with integrated LEDs.
To communicate with the main hwpm board I decided to use I2C, as conveniently the hwpm board has a header with a 5V I2C bus. The t44 has a Universal Serial Interface (USI) on board, which allows hardware serial support for a variety of serial protocols depending on configuration. The necessary pins are shared with the Atmel ISP pins – and, to make things more challenging, I2C requires pull-up resistors while SPI does not. I solved this by including hardware slide switches to toggle the SDA/MOSI and SCL/SCK lines from the ISP header to the I2C header – though, based on some reading, this might not have been ultimately needed.
Atmel provides example code for configuring a USI-capable MCU as an I2C peripheral. I took this code and made some modifications to try to have it transmit some sensor data, and wrote an Arduino sketch for the hwpm board to have it display the data.
This didn’t work very well at first. I determined that if the t44 board tries to do too much processing in its main loop then the overall system tends to be prone to getting “stuck”. I also determined that raising the t44’s clock speed (from 1M to 8M) allows more processing to be done, which was important for actually harvesting the step response data.
It’s hard to find enough pins on the t44 to drive a 4x4 step response matrix. It seems like it would be just about possible, though.