This tutorial explains how to operate 3-LED APA102 RGB board via UCANS32K146 over SPI.
An APA102 based RGB LED board
UCANS32K146 or UCANS32K1SIC
STEMMA QT / Qwiic JST SH 4-pin Cable
APA102 LED Board
The input connector of 3-LED APA102 board has 4 wired connections: SDI, CKI, PWR, GND. To connect the LED board to the UCAN board, refer the configuration of 'stemma qt / qwiic jst sh cable'. The connections would be as follows:
3-LED APA102 Board Input
Name
SPI Port (P1) Pin Number on UCAN
All the LEDs in the board are daisy chained together. Note: These boards can also be daisy chained from one board to the next. From the software point of view these are just considered one long string of LEDs daisy chained together.
Software Procedure
Note: You may refer the steps for building and flashing PX4 on this gitbook link.
Change the value of 'NUM_LEDS' in '/platforms/nuttx/NuttX/apps/examples/apa102/apa102_main.c' to the number of LEDs in your APA102 board. For our case, it will be '3'.
After compilation is done, the new firmware is available under: build/nxp_ucans32k146_default/deploy/34.bin
Flash the firmware and bootloader, if the board already doesn't have one, using 'jlink.exe'.
PX4-Autopilot BootloaderPX4-Autopilot FirmwareOperating the LEDs
Connect your board and access to the terminal using MobaXterm, minicom,...
Type the following command: