Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

dsPIC30F6014A Demo Code error

Status
Not open for further replies.

digiad

Newbie level 5
Joined
Apr 6, 2014
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
117
Hi all,

I am using Microchip's dsPIC30F6014A for speech recognition. I am trying to implement speech recognition without using dsPIC demo board. I compiled demo code given by microchip website on MPLAB IDE. However build is failed due to the error like

SR_Lib.h:81: error: conflicting types for 'WREG0'
c:/program files/microchip/mplab c30/bin/bin/../../support/dsPIC30F/h/p30f6014.h:65: error: previous declaration of 'WREG0' was here
same error is valid also for WREG1 and WREG2
Why I am getting such type of error ? Have you experienced such error while you are compiling the same demo code on MPLAB IDE?

I thought that since it is the demo code given by the microchip company itself, normally there should not be any error while compiling. Do you agree with that?

Thanks in advance.
 

I am using Microchip's dsPIC30F6014A for speech recognition. I am trying to implement speech recognition without using dsPIC demo board. I compiled demo code given by microchip website on MPLAB IDE. However build is failed due to the error like

SR_Lib.h:81: error: conflicting types for 'WREG0'
c:/program files/microchip/mplab c30/bin/bin/../../support/dsPIC30F/h/p30f6014.h:65: error: previous declaration of 'WREG0' was here
same error is valid also for WREG1 and WREG2
Why I am getting such type of error ? Have you experienced such error while you are compiling the same demo code on MPLAB IDE?

The error you've posted indicates the compiler has found duplicate definitions of the symbols: WREG0, WREG1, WREG2.

Have you modified the demo code in anyway? Included additional header files?

What compiler are you utilizing in your attempting to compile the demo code, C30?

Which development board and demo code are you referring to?

Either post a link from which this demo code can be downloaded or upload it in it's original state, so that we may compile the code.



I thought that since it is the demo code given by the microchip company itself, normally there should not be any error while compiling. Do you agree with that?

Typically such errors indicate the compiler/IDE was either improperly configured or the code was modified in such a way to produce a duplicate definition.


BigDog
 

I am using C30 as the compiler. I have downloaded a demo code called ASR_Demo from Microchip website and I have not modified the code in anyway. You can download the demo from this link

https://ww1.microchip.com/downloads/en/DeviceDoc/SW300010_EVAL_dsPIC%20DSC%20Speech%20Recognition%20Lib.zip

You need to run SRLinst.exe file in this file

dsPICDEM 1.1 Evaluation board is the development board I am referring to. I do not have this development board. I only have dsPIC30F6014A and Si3000 Audio Codec.
 

The ASR_Demo compiles fine.

The following assumes you open the ASR_Demo.mcp project file within MPLAB.

You must perform the following steps before attempting to compile the ASR_Demo:

1. Open the Project Build Options, Project->Build Options...->Project, go to Directories Tab,

2. Show directories for: "Include Search Path", Clear any exist paths and click new and add the directory path containing the device specific header file, "p30f6014.h" and the library header file, "SR_Lib.h"

3. Show directories for: "Library Search Path", Clear any exist paths and click new and add the directory path containing the library file, "SR_Lib.a"

Most of these steps are outlined in the included Readme.txt.

Once the correct paths are entered and the project saved, the project window should not contain any "(not found)" along side any of the project files.

Compile the project, there maybe a few warnings concerning use of deprecated section flags, etc. however the project will compile successfully.

----------------------------------------------------------------------
Debug build of project `C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\ASR_Demo.mcp' started.
Language tool versions: pic30-as.exe v3.31, pic30-gcc.exe v3.31, pic30-ld.exe v3.31, pic30-ar.exe v3.31
Preprocessor symbol `__DEBUG' is defined.
Wed Apr 23 18:28:19 2014
----------------------------------------------------------------------
Make: The target "C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\SR_demo.o" is out of date.
Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F6014 -x c -c "SR_demo.c" -o"SR_demo.o" -I"C:\Program Files\Microchip\MPLAB C30\support\dsPIC30F\h" -D__DEBUG -g
Make: The target "C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\SR_config.o" is out of date.
Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F6014 -x c -c "SR_config.c" -o"SR_config.o" -I"C:\Program Files\Microchip\MPLAB C30\support\dsPIC30F\h" -D__DEBUG -g
Make: The target "C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\SR_demo_Utils.o" is out of date.
Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F6014 -c -I"C:\Program Files\Microchip\MPLAB C30\support\dsPIC30F\h" -D__DEBUG "SR_demo_Utils.s" -o"SR_demo_Utils.o" -Wa,--defsym=__DEBUG=1,-g
SR_demo_Utils.s: Assembler messages:
SR_demo_Utils.s:44: Warning: Quoted section flags are deprecated, use attributes instead
SR_demo_Utils.s:44: Warning: Implied attributes for section '.nbss' are deprecated
SR_demo_Utils.s:47: Warning: Implied attributes for section '.ydata' are deprecated
Make: The target "C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\demo\demoLib_int.o" is out of date.
Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F6014 -c -I"C:\Program Files\Microchip\MPLAB C30\support\dsPIC30F\h" -D__DEBUG "demoLib_int.s" -o"demoLib_int.o" -Wa,--defsym=__DEBUG=1,-g
demoLib_int.s: Assembler messages:
demoLib_int.s:69: Warning: Quoted section flags are deprecated, use attributes instead
demoLib_int.s:350: Warning: Quoted section flags are deprecated, use attributes instead
demoLib_int.s:1004: Warning: Quoted section flags are deprecated, use attributes instead
Make: The target "C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\demo\demoLib_voc.o" is out of date.
Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F6014 -c -I"C:\Program Files\Microchip\MPLAB C30\support\dsPIC30F\h" -D__DEBUG "demoLib_voc.s" -o"demoLib_voc.o" -Wa,--defsym=__DEBUG=1,-g
demoLib_voc.s: Assembler messages:
demoLib_voc.s:37: Warning: Quoted section flags are deprecated, use attributes instead
Make: The target "C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\ASR_Demo.cof" is out of date.
Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F6014 "SR_demo.o" "SR_config.o" "SR_demo_Utils.o" "demo\demoLib_int.o" "demo\demoLib_voc.o" "C:\Program Files\Microchip\MPLAB C30\lib\SR_Lib.a" -o"ASR_Demo.cof" -Wl,--script="..\..\support\dsPIC30F\gld\p30F6014.gld",--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1
Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-bin2hex.exe" "C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\ASR_Demo.cof"
Loaded C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\ASR_Demo.cof.
----------------------------------------------------------------------
Debug build of project `C:\Program Files\Microchip\MPLAB C30\examples\ASR_Demo\ASR_Demo.mcp' succeeded.
Language tool versions: pic30-as.exe v3.31, pic30-gcc.exe v3.31, pic30-ld.exe v3.31, pic30-ar.exe v3.31
Preprocessor symbol `__DEBUG' is defined.
Wed Apr 23 18:28:38 2014
----------------------------------------------------------------------
BUILD SUCCEEDED


I also loaded and executed the code on a dsPICDEM 1.1 (DM300014) Board with the required 6.144MHz crystal oscillator without any issues.

The demo is originally configured for the dsPICDEM 1.1 Board which has a dsPIC30f6014 as the default PIM.

The newer dsPICDEM 1.1 Plus Board which I also have has the dsPIC30f6014A as the default PIM.

The demo code can be modified/configured for the dsPIC30f6014A, which I have also done.

You'll need to make several changes, the linker file, the device specific header file, the device specific INC file, configuration register settings, etc.


BigDog
 
  • Like
Reactions: digiad

    digiad

    Points: 2
    Helpful Answer Positive Rating
It worked, thank you bigdogguru
 

Thank you for your help. We have compiled the demo code on MPLAB IDE C30. Now, our new and main purpose is to make one of the output pin high whenever we recognized the some certain words that we set before like "yes" or "no". We make use of the example code given in dsPIC30F Speech Recognition Library user manual. We build our own word library which includes words such as "yes", "no". Then we tried to compile the code again in MPLAB IDE. We carefully followed your instructions also for this code but we have again the same error expressed in the first post we sent

SR_Lib.h:80: error: conflicting type qualifiers for 'WREG0'
C:/Program Files/Microchip/MPLAB C30/support/dsPIC30F/h/p30f6014A.h:50: error: previous declaration of 'WREG0' was here
SR_Lib.h:81: error: conflicting type qualifiers for 'WREG1'
C:/Program Files/Microchip/MPLAB C30/support/dsPIC30F/h/p30f6014A.h:51: error: previous declaration of 'WREG1' was here
SR_Lib.h:82: error: conflicting type qualifiers for 'WREG2'
C:/Program Files/Microchip/MPLAB C30/support/dsPIC30F/h/p30f6014A.h:52: error: previous declaration of 'WREG2' was here

We thought that this is due to the fact that we are writing also #include <p30f6014A.h> in c source code while following your instructions in the same time.

Because after we removed that statement from the code, we get rid of above errors. However, this time we get the following error which is related to making one of the output pins high.

speechr.c:20: error: 'LATD' undeclared (first use in this function)
speechr.c:20: error: (Each undeclared identifier is reported only once
speechr.c:20: error: for each function it appears in.)
speechr.c:21: error: 'TRISD' undeclared (first use in this function)
speechr.c:38: error: '_LATD3' undeclared (first use in this function)
speechr.c:39: warning: implicit declaration of function '__delay32'
speechr.c:45: error: '_LATD0' undeclared (first use in this function)

As we mention earlier our main goal is to make one of the output pin of the dspic high, we the desired word is recognized by the processor using speech recognition library.

Could you please help us on that regard? It is very important for us to implement this code.
P.S. We do not have dsPICDEM evaluation board. We have only dsPIC30F6014 processor (with 10MHz Crystal) and si3000 audio codec.

We attached some photos showing our hardware parts and example code.
https://obrazki.elektroda.pl/7780611400_1398380127.jpg
https://obrazki.elektroda.pl/2144382900_1398380128.jpg
https://obrazki.elektroda.pl/2670449100_1398380130.jpg

************** Here are our code:

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//-------------------------------------------------------------
// dsPIC30F Speech Recognition Example Program
//-------------------------------------------------------------
 
//#include <p30f6014A.h>
#include "SR_Lib.h"
#include "robot.h"
//-------------------------------------------------------------
// Initialization Settings
//-------------------------------------------------------------
#define fclock 6144L // clock oscillator frequency
#define pll_setting 8 // PLL multiplier mode
#define timeout 10 // timeout period in seconds
#define mic_gain 30 // microphone gain in dB
#define SR_mode 1 // no self-test, use keyword activation
 
// -------------------------------------------------------------
int main(void)
{
 LATD = 0; 
 TRISD = 0b1111111111110000;
int word;
// Initialize speech recognizr
SR_Initialization(fclock, pll_setting, timeout, mic_gain, SR_mode);
 
// -------------------------------------------------------------
// SR Main Working Cycle
// -------------------------------------------------------------
while (1)
{ 
// recognize words spoken by the user
word = SR_Recognizer();
switch (word) {
case SRL_NONE:
// recognition in process - doesn't require action
break;
case SRL_GO ... SRL_YES:
 _LATD3 = 1;  // whenever recognized the desired word led will light up
 __delay32(15000000);
 _LATD3 = 0;
__delay32(15000000);
// valid word recognized - process it
break;
case SRL_UNKNOWN:
_LATD0 = 1;
 __delay32(1500000);
 _LATD0 = 0;
__delay32(1500000);
default :
// unknown response - doesn't require action
break;
} /* end switch(word) */
} /* end while(1) */
} /* end main() */

 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top