完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
你好!我开发了一个基于微芯片DSP库的DSPIC33 FJ128GP802的“信号分析器”,然后在图形模式下在ILI934 1显示中显示一个代码,代码工作得很好,最大FFT大小为1024个点(由于RAM限制)。N和频域同时没有问题,但是由于DSPIC33 EP512GP502的30个额外MIPS(和FLAS/RAM功能),我决定迁移代码没有成功,所有的例程都工作得很好,但是FFT没有。第一个问题是内存映射,编译器没有。允许像“空间(y存储器)”这样的AbbbTues或类似的EP设备投掷一个错误“不能分配…”(我不知道为什么),所以我手动地址:这样做没有地址陷阱中断和代码流没有问题,但不计算FFT使用相同的代码工作。DSPIC33 FJ类似:“SealAlxInDaDA”包含由time3 ADC采样的数据,在48 kHz触发,屏幕和调试总是显示17000赫兹,并且存储在FFT矢量的结果中的数据从未改变。有人知道为什么在FJ上同样的算法在EP中没有吗?我停止了发展,因为我不知道发生了什么。任何帮助都是非常有希望的。
以上来自于百度翻译 以下为原文 Hello comunity! I developed a "signal analyzer" on a dsPIC33FJ128GP802 based on Microchip dsp libraries for the spectrum, then I write a code for show data in a ILI9341 display in a graphical mode and the code works very well with a maximum FFT size of 1024 points (due to RAM limitation) this code shows time domain and frequency domain without problems at the same time, but due to the 30 extra MIPS (and flash/ram capabilities) of the dsPIC33EP512GP502, I decided to migrate the code without success, all the routines works very well but the FFT not. The first issue was the memory mapping, the compiler does not allow atribbutes like "space(ymemory)" or similar for EP devices throwing an error "could not allocate..." (I dont know why) so I address manually like : fractcomplex vector_complejo[Muestras_FFT] __attribute__((address(0x9000),far,aligned(Muestras_FFT*2*2))); fractcomplex twiddleFactors[Muestras_FFT/2] __attribute__((address(0x1000),near,aligned(Muestras_FFT*2))); Doing this there are not address trap interrupts and the code flows without problems but NOT calculate the FFT using the same code that works on dsPIC33FJ like: p_real = &vector_complejo[0].real ; //Inicializa puntero p_complejo = &vector_complejo[0]; //Inicializa puntero //===================SE MUEVE EL BUFFER DE ENTRADA AL VECTOR COMPLEJO=========== for ( i = 0; i < Muestras_FFT; i++ ) { vector_complejo.real = Senal_Entrada ; vector_complejo.imag = 0 ; } //==========================CALCULO DE LA FFT=========== FFTComplexIP (E_Mariposa, &vector_complejo[0], (fractcomplex *)&twiddleFactors[0],COEFFS_IN_DATA); BitReverseComplex (E_Mariposa, &vector_complejo[0]); SquareMagnitudeCplx(Muestras_FFT, &vector_complejo[0], &vector_complejo[0].real); "Senal_Entrada" contains the data sampled by timer3 ADC triggering at 48KHz, the screen and the debug always show 17000 Hz and the data stored in the result of the FFT vector never changes. Anyone have an idea why the same algorithm that works on FJ doesn't in EP? I stopped the develoment because I dont know what is happening. Any help will be very hopefull. |
|
相关推荐
19个回答
|
|
|
可能是对齐破坏了你的天。FractFieldVoCurth-CuleJo[MuStasasfFt],Apple(2)(地址(0x9000),远,对齐(MeStasiffF*×2×2));Fract络合物TWIDDLIVENTION[MUSTASASHFFT/1/2]α属性((地址(0x1000),接近,对齐(MeStasiffF** 2)));我不开始尝试对FIR进行对齐(4)。T和对齐(2)的第二项。(不确定,但“对齐(4096)”RESP。”对齐(2048)“对我来说没什么意义。”就是说,剩下的代码与你在FJ上的代码完全相同(没有进一步的“修改”)。
以上来自于百度翻译 以下为原文 Could be the alignment is ruining your day. fractcomplex vector_complejo[Muestras_FFT] __attribute__((address(0x9000),far,aligned(Muestras_FFT*2*2))); fractcomplex twiddleFactors[Muestras_FFT/2] __attribute__((address(0x1000),near,aligned(Muestras_FFT*2))); I't start trying out aligned(4) for the first and aligned(2) for the second term. (Not sure, but "aligned(4096)" resp. "aligned(2048)" makes little sense for me.) That is: provided the remainder of the code is really identical to what you had on the FJ (no further "adaptations"). |
|
|
|
|
|
我们在CPLXFFT32、S、RealFFT32 B文件中发现了一些潜在的错误。修复是用(W10,W11)交换(W8,W9)。
以上来自于百度翻译 以下为原文 We have found some potential bugs in the cplxFft32b.s, realFft32b.s files. The fix is swapping (W8,W9) with (W10,W11). |
|
|
|
|
|
你好,杜,谢谢你的AcWWRIN,实际上,根据微芯片的“TB3141”注释,对齐是正确的:“包含Flash因子的数组必须存储在RAM中的X内存中,或者存储在闪存程序存储器中的PSV部分中,并且包含输入数据/FFT结果的数组,它在函数中使用,FFTBoeIdFig()、BITRealSeCuMeCopyFe(和SaveRealDigCeMeCuffle())必须在Y内存中,并以字节大小排列成数组大小的倍数。“这意味着TWIDDLEVER不需要对齐,但它不起作用。我怎么办?”FFT-复合例程是隐藏的,我不知道如何,谢谢!我不明白为什么同样的代码在FJ上工作得很好(即使Twitdle是否对齐)设备,但在EP中没有。
以上来自于百度翻译 以下为原文 Hello Du, thank you for aswering, in effect the alignment is correct according with the "TB3141" Note from Microchip: "The array containing the twiddle factors must be either in X-memory in RAM or in a PSV section if stored in Flash program memory, and the array containing the input data/FFT result, which is used in functions, FFTComplexIP(), BitReverseComplex() and SquareMagnitudeComplex(), must be in Y-memory, and aligned to a multiple of the array size in bytes." which means that TwiddleFactors not need to be aligned but it does not work. How can I do that? The FFTComplex routines are hidden and I dont know how, thank you! I dont understand why the same code works perfectly on FJ (even if twiddles are aligned or not) devices but no in EP. |
|
|
|
|
|
在一些ASM文件(*.s)中,EP有不同的实现方式。例如:我们观察到,错误来自于这种类型的命令:W9必须位于X数据空间中,但是看起来数据是Y数据空间。所以我们将其改为W11:
以上来自于百度翻译 以下为原文 In some asm files(*.s), EP has different implementations. For example: .ifndef __dsPIC33E What we have observed, the error comes from this type of command: MPY W4*W7, B, [W9]+=2,W5 W9 has to be in X data space, but it seems the data is Y data space. So we changed it to W11: MPY W4*W7, B, [W11]+=2,W5 |
|
|
|
|
|
哦,SSEMS,我错过了dSPICs的有限的寻址能力。因此,您的寻址结果可能是好的。另外,我建议在较低的RAM区域(低于0x8000)有VECITRY-COMPEJOO[],这也可能解决这个问题。主要问题似乎是:库代码对于内存范围(远-近)是不灵活的,因此必须通过内存分配来匹配库的假设。
以上来自于百度翻译 以下为原文 Oops, ssems I missed the somewhat limited addressing capabilities of the dsPICs. So your findings about addressing might be ok. Otherweise I would have suggested to have vector_complejo[] in the lower RAM area (below 0x8000) - which might solve the issue as well. The main problem seems to be that the library code is inflexible regarding memory ranges (far vs. near), so you have to match the library's assumptions by your memory allocation. |
|
|
|
|
|
我存档了固定的汇编文件和编译的库(只用于DSPIC33)。你可以试试。http://Delo.谷歌.com……Ho2Di9BM8Er4SHWeU/VeWo是原来的POST(中文)。
以上来自于百度翻译 以下为原文 I archived the fixed assembly files and the compiled library (used for dsPIC33E only). You can give it a try. https://drive.google.com/...ho2Di9Bm8er4shWeU/view Here is the original post (in Chinese). http://www.microchip.com....ode=flat&order=ASC ++ fix hyperlink |
|
|
|
|
|
在一些ASM文件(*.s)中,EP有不同的实现方式。例如:我们观察到的错误来自于这种类型的命令:W9必须在X数据空间中,但看起来数据是Y数据空间。所以我们将其改为W11:谢谢您的建议,但是,我不能访问与DSP例程链接的汇编文件,您能解释一下如何吗?从我的代码中更改吗?我在XC16文件夹中搜索任何DSP文件。但是不存在,并且我不使用汇编程序,所以对我来说很难。这是不允许的,因为双数据获取需要在0x9000开始的Y内存中的复数向量。
以上来自于百度翻译 以下为原文 In some asm files(*.s), EP has different implementations. For example: .ifndef __dsPIC33E What we have observed, the error comes from this type of command: MPY W4*W7, B, [W9]+=2,W5 W9 has to be in X data space, but it seems the data is Y data space. So we changed it to W11: MPY W4*W7, B, [W11]+=2,W5 Thank you for advice, but, Im unable to get access to the assembler files linked with the DSP routines, Can you explain me how to make that change from my code? I was searching in the xc16 folder for any DSP file .s but does not exist and I dont use assembler so its hard to me. This is not allowed due to the dual data fetch that needs the complex vector in Y memory which begins at 0x9000. |
|
|
|
|
|
原始源代码在XC16文件夹XC16V1.XXSRCLIbdSP.Zip中。
以上来自于百度翻译 以下为原文 The original source is in the XC16 folder, xc16v1.xxsrclibdsp.zip |
|
|
|
|
|
Timijk,我在阅读中文原论坛,你说从我在文件夹SRCLIbdSP.Zip中找到的.BAT文件重建库是必要的,但是我真的很困惑,我用一个文件夹下载了LIb33 E.Zip文件:“ASM和LIB .3e”。这个项目?我尝试将库路径设置为文件夹LIb33 e,并从项目文件夹中替换DSP精灵和COFF,但它不起作用,总是在屏幕上显示相同的频率。谢谢您的答复。
以上来自于百度翻译 以下为原文 timijk, Im reading the original forum in chinese and You said that is necessary to rebuild the library from the .bat file which I found on the folder srclibdsp.zip but Im really confused, I downloaded the file lib33e.zip with a folders: "asm and lib.33e". How can I integrate this modified library to the project? I tried to set the library path to the folder lib33e and replace the dsp elf and coff from the project folder but it does not work, always the same frequency on the screen. Thank you for your replies. |
|
|
|
|
|
归档文件只包含修复程序。原来的文件在XC16文件夹中。我不太清楚到底出了什么问题…我用演示项目做了测试,发现了模拟器中的问题。另一个人(谁发起了这个职位)做了他自己的测试。也许你可以仔细检查你的信号和数据的设置。看看你是否能在模拟器中调试它。顺便说一下,我不太记得细节。数据点的数量似乎有限制。你使用多少个数据点?
以上来自于百度翻译 以下为原文 The archived file only includes the fixes. The original files are in the XC16 folder. I am not quite sure what went wrong... I did my tests with demo projects and found the issues in the simulator. The other guy (who initiated the post) did his own tests. Maybe you can double check your setup for the signal data and those twiddleFactors. See if you can debug it in the simulator. By the way, I don't quite remember the details... there seems a limitation on the number of the data points. How many data points are you using? |
|
|
|
|
|
IM使用512到1024点,迁移到EP的2048点(如果可能的话),我想知道正确的步骤,以修正图书馆与修改后的文件,你给我看,你能帮助我一个小步骤教程?我需要下载C30和重建吗?或者我能做什么?我不想失去与FJ的兼容性,还是我应该投降?我从中国论坛(谷歌翻译)了解了一点。谢谢您。
以上来自于百度翻译 以下为原文 Im using 512 to 1024 points and the migration to EP for 2048 points (if possible), I want to know the correct steps to follow in order to fix the library with the modified files that you show me, can you help me with a little step tutorial?, I need to download C30 and rebuild? or what I can do? I dont want to lose the compatibility with FJ, or I should surrender? I understand a little bit from the chinese forum (with google translator). Thank you. |
|
|
|
|
|
我尝试了C30评估版本与优化-O3。(这似乎是旧的设置),我在XC16V1.33中检查了新的,它在批处理文件(MaxdSPLiB.BAT)中使用XC16GCC。在解压缩LIbDSP之后,在SRC内部,有另一个源代码的ZIP文件。您可以查看DSP库文件(在DOCS文件夹中),看看如何构建它。我的经验是C30…你应该能够用XC16GCC来做它。我想,首先,你必须运行“命令提示符”作为管理员,并创建一个Obj-文件夹(在LIbDSP下),并在LIB文件夹中备份*.file(如果你想要的话)。然后运行MaxdSPLBI.BAT文件,当然,您必须为XC16 GCC、XC16设置EXE文件的路径。这是非常简单的,它可以在Windows环境下完成。
以上来自于百度翻译 以下为原文 I tried it with C30 evaluation version with optimization -O3. (that seems the old setup), I checked the new one in XC16 v1.33, it's using xc16-gcc in the batch file(makedsplib.bat). After you unzip the libdsp, and inside src, there is another zip file for the source codes. You can take a look at the DSP Library file ( in the docs folder) to see how to build it. My experience is with C30... you should be able to do it with xc16-gcc. I think at first, you have to Run "Command Prompt" as administrator, and create an obj folder (under libdsp), and backup the *.a file in the lib folder(if you want). Then run the makedsplib.bat file, of course, you have to setup the path for those xc16-gcc, xc16-as exe files. It's very straightforward, it can be done in Windows environment. |
|
|
|
|
|
我检查了我的测试项目,我使用了OnLyFrTRAL32 BIp和StimuldCopx32 BIP来获得结果。它与你的不同,你使用的是复杂向量。我没有用复杂的输入向量测试我的修复。也许在其他*.s文件中还有一些其他问题。我不知道你是否可以用更少的数据点运行一个简单的测试,看看它是否可以在模拟器中运行。我用DSPIC33 EP512GP502测试我的项目,它运行正常,除了我必须改变LySeCype(y存储器)来处理(0x9000)。在TB3141中,对于某些模型,y存储器高于0x7FFF,使用“空间(y存储器),EDS”+++ + i正在思考,如果我们不修复(W8,W9)问题,那么如果我们将源向量(SRCV)放在XMeLoad中,代码仍然可以工作。因为编写DSPIC33的代码的开发人员一定已经做了一些测试,从汇编代码中,对于DSPIC33 E,源向量放在XMeLoad中…
以上来自于百度翻译 以下为原文 I checked my testing project, I was using only FFTReal32bIP and MagnitudeCplx32bIP to get the result. It's different to yours, you are using complex vectors. I didn't test my fix with complex input vectors. Maybe there are some other issues in the other *.s files. I don't know if you can run a simple test with fewer data points and see if it can go through in the simulator. I test my project with dsPIC33EP512GP502, it runs OK, except that I have to change space(ymemory) to address(0x9000) due to the linker errata. ++ in TB3141, for some models, ymemory is above 0x7FFF, using "space(ymemory),eds" +++ I was thinking, if we don't fix the (W8,W9) issues, maybe the code can still work if we place the source vector (srcV) in xmemory. Because the developer who wrote the code for dsPIC33E must have done some testing, from the assembly code, for dsPIC33E, the source vector is placed in xmemory... |
|
|
|
|
|
你好,Timijk,我试图把源向量放在XMeLoad上,正如我所预期的,地址陷阱在中间跳跃。我认为修复它的唯一方法是重建库,我根本不知道怎么做。为了澄清,我不使用FFTRAL32 BIp或Suffuto EXPLX32 BIp,只使用FFT和FrutSimple的FFTBoiFig(16位我猜想)
以上来自于百度翻译 以下为原文 Hello timijk, I was trying to put the source vector on xmemory and as I expected, the address trap jumps inmediately. I think that the only way to fix it is remaking the library, and I dont know how to do it at all. For clarifying, I dont use the FFTReal32bIP or MagnitudeCplx32bIP, only the FFTComplexIP for FFT and SquareMagnitude (16 bit I suppose) |
|
|
|
|
|
您好,现在我很确定,FFT功能正在使用FFTComplexIP的EP设备,但SquareMagnitudeCmplx不是!我用一个SMAL FFT进行调试,一步一步地在硬件中直接使用ICD3,所有的步骤都是OK,FFT函数返回ADC样本上的每个计算的不同值,所以我假设工作正常,但是即使在复杂的V中,方形幅度总是返回相同的结果。如果加载了不同的值,这是一个进步。如果我手工计算平方大小:结果是相同的,并且调试,我注意到所有的访问复向量,返回总是相同的值,如test=vcEcth-CuleEJO(1),不管VECTO是否R具有不同的值测试总是相同的,但在可变窗口中,复数向量根据ADC样本计算改变值。这有点奇怪。
以上来自于百度翻译 以下为原文 Hello, now Im pretty sure that the FFT function is working on the EP device with FFTComplexIP, but SquareMagnitudeCmplx not! I was debugging with a smal FFT and step by step with ICD3 direct in hardware and all the steps are developing ok, the FFT Function returns diferent values for each computation on the ADC samples so I assume that is working ok, but SquareMagnitude always return the same result even if the complex vector is loaded with diferent values, always return the same, this is an advance. If I compute the SquareMagnitude manually like: for (i = 0; i < Muestras_FFT/2; i++) { SquareMagnitude = 2*((vector_complejo.real^2) + (vector_complejo.imag^2)); } The result is the same, and debugging, I noticed that all access to the complex vector, return always the same value, like Test = vector_complejo[1], no matter if the vector have diferent values Test is always the same but in the variable window, the complex vector changes the values according with the ADC samples computation. This is a lot strange. |
|
|
|
|
|
在HTTP://www. McCux.com……/ FindPost / 776110中提到的另一个bug可能是相关的。在CPLXQRMAG.S中,更改为++似乎不解决问题。得钻进去…
以上来自于百度翻译 以下为原文 There is another bug mentioned in http://www.microchip.com/.../FindPost/776110 that might be related. In cplxsqrmag.s, .ifdef __dsPIC33E push DSRPAG movpag #0x0001, DSRPAG .endif .... .ifdef __dsPIC33E pop DSRPAG .endif changed to .ifdef __dsPIC33E push DSRPAG push DSWPAG movpag #0x0001, DSRPAG movpag #0x0001, DSWPAG .endif .... .ifdef __dsPIC33E pop DSWPAG pop DSRPAG .endif ++ It seems it doesn't fix the problem... got to dig into it... |
|
|
|
|
|
关于FrimeScRealSuffEdCPLX(),我尝试为Destv使用一个不同的数组,原始代码工作在模拟器中。
以上来自于百度翻译 以下为原文 Regarding the function SquareMagnitudeCplx(), I tried to use a different array for the destV, the original code works (in the simulator). |
|
|
|
|
|
你必须把它乘以2吗?汇编代码中的定义ISDSTV[n]=Real[SRCV[n])^ 2 +IMAG(SRCV[n])^ 2…我做了更多的测试,原始代码,SquareMagnitudeCplx(MeStasiffFFT,and VoTrasiFixEJO(0),and VoTrasiFixEJO(0).Real);看起来不错。我不知道为什么它在我之前的测试中不起作用。
以上来自于百度翻译 以下为原文 Do you have to multiply it by 2? The definition in the assembly code is dstV[n] = Real(srcV[n])^2 + Imag(srcV[n])^2 ... I did some more testing, the original code, SquareMagnitudeCplx(Muestras_FFT, &vector_complejo[0], &vector_complejo[0].real); looks OK. I am not sure why it did not work in my previous test. |
|
|
|
|
|
这就像一个魅力!在前面的考虑中,FFT根据硬件ADC采样直接显示了相干和可变值,现在我需要校准时间和采样频率,因为有错误的测量,但是它正在工作!非常感谢你!
以上来自于百度翻译 以下为原文 Thats worked like a charm! with the previous consideration now the FFT shows me coherent and variant values depending of the ADC samples directy in hardware, now I need to calibrate the times and sample frequency because there is a wrong measure but it is working! Thank you very much! |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1122浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1095浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 00:14 , Processed in 1.186679 second(s), Total 108, Slave 91 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2182