SCEA154 July   2025 TXE8124

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Setup and Configuration
  6. 3TXE81XX 24-Bit SPI Word Definition
  7. 4SPI Write Steps
  8. 5Coding Example
  9. 6Sample Code
  10. 7Summary
  11. 8References

Coding Example

The current version of code composer studio can be downloaded from TI Developer Zone below the Common Actions section.

After downloading and opening the Code Composer Studio IDE, the example code can be found by browsing the software examples provided in the Resource Explorer.

 In Code Composer Studio IDE,
                    Browse Software and Examples Figure 5-1 In Code Composer Studio IDE, Browse Software and Examples

Once the resource explorer is opened, follow the below directory to locate the sample code:

Arm^R-Based Microcontrollers → Embedded Software → MSPM0 SDK – 2.04.00.06 → Examples → Development Tools → LP-MSPM0C1104 LaunchPad → DriverLib → spi_controller_internal_loopback_poll → No RTOS → GCC Compiler → spi_controller_internal_loopback_poll

The sample project can be imported into the CCS IDE by clicking the 3 dots and selecting “Import to CCS IDE.”

Once imported, start by selecting the “spi_controller_internal_loopback_poll.syscfg” file.

The SPI settings in the example are to be modified through the SYSCONFIG GUI. Underneath SPI, select the following configurations to setup the code properly.

 SYSCONFIG Setup Figure 5-2 SYSCONFIG Setup

SPI_0 is the name of the SPI peripheral in use. A custom profile is created. The mode is selected to be Controller with a target bit rate of 500kHz. Frame formatting is Motorola 4-wire SPI. Clock polarity set to LOW. Clock phase – data captured on first clock edge which is rising edge. Frame size is set to 8 bits. Bit order is MSB first. While chip select is CS0 – PA11, this example uses the GPIO on PA2 to capture the 3-byte framing structure for the TXE8124 device. CS0 – PA11 is ignored for this example.

Select the following for the Advanced Configuration tab making sure the Enable Internal Loopback is unchecked.

 Below the Advanced
                    Configuration Tab, the Enable Internal Loopback is Disabled Figure 5-3 Below the Advanced Configuration Tab, the Enable Internal Loopback is Disabled

The SYSCONFIG GUI sets up the SPI configuration without having to write code within the M0 driver library. This sets up the SPI driver giving more time to focus on the example functions for the TXE81XX.