You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge in MCU16CE/dspic33e-code-examples from develop to master
* commit '7b773db5009bab64395d9bdf7e51a42dd7ea358c':
MCU16GITHUB-1278 - Updated version number in changelog
MCU16GITHUB-1278 - Update main.json with version number
MCU16GITHUB-1278 - Updated readme, main.json and changelog
MCU16GITHUB-1278 - FFT Twid factor corrected.
MCU16GITHUB-1278 - FFT peakFrequency calculation corrected.
updated jenkinsfile
@@ -10,42 +10,108 @@ Multiply-accumulate (MAC) type instructions and the ability to store and retriev
10
10
11
11
Microchip provides a DSP functions library that provides in-place FFT functions.
12
12
13
-
In this code example, we demonstrate how the DSP library functions can be used to perform an FFT on an input signal (vector). The code example is
14
-
reconfigurable to perfrom an FFT of any size, including common sizes of 64, 128, 256 and 512 points. The code example also allows the user to place
13
+
This code example demonstrates how the DSP library functions can be used to perform an FFT operation on an input signal (vector) and find the spectral component with the highest energy.
14
+
15
+
## Configuration
16
+
17
+
### Reconfiguring the project for a different dsPIC33E device:
18
+
19
+
The Project can be easily reconfigured for dspic33ep512gm710/dspic33ep512mu810/dspic33ep256gp506 device by following the below steps -
20
+
1. Open project in MPLAB-X.
21
+
2. In MPLAB X>>Configuration drop-down option>>Listed Device Configuration
22
+
3. Re-build the MPLAB® project using the menu option: Clean and Build Main Project
23
+
24
+
### Reconfiguring the project for a different FFT Size:
25
+
26
+
The code example is reconfigurable to perfrom an FFT of any size, including common sizes of 64, 128, 256 and 512 points. The code example also allows the user to place
15
27
the FFT coefficients (known as Twiddle Factors) in RAM or in Program Flash Memory. The project may be easily reconfigured by modifying the header
16
-
file, FFT.h. By default, the example implements a 256-point FFT using coefficients stored in Program Flash memory.
28
+
file, [fft.h](firmware/src/fft.h).
29
+
- Change `FFT_BLOCK_LENGTH` to either 64, 128, 256 or 512
30
+
- Correspondingly, change `LOG2_BLOCK_LENGTH` to either 6, 7, 8 or 9 respectively.
31
+
- If you would like to store Twiddle Factors coefficients in RAM instead of Program Memory comment out the line - `#define FFTTWIDCOEFFS_IN_PROGMEM`
17
32
18
-
The input signal for our example will be 256 points of a Square wave signal of frequency 1KHz sampled at 10 KHz. This signal was first generated by
19
-
dsPICworks and then exported as an assembler file from dsPICworks. After exporting it out, the assembler file was modified to ensure the samples
20
-
reside in Y-data space.
33
+
## Operation
21
34
22
-
The FFT operation is performed on the input signal, in-place. This means that the output of the FFT resides in the same RAM locations where the
23
-
input signal used to reside. The FFT is performed in the following steps:
35
+
The FFT is performed in the following steps:
36
+
37
+
1. Initialization:
38
+
39
+
i. Generate Twiddle Factor Coefficients and store them in X-RAM. The twiddle factors can be generated using the following function:
0 commit comments