SPRADB1 September 2023 ADS127L11 , ADS127L21 , AM2434
The Texas Instruments AM243x microcontroller device contains two instances of the PRU-ICSS (ICSSG0) peripheral, alongside 2 to 4 ARM R5F cores depending on the part name version.
Figure 2-1 offers insight into the system block diagram. One instance of PRU-ICSS interfaces with the 4-channel IEPE ADC board, serving as the analog front-end for IEPE sensors. The upcoming sections delve into the particulars of this 4-channel SPI interface, showing the implementation towards the ADC boards. The second PRU-ICSS instance functions as an Ethernet MAC, establishing connectivity with the single-pair Ethernet PHY. This connection facilitates the transmission of ADC samples and FFT data to the SPE gateway board.
To effectively distribute the workload, two ARM R5F cores come into play. R5F core 00 undertakes tasks such as ADC interface initialization (including configuration), reception of the four ADC sample buffers, and the execution of FFT calculations on these buffers. Results from the FFT computations and the unprocessed ADC data are made accessible to the second R5F core, labeled as R5F core 01. The latter core is responsible for tasks like JSON formatting and MQTT networking, ultimately transmitting the Ethernet frame through the MAC network interface hosted on the second PRU-ICSS instance (ICSSG1).
This application note focuses primarily on the PRU-ICSSG0 ADC interface in conjunction with the 4-channel ADC board.
Figure 2-2 provides a simplified representation of the hardware signal connections between the four ADCs and PRU-ICSS over the custom 4-channel SPI interface.
The implementation of the multi-channel SPI function is facilitated by PRU-ICSS firmware utilizing dedicated General Purpose Input (GPI) and General Purpose Output (GPO) signals. These GPI and GPO signals are mapped to PRU registers and offer minimal latency, enabling real-time control of external peripherals through firmware. In this context, the GPI and GPO signals are leveraged to emulate an SPI interface.
The system employs a unified Serial Data Out (SDO) line from PRU-ICSS to all ADCs. This design choice permits simultaneous configuration of all ADCs with identical settings, essential for synchronized sampling. The PRU accesses the SDO line through the R30 register.
SPI lines 1 to 4 from each ADC are channeled into dedicated GPI lines on the PRU-ICSS, and these lines are read by the PRU firmware via the R31 register. The subsequent sections delve into the intricate process of converting the serial data stream from each SDI line into parallel 24-bit ADC data.
The Serial Clock (SCLK) signal is generated by the PRU-ICSS. Two options exist for generating SCLK:
This system implementation employs the IEP timer for generating SCLK.
The Return_SCLK signal serves as the clock signal for data sampling in the PRU firmware. Return_SCLK is derived from SCLK and transmitted over the high-speed connector. This choice proves advantageous when utilizing high-speed clocks above 10 MHz. Isolation devices introduce signal delays for all signals traversing the isolation barrier. Employing Return_SCLK for sampling permits the PRU-ICSS to capture the exact clock edge used by the ADC to output sampling data on the SDI lines, thereby achieving accurate data capture.
Figure 2-3 visually depicts the transfer of SCLK, Return_SCLK, and ADC data samples over the SDO lines. SDO1 to SDO4 and Return SCLK are input to the PRU-ICSS via GPIs. SCLK clock signal is generated via GPO in PRU-ICSS. Return SCLK is utilized by PRU firmware to capture SDO data bits.
Each ADC furnishes 24-bit data samples, comprising Least Significant Bit (LSB), Middle Bits (MID), and Most Significant Bit (MSB). These data samples are placed on the SDO lines using the SCLK clock signal. Thus, a continuous 24-clock cycle SCLK signal is necessary, prompting the ADCs to present all data samples on the SDO line.
The PRU firmware undertakes the subsequent tasks:
Accessing the SDO lines directly involves utilizing bits b0 to b3 of register R31. PRU firmware samples data by copying and left-shifting the lower 8 data bits to register R2 (byte 0), as demonstrated in Figure 2-4. After sampling, the initial 1-bit of data for each channel is located in R2 from bit 4 to bit 7.
The PRU firmware executes the following task seen in Figure 2-5:
Following step 19, the PRU firmware executes four sbco instructions to store each 32-bit sample into the data buffer located in shared RAM. The PRU repeats this process, writing 32-bit data into the buffer multiple times until a complete sample buffer is filled. Please refer to Figure 2-7 for a visual representation of this process.
Figure 2-8 illustrates the comprehensive software flow of the entire system. Following the completion of the sample buffer, the PRU triggers an Interrupt Controller (INTC) event towards the ARM. The ARM core R5F-00 receives this event as an interrupt, subsequently performing Fast Fourier Transform (FFT) calculations on the ADC sample buffer. Once the FFT calculation concludes, the samples are passed to the second R5F-01 core. This core manages the creation of JSON formatting and the transmission of data via the MQTT protocol over the Single Pair Ethernet (SPE) connection. The ICSSG1 manages Ethernet transmission through the SPE port.
This iterative process is continually repeated for each ADC buffer. FFT calculations and raw ADC samples are efficiently conveyed over the Single Pair Ethernet to the gateway board.
The application on the ARM processor is split across two ARM Cortex R5F cores for efficient processing and communication.
R5F Core 00:
R5F Core 01:
In summary, the ARM application is structured to leverage the capabilities of two Cortex R5F cores efficiently. Core 00 handles initialization, configuration, and interaction with the ADC subsystem, while Core 01 is dedicated to data processing and communication. This leads to the efficient transmission of processed data over the network.