SLAAEL6 September 2024 MSPM0G3507
This section describes how the sample code sets 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. The example code includes TPS929240 in default.
The example code also supports:
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 of macros and variables that impact the system setup is listed in Table 4-1.
Filename | Macro or 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 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 found 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;