Skip to content

Commit fba9510

Browse files
feat(linux): AM62DX: Add doc for 2D FFT DSP offload demo
Add doc for 2D FFT offload demo. This demo offloads test data for 2D FFT processing from Linux user space to C7x. Signed-off-by: Paresh Bhagat <[email protected]>
1 parent 89b3f9b commit fba9510

File tree

5 files changed

+231
-0
lines changed

5 files changed

+231
-0
lines changed

configs/AM62DX/AM62DX_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,6 @@ linux/How_to_Guides/Hardware_Setup_with_CCS/AM62Dx_EVM_Hardware_Setup
8686

8787
linux/Demo_User_Guides/index_Demos
8888
linux/Demo_User_Guides/AM62D_Dsp_Offload_User_Guide
89+
linux/Demo_User_Guides/AM62D_2DFFT_User_Guide
8990

9091
linux/Documentation_Tarball
134 KB
Loading
13.6 KB
Loading
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
.. _AM62D-2dfft-dsp-offload-from-linux-user-guide:
2+
3+
AM62D 2D FFT DSP Offload from Linux - User Guide
4+
################################################
5+
6+
Overview
7+
********
8+
9+
This guide describes how to set up, build, and run the 2D FFT DSP offload example using the Texas Instruments AM62D evaluation module (EVM). This demo example shows how to offload 2D Fast Fourier Transform (FFT) computation to the C7x DSP from Linux user-space. The input is a 128x128 complex matrix, and the output is the 2D FFT transformed data in the same format.
10+
11+
Below figure shows how this demo works:
12+
13+
.. figure:: /images/AM62D_2DFFT_DSP_offload_Demo.png
14+
:height: 450
15+
:width: 1000
16+
17+
- Step 1: Read test data
18+
- The 2D FFT offload example application reads the 128x128 complex test data from storage.
19+
20+
- Step 2: Copy data to shared DMA Buffer (DDR)
21+
- Input data is copied to a shared DMA buffer located in DDR memory.
22+
23+
- Step 3: Send Buffer Ready Message
24+
- A53 sends control message via RPMsg to notify C7x
25+
26+
- Step 4: Notify DSP using RPMsg (IPC)
27+
- A53 sends a control message via RPMsg (Remote Processor Messaging) to the C7x core. This message informs the C7x that new input data is available for processing in the shared DDR buffer.
28+
29+
- Step 5: C7x reads from shared DMA Buffer into L2 SRAM
30+
- The C7x DSP copies the input data from the DMA buffer (DDR) into its local L2 SRAM for processing. This operation minimizes access latency compared to reading directly from DDR. and performs 2D FFT computation on C7x.
31+
32+
- Step 6:2D FFT computation on DSP
33+
- Below figure shows 2D FFT computation on C7x.
34+
35+
.. figure:: /images/fft_2d_signal_chain.png
36+
:height: 140
37+
:width: 1000
38+
39+
- 1D Batched FFT: The first 1D FFT is performed on the rows.
40+
- Matrix Transpose: The data matrix is transposed to convert coloumns to rows and vice versa. Because FFTLIB libraries are designed perform FFT on 1D data in rows format.
41+
- 1D Batched FFT: The second 1D FFT is performed on the coloumns data.
42+
- During processing, data is moved between L2SRAM (lower latency, lower capacity) and DDR (higher capacity, higher latency) to use memory efficiently.
43+
44+
- Step 7: Processed data copied back to shared DMA Buffer (DDR)
45+
- Once DSP processing is complete, the output (2D FFT transformed data) is copied back into the shared DMA buffer.
46+
- C7x sends a control message via RPMsg to the A53 core, informing it that processed output data is available in the shared DDR buffer.
47+
48+
- Step 8: Send Complete Message
49+
- C7x notifies that processing is complete
50+
51+
- Step 9: Notify A53
52+
- RPMsg forwards completion notification to A53
53+
54+
- Step 10: A53 reads back processed data from DMA buffer
55+
- A53 copies the processed data from the shared buffer for validation.
56+
57+
- Step 11: Validation and Performance Reporting
58+
- The output data is compared against expected results to verify correctness.
59+
- Performance metrics are displayed:
60+
- DSP Load (%)
61+
- Cycle Count
62+
- DDR Throughput (MB/s)
63+
64+
Hardware Prerequisites
65+
**********************
66+
67+
- `AM62D-EVM <https://www.ti.com/tool/AUDIO-AM62D-EVM>`__
68+
- SD card (minimum 16GB)
69+
- USB Type-C 20W power supply (make sure to use type-C to type-C cable)
70+
- USB-to-UART cable for console access
71+
- PC (Windows or Linux) to flash image onto an SD Card
72+
- Host PC Requirements:
73+
74+
- Operating system:
75+
76+
- Windows: |__WINDOWS_SUPPORTED_LONG__|
77+
- Ubuntu: |__LINUX_UBUNTU_VERSION_LONG__|
78+
79+
- Memory: Minimum 4GB RAM (8GB or more recommended)
80+
- Storage: At least 10GB of free space
81+
82+
Software and Tools
83+
******************
84+
85+
- TI Processor SDK Linux RT (AM62Dx)
86+
- MCU+ SDK for AM62Dx
87+
- `C7000-CGT <https://www.ti.com/tool/C7000-CGT#downloads>`__ compiler
88+
- `Code Composer Studio <https://software-dl.ti.com/mcu-plus-sdk/esd/AM62DX/11_00_00_16/exports/docs/api_guide_am62dx/CCS_PROJECTS_PAGE.html>`__
89+
- `TI Clang Compiler Toolchain <https://www.ti.com/tool/download/ARM-CGT-CLANG>`__
90+
- CMake, GCC, make, git, scp, minicom
91+
- `rpmsg-dma library <https://github.com/TexasInstruments/rpmsg-dma/tree/scarthgap>`__
92+
93+
EVM Setup
94+
*********
95+
96+
#. Cable Connections
97+
98+
- The figure below shows some important cable connections, ports and switches.
99+
- Take note of the location of the "BOOTMODE" switch for SD card boot mode.
100+
101+
.. figure:: /images/AM62D_evm_setup.png
102+
:height: 600
103+
:width: 1000
104+
105+
#. Setup UART Terminal
106+
107+
- First identify the UART port as enumerated on the host machine.
108+
- Make sure that the EVM and UART cable are connected to the UART to USB port as shown in Cable Connections.
109+
- In Windows, you can use the "Device Manager" to see the detected UART ports:
110+
111+
- Search "Device Manager" in Windows Search Box in the Windows taskbar.
112+
113+
- If you do not see any USB serial ports listed in "Device Manager" under "Ports (COM & LPT)", then make sure you have installed the UART to USB driver from `FTDI <https://www.ftdichip.com/drivers>`__.
114+
- For A53 Linux console, select UART boot port (ex: COM34 in below screenshot), keep other options to default and set 115200 baud rate.
115+
116+
#. Setup SD card Boot Mode
117+
118+
- EVM SD card boot mode setting:
119+
120+
- BOOTMODE [ 8 : 15 ] (SW3) = 0100 0000
121+
- BOOTMODE [ 0 : 7 ] (SW2) = 1100 0010
122+
123+
Steps to Validate 2D FFT DSP Offload Demo
124+
******************************************
125+
126+
#. Flash an SD card with the :file:`tisdk-default-image-rt-am62dxx-evm.rootfs.wic.xz` image and follow the instructions provided at :ref:`Create SD Card <processor-sdk-linux-create-sd-card>` guide.
127+
128+
#. Insert the flashed SD card into the `AUDIO-AM62D-EVM <https://www.ti.com/tool/AUDIO-AM62D-EVM>`__ and power on the TI AUDIO-AM62D-EVM.
129+
130+
#. Make sure the EVM boot mode switches are positioned for SD card boot as described earlier.
131+
132+
#. Connect the USB-C cable from the power adapter to one of the two USB-C ports on the EVM.
133+
134+
#. The EVM should boot and the booting progress should display in the serial port console. At the end of booting, the Arago login prompt will appear. Just enter "root" to log in.
135+
136+
#. Run the 2D FFT DSP offload demo application from the console:
137+
138+
.. code-block:: console
139+
140+
root@am62dxx-evm:~# rpmsg_2dfft_example
141+
142+
#. The application will execute and display the results:
143+
144+
.. code-block:: console
145+
146+
RPMsg based 2D FFT Offload Example
147+
148+
*****************************************
149+
*****************************************
150+
151+
C7x 2DFFT Test PASSED
152+
C7x Load: 85%
153+
C7x Cycle Count: 1234567
154+
C7x DDR Throughput: 123.45 MB/s
155+
156+
*****************************************
157+
*****************************************
158+
159+
.. note::
160+
161+
The test will report "PASSED" if the computed 2D FFT output matches the expected results within tolerance (0.01), otherwise it will report "FAILED".
162+
163+
Demo Output Interpretation
164+
===========================
165+
166+
The demo provides the following performance metrics:
167+
168+
- **Test Result**: PASSED or FAILED based on output validation
169+
- **C7x Load**: DSP utilization percentage during FFT computation
170+
- **C7x Cycle Count**: Number of DSP cycles consumed for the operation
171+
- **C7x DDR Throughput**: Data transfer rate to/from DDR memory in MB/s
172+
173+
How to Build 2D FFT DSP Offload Demo
174+
*************************************
175+
176+
Building 2D FFT DSP Offload Image from Yocto
177+
=============================================
178+
179+
- To build the 2D FFT DSP offload image, refer :ref:`Processor SDK - Building the SDK with Yocto <building-the-sdk-with-yocto>`
180+
181+
Building the Linux Demo Binary from Sources
182+
============================================
183+
184+
#. The source code for the 2D FFT DSP offload demo is available as part of the `rpmsg-dma <https://github.com/TexasInstruments/rpmsg-dma/tree/scarthgap>`__.
185+
186+
.. code-block:: console
187+
188+
host# git clone https://github.com/TexasInstruments/rpmsg-dma.git -b scarthgap
189+
190+
#. Download and Install the AM62D Linux SDK from |__SDK_DOWNLOAD_URL__| following the steps mentioned at :ref:`Download and Install the SDK <download-and-install-sdk>`.
191+
192+
#. Prepare the environment for cross compilation.
193+
194+
.. code-block:: console
195+
196+
host# source <path to linux installer>/linux-devkit/environment-setup
197+
198+
#. Compile the source:
199+
200+
.. code-block:: console
201+
202+
[linux-devkit]:> cd <path to rpmsg-dma source>
203+
[linux-devkit]:> cmake -S . -B build; cmake --build build
204+
205+
- This will build:
206+
207+
- The example application :file:`rpmsg_2dfft_example`
208+
209+
- Transfer the generated files to SD card:
210+
211+
- The example binary :file:`rpmsg_2dfft_example` to :file:`/usr/bin`
212+
- The test input data file :file:`2dfft_input_data.bin` to :file:`/usr/share/2dfft_test_data/`
213+
- The expected output data file :file:`2dfft_expected_output_data.bin` to :file:`/usr/share/2dfft_test_data/`
214+
- The C7 DSP firmware file :file:`fft2d_linux_dsp_offload_example.c75ss0-0.release.strip.out` to :file:`/lib/firmware/`
215+
216+
- Optional:
217+
218+
- To build only the library or only the example, use:
219+
220+
.. code-block:: console
221+
222+
cmake -S . -B build -DBUILD_LIB=OFF # disables library build
223+
cmake -S . -B build -DBUILD_EXAMPLE=OFF # disables example build
224+
225+
Building the C7 Firmware from Sources
226+
======================================
227+
228+
- Refer to the `MCU+ SDK Documentation <https://software-dl.ti.com/mcu-plus-sdk/esd/AM62DX/latest/exports/docs/api_guide_am62dx/GETTING_STARTED_BUILD.html>`__
229+
- Refer to the `C7 2D FFT Demo Firmware <https://software-dl.ti.com/mcu-plus-sdk/esd/AM62DX/latest/exports/docs/api_guide_am62dx/EXAMPLES_DRIVERS_IPC_RPMESSAGE_LINUX_2DFFT_OFFLOAD.html>`__

source/linux/Demo_User_Guides/index_Demos.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The SDK supports the following Out-Of-Box demo-applications
1717
Display_Cluster_User_Guide
1818
TI_LVGL_Demo_User_Guide
1919
AM62D_Dsp_Offload_User_Guide.rst
20+
AM62D_2DFFT_User_Guide.rst
2021

2122
.. ifconfig:: CONFIG_sdk in ('j7_foundational')
2223

0 commit comments

Comments
 (0)