SNVU849 may   2023 LP5891-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Software Setup
  6. 3Sample Code Structure
    1. 3.1 Design Parameters
    2. 3.2 Flow Diagram
    3. 3.3 System Setup
    4. 3.4 Diagnostics
    5. 3.5 Demo

System Setup

This section describes how the sample code setups different parameters to identify how the system is built. The first part is the actual used LED driver IC. Within the led_driver.h file, the used LED driver IC is selected.

#include "LP5891.h"
The code supports:
  • LP5891
  • LP5890
  • TLC6984
  • TLC6983

Note that for the "Q1" devices, this is not added and only the base product name is used.

A summary about macros and variables that impact the system setup and their location is listed in Table 3-2.

Table 3-2 Summary of Macro and Variable Names Per File
Filename Macro/Variable name Description
system_info.h SPICLK_FREQ_IN_HZ SCLK frequency
ANIMATION Selection between animation and simple test modes
TOTAL_SCAN_LINES Number of scan lines
CCSI_BUS_NUM Number of CCSI busses
CASCADED_UNITS_CCSI1 Device count in CCSI bus 1
CASCADED_UNITS_CCSI2 Device count in CCSI bus 2
MONOCHROMATIC Selection between RGB and single color display
system_info.c FRAME_PERIOD Interval of VSYNC commands

Within the file system_info.c the frame period is specified which determines the frame rate. The frame period is specified in microseconds.

const uint16_t FRAME_PERIOD = 16667;      // 16.67ms = 60 Hz frames-per-second

The maximum supported frame period is 65535 microseconds, i.e. the lowest frame rate is 15.3 Hz.

File system_info.h includes several system definitions.

// Desired SCLK frequency (in case of TLC698x this SCLK frequency is half of this)
// Note: Exact frequency may not be possible
#define SPICLK_FREQ_IN_HZ        7500000

Macro SPICLK_FREQ_IN_HZ defines at what data rate the Continuous Clock Serial Interface (CCSI) is running, i.e. the clock frequency of pin SCLK. This frequency is an integer divider from the system frequency of the MCU. Therefore, the actual CCSI frequency may differ from the desired specified frequency defined by SPICLK_FREQ_IN_HZ.

#define ANIMATION              TRUE
#define MONOCHROMATIC          FALSE

Macro ANIMATION will determine if the animation or simple test mode is executed.

The EVMs all use RGB LEDs. Therefore, macro MONOCHROMATIC is defined as FALSE. The sample code does support systems using single color LEDs, e.g. only red LEDs. In those cases, the macro MONOCHROMATIC should be defined as TRUE. This automatically changes the frame data structure, the animation algorithms, and APIs.

The following code block shows macros which impact the register settings.

#define TOTAL_SCAN_LINES       16
#define CASCADED_UNITS_CCSI1   1

Macro TOTAL_SCAN_LINES defines the number of scan lines used in the system and will directly impact the field SCAN_NUM in register FC0.

For the LP5891Q1EVM there are 16 scan lines.

Macro CASCADED_UNITS_CCSI1 defines the number of cascaded devices in the system and directly impacts the field CHIP_NUM is register FC0.

For the LP5891Q1EVM there is only 1 device cascaded.

When the user cascades more EVMs with the available connectors, this macro will have to be updated.

GUID-20230321-SS0I-5TRS-TNLN-JNNNQXFTRZRK-low.svg Figure 3-2 Example System Using 2 CCSI Chains

The sample code supports up to 2 CCSI daisy chains. To illustrate this an example is depicted in Figure 3-2. The number of actual used chains is defined by macro CCSI_BUS_NUM in file system_info.h.

// Total CCSI buses supported
#define CCSI_BUS_NUM           2

Each chain can have a different number of cascaded devices. Therefore, besides macro CASCADED_UNITS_CCSI1, there is also macro CASCADED_UNITS_CCSI2 in file system_info.h. In the example, CCSI chain 1 has 3 cascaded devices and CCSI chain 2 has 2 cascaded devices.

#define CASCADED_UNITS_CCSI1   3
#define CASCADED_UNITS_CCSI2   2