Demo: APA102 RGB LED
Zephyr RTOS driving RGB LEDS on CANHUBK344 board.
Introduction
This tutorial describes how to connect and operate APA102 LEDs on MR-CANHUBK3 board and control them using Zephyr RTOS.
Items needed
2
USB-A (Male) to 2-Wire (Female) Power Cable
1
9
3-LED (daisy chained) APA102 Strip
4
Hardware procedure
You will connect a SPI port (Zephyr lpspi4) on the CANHUBK344 Pin headers to drive the clock and data signal going to the APA102 LEDs. Note that in application, it may be desireable to use a different SPI connection and provide 5V power independently to the LEDs.)
Connections from APA102 to P8B (Connector that houses LPSPI4)
1
Voltage
Red
2
2
Ground
Black
1
3
SPI Clock
Yellow
17 (LPSPI4 Clock)
4
SPI MOSI
Blue
18 (LPSPI4 MOSI)
Create your own SPI to STEMMA QT cable
Other SPI interfaces with JST-GH
Alternative sources for 5V LED power
SPI and Power connection on MR-CANHUBK344 header for LEDs in this Demo


Software procedure
Initialize west workspace
Building & flashing "led_apa102" application
This application displays a 3-colour pattern (red - green - blue) that walks the strip until it reaches the end, then starts at the beginning again; by default, the delay between each message is 40 ms.
Video demo 1
Building & flashing "led_apa102_indicators" application
This application demonstrates the lighting of turn indicators for vehicles. It cycles between the four turn indicators - front left, front right, back left and back right. These turn indicators have LED patterns respectively: 2 → 1 → 0, 3 → 4 → 5, 8 → 7 → 6 and 9 → 10 → 11.
Video Demo 2
LED Daisy Chain configuration


Last updated