AM243x MCU+ SDK  10.01.00
ADS131

Introduction

This example uses ADS131M08 ADC IC to convert analog input signal on adc channel to samples and store the results in a shared memory which can be configured by the user (using PRU IPC module). The read samples are finally printed to the R5F console, or can also be visualized using CCS Graph plotter. GUI Composer app available on TI Gallery can also be used to evaluate the ADC using a GUI based interface.

The example does the below

  • PRU controls the ADC and reads the samples
  • PRU program implements ADC samples transfer interface
  • PRU then writes the samples to a shared memory and creates an interrupt after writing 1 block of data
  • On interrupt R5F then reads the data and prints it on console

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 freertos
ICSSG ICSSG0 - PRU0
Toolchain ti-arm-clang, pru-cgt
Board am243x-evm
Example folder examples/pru_io/adc/ADS131/

Steps to Run the Example

  • When using CCS projects to build, import the CCS project from the above mentioned Example folder path for system_freertos_prufw (It will automatically import R5F and PRU project) for the required combination.
  • On importing the project, SysConfig will contain an ADC Config instance with default configurations which are compatible with the ADC-PHI-PRU-EVM Adapter Board, Use R5F SysConfig to configure the required settings for the ADC IC.

ADC SysConfig Options
You will need to edit linker file whenever changes are made to the configuration for PRU IPC module, refer Update linker command file
  • Build only the system_freertos_prufw using the CCS project menu (see Using SDK with CCS Projects).

    • Build Flow: Once you click on build in system_freertos_prufw, first, PRU project is compiled according to the configurations set in PRU SysConfig. Finally the R5F project will be compiled using both the generated R5F SysConfig files and PRU project binaries or PRU Firmware header file.
    Note
    Prerequisite: PRU-CGT-2-3 (ti-pru-cgt) should be installed at: C:/ti/
  • Launch a CCS debug session and run the executable, see CCS Launch, Load and Run

Features

Supported:

  • Serial Interface
  • Interrupt on receiving a block of data
  • ADC, Pinmux and other configurations through SysConfig interface

Important files and directory structure

Folder/Files Description
${SDK_INSTALL_PATH}/source/pru_io/
firmware/ PRU source files providing macros for interfaces, pru_ipc, etc.
driver/ PRU IPC source files for sending ADC samples from PRU to R5F

Sample Output

Shown below is a sample output when the application is built and run in debug mode:

--------------------------------------------------
Initializing App
Initialized
--------------------------------------------------
Powering up ADC...
ADC Powered Up
--------------------------------------------------
Resetting ADC
--------------------------------------------------
Configuring ADC...
ADC Configuration completed
--------------------------------------------------
Starting ADC Conversion
Started ADC Conversion
--------------------------------------------------
----- Channel: 1 -----
Sample 1: 1858
Sample 2: 1552
Sample 3: 2037
Sample 4: 1752
Sample 5: 2005
----- Channel: 2 -----
Sample 1: 1214
Sample 2: 1372
Sample 3: 1256
Sample 4: 1425
Sample 5: 1034

Sample output with sinwave given as analog input to ADC

  • CCS graph tool can be used to plot graph using digital data from ADC, PRU IPC start buffer address for each channel can found in linker command file of R5F project, sample output when sin wave is given as input is shown below

Implementation Details

Refer here for complete implementation explanation: ADS131 Implementation Details