Go Down

Topic: avr/prgspace error problem (Read 2 times) previous topic - next topic


(I posted this on the wrong tpoic earlie)

I'm trying to use the MPU-6050 code from Jeff Rowberg in the FreeIMU library (MPU6050_raw.ino).  I've modified references from MPU6050 to MPU60X0 and included the SPI library in the sketch.  When I compile the sketch using arduino1.5.1r2 for an Arduino Mega2560 board, it works fine.  However when I compile the sketch for an Arduino Due, I get the following error:

fatal error: avr/prgspace.h: No such file or directory

Any help would be appreciated



Jan 20, 2013, 04:55 am Last Edit: Jan 20, 2013, 04:56 am by SomeRandomGuy Reason: 1
The issue here is that the earlier Arduino boards are all AVR chips, while the Due is now an ARM architecture. The Due does not use the prgspace.h file at all.

You will need to modify the library you are using in order to support the due.
First, open the library folder and go to the library's .cpp file. It might be called FreeIMU.cpp.

Look at the top for the avr/prgspace.h declaration. Then, you can try replacing that declaration with the following code.

Code: [Select]
#ifndef __arm__
#include <avr/pgmspace.h>
#define PROGMEM /* empty */
#define pgm_read_byte(x) (*(x))
#define pgm_read_word(x) (*(x))
#define pgm_read_float(x) (*(x))

This may prove to be too involved, but I have had some success this way.

Good Luck!


Many thanks for both comments. I'll try the suggestions.



Jan 30, 2013, 08:48 pm Last Edit: Jan 30, 2013, 08:53 pm by cam_ Reason: 1
I'm also experiencing the same issue. I'll admit I'm over my head here for the most part although I was able to successfully able to implement SomeRandomGuy's improvement to address some of the issues.

I also added "#define prog_uchar uint8_t" before the "#endif" to address the "error: invalid conversion from 'const char*' to 'const uint8_t*'" errors.

It now seems to compile however I am unable to establish I2C communications with the IMU and I2CScanner (http://playground.arduino.cc/Main/I2cScanner) is not recognizing it at all. Another user is also having this problem here http://arduino.cc/forum/index.php?topic=145697.0.

Have you had any luck?

EDIT: Oh, and I also commented out all the 'F' flags in the MPU6050_DMP6 sketch in the "Serial.println(F("example text"));" commands because of the error "error: 'PSTR' was not declared in this scope".

Go Up