完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我使用PIC32 MZ2048 EFH100,如标题所示,当我包含DSP库并构建项目时,我得到了错误:例如,以前定义的“Mul16”是Entestic内联的In16-t Mul16(In16-t a,in 1616 T b),还有错误,例如:Microchip xC32 v1.42Pic3Mx\dSPLBYSPDSP.H:67∶3:错误:“因特32 C”}因式32的冲突类型;使用“静态内联”属性的函数似乎有“多重定义”问题,我发现在DSP .h和dSpBiffDe.h中定义了相同的函数。在包含DSP库之后,是否需要对DSP头文件进行一些编辑,或者是在默认情况下编译和构建没有错误的项目?任何帮助都将非常感谢!
以上来自于百度翻译 以下为原文 I use a PIC32MZ2048EFH100 and as the heading suggests, when I include the DSP library and build the project I get errors such as : previous definition of 'mul16' was here static inline int16_t mul16(int16_t a, int16_t b) and also errors such as : microchipxc32v1.42pic32mxincludedsplib_dsp.h:67:3 : error: conflicting types for 'int32c' } int32c; There seems to be "multiple definition" problem with functions using "static inline" property , i found the same functions to be defined in dsp.h and dsplib_def.h . Is there some editing I must do to the DSP header files after including the DSP library or is the project supposed to compile and build fine without errors on default ? Any help would be very much appreciated! |
|
相关推荐
10个回答
|
|
你好,从一点点信息,我想我可以看到你做了什么。让我支持你一点。MPLAB和谐中的DSP库旨在支持PIC32 MZ中的定点DSP扩展。这个库是围绕这个(在程序集)构建的,因此不支持PIC32 MX。我相信您已经发现有一个PX32 MX库,它可以通过XC32编译器获得。这是可行的,并且具有通用PIC32指令集的汇编。从技术上讲,这将与任何PIC32(包括MX和MZ)一起工作,尽管它有点慢,而且支持的指令也少很多。因此,我相信您所做的是包含了通用函数的DSP功能(*.h和库*.a),但同时也从MHC中选择了DSP库。当您从MHC选择库时,它将自动加载MZ版本的头(DSP.H)和库。如果你正在使用MX设备,我建议你可以选择使用这些库函数,但是关闭MHC中的DSP库选项。
以上来自于百度翻译 以下为原文 Hello, From the little bit of information, I think I can see what you did. Let me back you up a little bit. The DSP library in MPLAB Harmony is intended for use to support the fixed point DSP extensions in PIC32 MZ. The library was built around this (in assembly) and thus will not support PIC32 MX. I believe you have found that there is a PIC32 MX library that is available through the XC32 compiler. This does work, and has assembly that is for the general PIC32 instruction set. Technically this will work with any PIC32 (including MX and MZ), although it is a bit slower and has many fewer supported instructions. So what I believe you did was included the DSP functions (*.h and library *.a) for the generic function, but then also selected the DSP library from MHC. When you select the library from MHC, it will automatically load the MZ version of the header (dsp.h) and the library. These will then be in conflict. If you are using an MX device, I would suggest that you may opt to use these library functions but turn off the DSP library option in MHC. |
|
|
|
谢谢你指出了迈克。这是一个现有的项目,它似乎有一个DSP库包,它是指已经。
以上来自于百度翻译 以下为原文 Thank you for pointing that out Mike . It was an existing project and it does seem to have a dsp library package it is referring to already. |
|
|
|
只是一个更新,因为它是一个已经存在的项目,它包含了一个“App.c”文件中的“FFTC.H”文件。评论包括现在和现在包括来自协调器的DSP库似乎已经修复了构建错误。现在只需要测试项目是否有效!
以上来自于百度翻译 以下为原文 Just an update, since it was an existing project it had an "fftc.h" file included in "app.c" file. Commenting that include out and now including the DSP library from the harmony configurator seems to have fixed the build errors. Now just need to test if the project works! |
|
|
|
如果您正在使用FFT功能,请注意,和声DSP版本的设置(只与PIC32 MZ一起工作)不同于原来的版本。您可以在Orthor文档或DSP .h文件中找到安装函数示例,其中嵌入了一些代码示例。
以上来自于百度翻译 以下为原文 If you are using the FFT function, please be aware that the setup for the Harmony DSP version (which works with PIC32 MZ only) is different than the original. You can find the setup function example in the harmony documentation or in the dsp.h file, where there are some code samples embedded. |
|
|
|
嘿,迈克,谢谢你的小费。我尝试过这个例子,我相信我得到了错误的FFT计算,我丢失了一些东西。基本上,我正在尝试一种频谱分析仪,它返回在采样的输入信号中存在的信号中具有最高振幅的信号的频率。下面是我遵循的步骤:1)采用N个ADC读数(n=1024)正弦波(10kHz和3V3峰到峰值)。正弦波被赋予DC偏移,使得整个正弦波处于正范围。ADC采样在66kHz的正弦波(通过在每个连续采样之间引入适当的延迟)。ADC输入方式为单端单极,触发源为全局软件边缘。2)采集到的1024个ADC采样阵列存储在“It32 C采样缓冲器[N]”中。其中n=1024。这个数组的虚数部分都是零。3)调用“dSPTA FFT TFT32设置(TWIDDLE,Log2n)”函数生成具有Log2n=10(2 ^ LogBAS2 10=1024)的旋转因子。再次,变量tWIDLE是“It32 C TwitdLes [n]”类型(问题:每个样本是2个旋转因子吗?一个为真实的,一个为虚构的部分)4,然后我调用“dSP.TrimeFFT32(DUT,sampleBuffer,TWIDDLE,DRAIL,Log2N)”。这就产生了“dUT”中的FFT。5)现在我必须找到最大振幅的频率。因此,我计算了实部和虚部的平方和的根,并乘以2,这应该把信号合并成一个单一的振幅。这个单振幅数据被存储在SUNLISDIDEFFT [N]中。Eg:SunListIdFFT=2×SqRT((Do.R*Dut.Re)+(dou.im*dOut.im));6)称为“DSPVECVATEMAX 32(SUNLISDIDEFFT,N/2))以获得给定数组中的最大值。7)最后尝试通过将该值与采样频率相乘并将其与Num除以计算信号频率;BER的样本如下所示:PeaQueNekYBIN=DSPVIVECTMAX32(SUNLISDIDEFFT,N/2);峰频率=PeaKuffCycNyBin *(666666/N);用上述方法,“PeaQueNekYBIN”值大致相同,即使我将频率从10kHz改变到100kHZIm,仍然试图找出HAV在何处。出了错,错过了什么。我在处理FFT方面没有太多的经验,所以非常感谢。
以上来自于百度翻译 以下为原文 Hey Mike, Thanks for the tip. I did try the example, I believe I am getting the wrong FFT computation and am missing something. Basically I am trying to implement a spectrum analyser that returns the frequency of a signal with the highest amplitude among signals present in the sampled input signal. Here are the steps i followed: 1) Took N ADC readings (N = 1024) of a sine wave (10kHz and 3v3 peak to peak). The sine wave was given a DC offset so that the entire sine wave was in the positive range. The ADC sampled the sine wave at 666kHz (by introducing appropriate delay between each successive sampling) . The ADC input mode is SINGLE ENDED UNIPOLAR and the trigger source is GLOBAL SOFTWARE EDGE. 2) The acquired array of 1024 ADC samples was stored in "int32c sampleBuffer[N]" . Where N = 1024 . The imaginary portion of this array is all zeroes. 3) The "DSP_TransformFFT32_setup(twiddles, log2N)" function was called to generate the twiddle factors with log2N = 10 (since 2^Logbase2 10 = 1024) . Again the variable twiddles is of type "int32c twiddles[N]" ( question: is it 2 twiddle factor per sample ? one for the real and one for the imaginary part ) 4) I then followed by calling "DSP_TransformFFT32(dout, sampleBuffer, twiddles, scratch, log2N)" . This generated the FFT in "dout". 5) Now I had to find the frequency with the maximum amplitude. So I calculated the root of the sum of squares of the real and imaginary parts and multiplied it by 2 , this was supposed to combined the signal to a single amplitude. This single amplitude data was stored in singleSidedFFT[N] . Eg: singleSidedFFT = 2 * sqrt((dout.re*dout.re) + (dout.im*dout.im)); 6)Called the "DSP_VectorMax32( singleSidedFFT, N/2 )" to get the maximum value in the given array. 7) Finally tried to calculate the signal frequency by multiplying this value with the sampling frequency and dividing it with the number of samples as shown below: peakFrequencyBin = DSP_VectorMax32( singleSidedFFT, N/2 ); peakFrequency = peakFrequencyBin*(666666/N); With the above approach the "peakFrequencyBin" Value is roughly the same even if I change frequencies from 10kHz to a 100kHz I am still trying to figure out where I have gone wrong and what is missing. I do not have much experience in dealing with FFT so any help is very much appreciated. |
|
|
|
只是一个更新:我已经设法让FFT工作:(只是一些注释:1)我已经把DC偏移量给予ADC,确保你忽略FFT后的DOUT的第一个数组值,因为这是DC信号的值,否则检测到的最大频率总是为零)确保使用浮点VAR。可以保持DUT数组的实数和虚项的平方值,因此不存在溢出。(参考先前的步骤的响应)3)使用最大频率来计算频率平方指数,其中检测平方之后的最大值。因此公式是=(最大频率bin指数*采样频率)/采样数,希望这有助于任何人尝试使用FPT羽毛在PIC32 MZ系列。干杯!
以上来自于百度翻译 以下为原文 Just an Update: I have managed to get the FFT working :) Just a few notes: 1) I had given the dc offset to the adc , make sure you ignore the first array value of the dout after FFT as this is the value of the DC signal, else your max frequency detected will always be zero 2) make sure to use float variable to hold the value of the squares of the real and imaginary terms of the dout array so there is no overflow. ( refer previous reponse for steps) 3) Max frequency is used calculating the frequency bin index where the max value after squaring was detected. therefore the formula is = (Maxfrequency bin index * sample frequency) / number of samples Hope this helps anyone trying to use the FFT feather in pic32mz series. Cheers! |
|
|
|
嗨,Zyxmn,我有一个非常相似的问题。我使用的是PIC32 MZ2048 EFH144,带有XC32 1.42编译器。我正尝试使用nSP=TrpFFT16(…)在N=1024的一个IM16C阵列上执行FFT,并且在示例中描述了所有的设置(Log2n、Drace/TWIDLE复杂数组、运行DSPTHEXPROFFT1616Stand(…)等)。我已经做了一段时间了,现在仍然无法工作。你介意把你的工作代码发布吗?提前感谢!
以上来自于百度翻译 以下为原文 Hi Zyxmn, I have a very similar problem. I'm using a PIC32MZ2048EFH144, with the XC32 1.42 compiler. I'm trying to perform a FFT on a int16c array of N = 1024 using DSP_TransformFFT16(...), and have set everything up as described in the examples(log2N, scratch/twiddles complex arrays, running DSP_TransformFFT16_setup(...), etc.). I've been working on this for a while now and still cannot get it working. Do you mind posting your working code? Thanks in advance! |
|
|
|
什么版本的MPLAB和谐,以及你使用的编译器版本是什么?
以上来自于百度翻译 以下为原文 What version of MPLAB Harmony, and what version of the compiler are you using? |
|
|
|
和声1.09和XC32 1.42。我没有看到任何错误,它运行并输出一个复杂的数组,但是真正的值都是0、1和2s。如果我在Matlab中通过FFT运行数据,结果是非常不同的。
以上来自于百度翻译 以下为原文 Harmony 1.09, and XC32 1.42. I don't see any errors, it runs and outputs a complex array, but the real values are all 0s, 1s, and 2s. If I run the data through fft in MATLAB the results are very different. |
|
|
|
更新:我工作了。我给FFT的数据只使用了大约6位。我把它放大到使用所有16位,FFT输出显示了类似于我在MATLAB中原型的结果。
以上来自于百度翻译 以下为原文 Update: I got it working. The data I fed to the FFT was only using about 6 bits. I scaled it up to use all 16 bits and the FFT output showed results similar to what I had prototyped in MATLAB. |
|
|
|
只有小组成员才能发言,加入小组>>
5181 浏览 9 评论
2004 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3177 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
738浏览 1评论
622浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
509浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
636浏览 0评论
533浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 09:35 , Processed in 1.588274 second(s), Total 94, Slave 78 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号