This lab builds on the PWM and RGB LED work we’ve done earlier. The goal is for you to be comfortable with SPI serial communications. This particular device will be one foundation of the Simon game.
rainbow_spi.c
file (Canvas)Cut a piece of APA102 strip 5 LEDs long. Take care to leave as much of the perforation intact on the entry side of the strip. (There are directional arrows which point in the direction of signal flow.)
Solder 4 jumper wires to the exposed copper perforation holes as shown in
the second picture to the left. When looking from the front, the 4
perforations are VCC, CLK, DATA, GND
. I found that the easiest way to solder
was to first apply lots of flux and then melt solder onto the perforations,
making sure that it actually had flowed onto them. Then, I pre-tinned the
exposed ends of the jumper wires. Finally, I held the jumper wires in place on
each of the perforations and applied heat to reflow the solder. Once you get a
good connection, you may want to apply some epoxy resin over the wires.
Let’s review serial communications. Also take a look at the documentation for the APA102 device.
Now lets review the characteristics of the serial control hardware block in your MSP430s, the USCI.
Connect your APA102C to the MSP430 using the appropriate SPI clock and MOSI lines. Configure the USCI module so that the SPI clock frequency is within the acceptable range for the APA102C, and the data communication clock edges are proper. Practice sending SPI commands until you figure out how to change the colors of the LEDs (and, optionally, intensity).
Write code to shift the LED colors through a rainbow (starting with red and
going to blue as in Lab 6). There should be 256 color “temperature” levels. Each
LED should cycle one step behind the previous one so that the rainbow appears to
move upward. Use the _16ms
watchdog timer interrupt for timing, and increment
the temperature by 16 each time step. Save this as rainbow_spi.c
.