Daily Archives: May 20, 2013

Arduino Due Issues

I have been working with the Arduino Due and version 1.5.2 of the Arduino IDE. I have been attempting to port a mini digital picture frame that I wrote for the Arduino Micro and have not been having much luck. The problem is that the Arduino Due is still relatively new and is a different family than the previous Arduinos.

The errors that have been encountered due to references to the avr libraries. (In particular avr\io.h and avr/pgmspace.h.)

In my attempt, I did the following:

  1. Created the program shown below to workout the library issues. Once I am able to resolve the library issues, I will be able to start porting the code.
  2. Replace the Adafruit_ST7735 library with the modified version at https://github.com/sngl/Adafruit-ST7735-Library” target=”_blank which has been modified to support the Arduino Due
  3. Update the Adafruit_GFX library with the changes found at https://github.com/elechouse/Adafruit-GFX-Library/commit/69e355325312a57412d8c4d0ec6298aa3b4ed917
  4. Create a new folder in the Arduino IDE location at hardware/arduino/sam/cores/arduino/avr/
  5. Create a new file at hardware/arduino/sam/cores/arduino/avr/pgmspace.h and enter contents found at https://github.com/arduino/Arduino/commit/0f5a5259ec038537ea51de0059e711fdeebc6ece

Some issues are resolved but others remain.

Code

#include <Adafruit_GFX.h> // Core graphics library // OK after changes to libraries
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h> // OK
// #include <SD.h>

void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}


Errors

In file included from sketch_may19a.ino:20:
C:\arduino-1.5.2\libraries\Adafruit_ST7735/Adafruit_ST7735.h: In member function 'uint16_t Adafruit_ST7735::Color565(uint8_t, uint8_t, uint8_t)':
C:\arduino-1.5.2\libraries\Adafruit_ST7735/Adafruit_ST7735.h:116: error: 'newColor' was not declared in this scope

Commented line 20 in the Adafruit_ST7735.h file as the Color565 function does not appear to be called elsewhere and the newColor function does not exist in any libraries. The following errors are then produced.

C:\arduino-1.5.2\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::commonInit(uint8_t*)':
C:\arduino-1.5.2\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:266: error: cannot convert 'volatile RwReg*' to 'volatile uint8_t*' in assignment
C:\arduino-1.5.2\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:268: error: cannot convert 'volatile RwReg*' to 'volatile uint8_t*' in assignment
C:\arduino-1.5.2\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:276: error: 'SPI_CLOCK_DIV4' was not declared in this scope
C:\arduino-1.5.2\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:283: error: cannot convert 'volatile RwReg*' to 'volatile uint8_t*' in assignment
C:\arduino-1.5.2\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:285: error: cannot convert 'volatile RwReg*' to 'volatile uint8_t*' in assignment

Why is it when people provide fixes they are rarely documented completely? This is one of the most frustrating things that I encounter. I can solve these issues if given enough time but unfortunately I do not have the luxury. I will come back to this later and attempt to resolve the remaining issues.

Here is a post of someone else trying to get the Adafruit display to work with the Arduino Due. http://21stdigitalhome.blogspot.com/2013/02/arduino-due-spi-display-nearly-defeated.html

To be fair, the Arduino Due is a totally different architecture and it will take time to port the libraries over to the new architecture. I hope to get some more time later to tackle this problem again as this is a great opportunity to learn more about the Arduino Due but I suspect that I will not be able to devote the time I need to accomplish much.