Microchip MDD Error upon Build

Thread Starter

Sherri

Joined Mar 31, 2018
29
Hello all,
Thanks for reading my post.
I have been slowly working w/ the book SD projects using the Pic microcontroller by Dogan Ibrahim. I am using MDD libraries v2013.06.15 v3.47 and C18. I am using mplab v 8.92. and Pic18F24k22.
Upon build I receive the following error which when looking at hardwareprofile.h appears to be correct:


C:\Microchip Solutions\Microchip\MDD File System\SD-SPI.c:1167:Error [1099] "Please define SPI_INTERRUPT_FLAG_ASM.


I have defined SPI_INTERRUPT_FLAG_ASM as: #define SPI_INTERRUPT_FLAG_ASM PIR, 3 in hardwareprofile.h. See attached copy of my altered hardwareprofile.h file for review.

I am not sure how to resolve this error. In looking at hardwareprofile.h all seems correct to me but obviously I am missing something somewhere. Any guidance in resolving this issue would be a big step forward for me with this project.

Sherri
 

Attachments

Thread Starter

Sherri

Joined Mar 31, 2018
29
There shouldn't be a comma in this line.
AlbertHall,
I pulled up the SD_SPI.c (which is where the error goes to when you click on the error message), and it states that the define must follow the PIRx, y definition. So the define syntax should be: #define SPI_INTERRUPT_FLAG_ASM PIR, 3
I am really stumped as to why this is not working for me (receiving this error upon building in mplab v8.92).
Thanks for your reply.

Sherri
 

Thread Starter

Sherri

Joined Mar 31, 2018
29
If there is nothing proprietary in your code, please zip up all your project files and attach here.
AlbertHall,
I have zipped up the files. Please let me know if I have neglected to include any needed files as I have not zipped a file before(sorry).
Thank you for your continued help.
Sherri
 

Attachments

AlbertHall

Joined Jun 4, 2014
12,343
I have just twigged that you are using the C18 compiler and I don't have that so I won't be able to compile your program.
I will have another look tomorrow. I need my beauty sleep now.
 

Thread Starter

Sherri

Joined Mar 31, 2018
29
I have just twigged that you are using the C18 compiler and I don't have that so I won't be able to compile your program.
I will have another look tomorrow. I need my beauty sleep now.
Thank you AlbertHall. Have a restful night sleep.

Sherri
 

AlbertHall

Joined Jun 4, 2014
12,343
Is this #define error the first error that the compiler complains about?
Especially does it say anything about 'can't find include file'?
 
Hello all,
Thanks for reading my post.
I have been slowly working w/ the book SD projects using the Pic microcontroller by Dogan Ibrahim. I am using MDD libraries v2013.06.15 v3.47 and C18. I am using mplab v 8.92. and Pic18F24k22.
Upon build I receive the following error which when looking at hardwareprofile.h appears to be correct:


C:\Microchip Solutions\Microchip\MDD File System\SD-SPI.c:1167:Error [1099] "Please define SPI_INTERRUPT_FLAG_ASM.


I have defined SPI_INTERRUPT_FLAG_ASM as: #define SPI_INTERRUPT_FLAG_ASM PIR, 3 in hardwareprofile.h. See attached copy of my altered hardwareprofile.h file for review.

I am not sure how to resolve this error. In looking at hardwareprofile.h all seems correct to me but obviously I am missing something somewhere. Any guidance in resolving this issue would be a big step forward for me with this project.

Sherri
Not sure, but try:

#define SPI_INTERRUPT_FLAG PIR3bits.SSP2IF

(see p114 of the datasheet for the PIR3 bit definitions).

Of course, there may be additional errors.
 

AlbertHall

Joined Jun 4, 2014
12,343
Not sure, but try:

#define SPI_INTERRUPT_FLAG PIR3bits.SSP2IF

(see p114 of the datasheet for the PIR3 bit definitions).

Of course, there may be additional errors.
The code checks for, and detects that it is not defined at all. It's not complaining about what it is defined as.
It may be that it can't find the hardwareprofile.h file (which contains the definition), hence my earlier questions.
 

Thread Starter

Sherri

Joined Mar 31, 2018
29
Is this #define error the first error that the compiler complains about?
Especially does it say anything about 'can't find include file'?
Yes, this is the only error I am receiving upon build. It does not say anything about 'can't find include file'.

Sherri
 
AlbertHall,
I pulled up the SD_SPI.c (which is where the error goes to when you click on the error message), and it states that the define must follow the PIRx, y definition. So the define syntax should be: #define SPI_INTERRUPT_FLAG_ASM PIR, 3
I am really stumped as to why this is not working for me (receiving this error upon building in mplab v8.92).
Thanks for your reply.

Sherri
So, again, I think you should try changing the definition from:
SPI_INTERRUPT_FLAG_ASM PIR1, 3
to:
#define SPI_INTERRUPT_FLAG PIR3bits.SSP2IF

The syntax that you are using does not seem to work. "PIRx, y definition" means, to me, Peripheral Interrupt Reguest (Flag) register # , bit. At least that is what I think.

For PIR1,3 the syntax would be:
#define SPI_INTERRUPT_FLAG PIR1bits.SSP1IF

But, I am not sure that is what you want and hence my earlier suggestion above (PIR3bits.SSP2IF). Have you tested either, since PIR1,3 is giving you an error?

Hope this helps.
 

AlbertHall

Joined Jun 4, 2014
12,343
Below is the code which generates the error message. It only requires SPI_INTERRUPT_FLAG_ASM to be defined. It in no way matters what it is defined as. Somehow or other the code manages to avoid this definition completely. I can't see why or how this happens.

#ifndef SPI_INTERRUPT_FLAG_ASM
#error Please add "#define SPI_INTERRUPT_FLAG_ASM PIRx, Y" to your hardware profile. Replace x and Y with appropriate numbers for your SPI module interrupt flag.
#endif
 
Looking at your altered hardwareprofile.h that you posted (in #1), don't you have a second added #define for SPI_INTERRUPT_FLAG in the Pic18F24k22 section, or am I confused?. Does it build ok with the second one removed?


C:
#elif defined(__18F24k22)

#define USE_PIC18
#define USE_SD_INTERFACE_WITH_SPI

#define INPUT_PIN 1
#define OUTPUT_PIN 0

// Chip Select Signal
#define SD_CS PORTBbits.RB3
#define SD_CS_TRIS TRISBbits.TRISB3

// Card detect signal
#define SD_CD PORTBbits.RB4
#define SD_CD_TRIS TRISBbits.TRISB4

// Write protect signal
#define SD_WE PORTAbits.RA4
#define SD_WE_TRIS TRISAbits.TRISA4

// Registers for the SPI module you want to use
#define SPICON1 SSP1CON1
#define SPISTAT SSP1STAT
#define SPIBUF SSP1BUF
#define SPISTAT_RBF SSP1STATbits.BF
#define SPICON1bits SSP1CON1bits
#define SPISTATbits SSP1STATbits

#define SPI_INTERRUPT_FLAG PIR1bits.SSPIF //<--------


// Defines for the HPC Explorer board
#define SPICLOCK TRISCbits.TRISC3
#define SPIIN TRISCbits.TRISC4
#define SPIOUT TRISCbits.TRISC5

// Latch pins for SCK/SDI/SDO lines
#define SPICLOCKLAT LATCbits.LATC3
#define SPIINLAT LATCbits.LATC4
#define SPIOUTLAT LATCbits.LATC5

// Port pins for SCK/SDI/SDO lines
#define SPICLOCKPORT PORTCbits.RC3
#define SPIINPORT PORTCbits.RC4
#define SPIOUTPORT PORTCbits.RC5

#define SPIENABLE SSPCON1bits.SSPEN

#define SPI_INTERRUPT_FLAG_ASM PIR1, 3  //<--------
 
Last edited:
Yeah, quite right, two different entities.

I'm still going with my suggested syntax changes.

#define SPI_INTERRUPT_FLAG PIR3bits.SSP2IF or #define SPI_INTERRUPT_FLAG PIR1bits.SSP1IF and not a PIRx,bit number format

Not that I am sure about it, just that it is easy and worth a shot to try.

I note that in the version history of SD-SPI.c

3) "SPI_INTERRUPT_FLAG_ASM" macro has to be defined in "HardwareProfile.h" file
for PIC18 microcontrollers.Or else an error is generated while building
the code.
"#define SPI_INTERRUPT_FLAG_ASM PIR1, 3" is removed from SD-SPI.c

My thinking though is that while having it defined is a requirement, it does not necessarily mean to me that having it defined incorrectly will not throw an error. Frustrating because I would like to test it out with C18, but the code has not been posted in the zip file. I want to investigate whether the syntax was changed around the time that C18 went away and the XC compilers became their standard.

Interestingly, another user complained about the same problem (different chip) here: http://www.microchip.com/forums/m548720.aspx and that was back in 2012...and there was no posted solution....same thing here: https://www.microchip.com/forums/m751275.aspx
 
I suppose that would be worth a try, but I am not suggesting that the #define be added back to SDI-SPI.c/.h.

I am suggesting that a #define SPI_INTERRUPT_FLAG_ASM appear in HardwareProfile.h as Mirochip's text states "SPI_INTERRUPT_FLAG_ASM" macro has to be defined in "HardwareProfile.h" file for PIC18 microcontrollers.Or else an error is generated while building the code.

I am suggesting that @Sherri replace her line in HardwareProfile.h
#define SPI_INTERRUPT_FLAG_ASM PIR1, 3

with

#define SPI_INTERRUPT_FLAG_ASM PIR1bits.SSP1IF

and see if it builds.

It may be that PIR3 should be used since sometimes SD cards are used with the secondary SSP2, but the simple change above is enough to test whether it will still throw the error. Further, if the PIR1, 3 that she added is from the book, then it is likely the right PIR and bit.

It is, however, very difficult for me to to do much more than guess. The compiler, C18 is outdated (although versions are still available), and I stopped using mplab v 8.92 a while ago, and the book is ~10 years old, and I don't see the code or a project schematic. :)

Still, I would like to see how this resolves - if it does.
 
Top