Jump to content
  • 0

Pro MX4 and DSPI compile errors


kennethryan

Question

Hi,

I'm using my chipkit pro mx4 to try to talk to a pmodOLEDrgb.  I'm having trouble just getting off the ground.

I have Adruino IDE 1.6.9 with the chipkit 1.4.0 package installed (manually, the auto install was a spectacular failure) on a windows 7 64bit machine.

I have the right board selected (blink sketch works), but if I include the DSPI library it fails to compile.  I'm hoping someone has some ideas for me to try.

(BTW, I'm reasonably competent at C, mostly an FPGA guy, looking to learn the Arduino dialect and love playing with PMODs).

Thanks in advance!

ken

----------------

Here is the sketch:

#include <DSPI.h>
void setup() {
}
void loop() {
}

Pretty simple.

------------------

Here is the compiler output:

In file included from C:\Program Files (x86)\Arduino\hardware\chipkit-core\pic32\cores\pic32/pins_arduino.h:263:0,

                 from C:\Program Files (x86)\Arduino\hardware\chipkit-core\pic32\cores\pic32/WProgram.h:9,

                 from C:\Program Files (x86)\Arduino\hardware\chipkit-core\pic32\libraries\DSPI/DSPI.h:41,

                 from C:\Program Files (x86)\Arduino\hardware\chipkit-core\pic32\libraries\DSPI\DSPI.cpp:46:

C:\Program Files (x86)\Arduino\hardware\chipkit-core\pic32\libraries\DSPI\DSPI.cpp: In constructor 'DSPI0::DSPI0()':

C:\Program Files (x86)\Arduino\hardware\chipkit-core\pic32\variants\Cerebot_MX4cK/Board_Defs.h:334:22: error: '_SPI2_IPL_IPC' was not declared in this scope

 #define _DSPI0_IPL   _SPI2_IPL_IPC

                      ^

C:\Program Files (x86)\Arduino\hardware\chipkit-core\pic32\libraries\DSPI\DSPI.cpp:1072:10: note: in expansion of macro '_DSPI0_IPL'

  ipl = ((_DSPI0_IPL & 0x07) << 2) + (_DSPI0_SPL & 0x03);

          ^

C:\Program Files (x86)\Arduino\hardware\chipkit-core\pic32\variants\Cerebot_MX4cK/Board_Defs.h:335:22: error: '_SPI2_SPL_IPC' was not declared in this scope

 #define _DSPI0_SPL   _SPI2_SPL_IPC

                      ^

C:\Program Files (x86)\Arduino\hardware\chipkit-core\pic32\libraries\DSPI\DSPI.cpp:1072:38: note: in expansion of macro '_DSPI0_SPL'

  ipl = ((_DSPI0_IPL & 0x07) << 2) + (_DSPI0_SPL & 0x03);

                                      ^

exit status 255
Error compiling for board chipKIT Pro MX4.

---------------

I see Board_Defs.h has the references to _SPI2_IPL_IPC and _SPI2_SPL_IPC, but there is no path to those symbol definitions in System_Defs.h given the defines for the __32MX460F512L__ in cpudefs.h.  I have not yet found where symbols like _SPI2_BASE_ADDRESS are defined; clearly they are or the compile would bomb out earlier.

I haven't figured out how pic32 interrupts work to add the necessary #define myself.  

BTW, if I select the MX4 instead it compiles fine (too bad I don't have one of those).

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

I've created an issue in GitHub in the core. It looks like the System_Defs.h doesn't handle the case where there is a 3xx/4xx part that doesn't have PPS.

Try changing the Board_Defs.h file to force the definition:

#define    _DSPI0_IPL_ISR        IPL3SOFT
#define    _DSPI0_IPL            3
#define    _DSPI0_SPL            0

When I did this, it built for me.

Link to comment
Share on other sites

Hi @kennethryan,

To add to @Larry Standage comment to find the file for my computer the path to find the System_defs.h is:

C:\Users\jpeyron\AppData\Local\Arduino15\packages\chipKIT\hardware\pic32\1.4.0\cores\pic32

In System_Defs.h on line 384ish edit the text to remove the line:  #if defined(__PIC32_PPS__)

and the line:       #endif

original text


#if defined(__PIC32_PPS__)
#define    _SPI2_IPL_ISR    IPL3SOFT    //interrupt priority for the ISR
#define    _SPI2_IPL_IPC    3       //interrupt priority for the IPC register
#define    _SPI2_SPL_IPC    0       //interrupt subpriority for the IPC register
#endif
 

edited test

#define    _SPI2_IPL_ISR    IPL3SOFT    //interrupt priority for the ISR
#define    _SPI2_IPL_IPC    3       //interrupt priority for the IPC register
#define    _SPI2_SPL_IPC    0       //interrupt subpriority for the IPC register

after editing i was able to compile with not issue. 

cheers,

Jon

Link to comment
Share on other sites

Thanks!

Changing System_Defs.h worked, the OLEDrgb demo ran fine.

However if I didn't change System_Defs.h but instead put the #define lines before #include <DSPI.h> in my sketch it does not compile.  The added #define symbols are not seen by the .h files.  I'm curious why that is, I see no reason it would not have worked if it were a normal C program. Are the headers being compiled in some sort of different context?  

(One of my goals to learn is how a sketch is compiled into a C program, there appears to be things going on behind the scenes to make this easy to use).

ken

------------------------

This has the same errors as above when I compile:

#define    _SPI2_IPL_ISR    IPL3SOFT    //interrupt priority for the ISR
#define    _SPI2_IPL_IPC    3       //interrupt priority for the IPC register
#define    _SPI2_SPL_IPC    0       //interrupt subpriority for the IPC register
#include <DSPI.h>
void setup() {
}
void loop() {
}

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...