SNVU854 april   2023 TPS929120-Q1 , TPS929121-Q1 , TPS929160-Q1 , TPS929240-Q1

 

  1.   Abstract
  2.   Trademarks
  3. 1Introduction
  4. 2Software Setup
  5. 3Hardware Setup
  6. 4Sample Code Structure
    1. 4.1 Flow Diagram
    2. 4.2 System Setup
    3. 4.3 Diagnostics
    4. 4.4 EEPROM Programming

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 "TPS929240.h"

The code supports:

  • TPS929120
  • TPS929120A
  • TPS929121
  • TPS929121A
  • TPS929160
  • TPS929240
  • TPS929240A

Note that for the "Q1" devices, this is not added and only the base product name is used. The selected device is important to handle different register addresses and fields in registers. Moreover, when the default EEPROM is being programmed, the specified LED driver IC is the one being used to program the default value. This means that when the user wants to program a TPS929120 to TPS929120A, TPS929120A has to be selected in the file led_driver.h.

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

Table 4-1 Summary of Macro and Variable Names per File
Filename Macro/Variable Name Description
system_info.h DEVICE_CNT Number of devices on the FlexWire bus
CAN_USED Selection between UART or UART-over-CAN
ALWAYS_CHECK_CRC Enable CRC check for all non-broadcast commands
PROG_EEPROM Enable EEPROM programming mode
PROG_DEFAULT_EEPROM Program default EEPROM values instead of custom defined EEPROM values
USE_REF_PIN_FOR_EEPROM_PROG Use REF-pin during EEPROM programming
system_info.c device_address List of device addresses on the FlexWire bus
FlexWire.c rcvCrcError Report if received CRC has error

Within the file system_info.h the number of devices on the FlexWire bus is defined by macro DEVICE_CNT. The sample code only support 1 FlexWire bus.

// Total devices on FlexWire bus
#define DEVICE_CNT           1

The actual addresses of the devices are specified in file system_info.c. The sequence of addresses determines the order of FlexWire non-broadcast write and read commands. Therefore, the LED patterns in the animation mode will look different for different sequences of device addresses.

const uint16_t device_address[DEVICE_CNT] = {DEVICE_ADDR__1};

File system_info.h also defines other system parameters.

// Define if CAN or UART is used
#define CAN_USED             FALSE

// When non-broadcast is transmitted, does the CRC need to be checked
#define ALWAYS_CHECK_CRC     FALSE

Macro CAN_USED defines if UART or UART-over-CAN is being used for the FlexWire bus. This impacts the total number of bytes that are being received on the MCU UART-RX pin.

Macro ALWAYS_CHECK_CRC defines if for the received feedback, the CRC needs to be checked for every non-broadcast write command. When the CRC is checked and it is found that it is incorrect, global variable rcvCrcError is set to TRUE. In all other cases this variable is set to FALSE. The variable rcvCrcError is defined in file FlexWire.c.

// When an error in CRC of the received data is observed, set this to TRUE
unsigned int rcvCrcError;