Arduino DUE - ultimate GPS - TFT 2.8 touch

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tongo
 
Posts: 8
Joined: Fri Aug 08, 2014 10:48 am

Arduino DUE - ultimate GPS - TFT 2.8 touch

Post by tongo »

Hy,
i have this configuration:

Arduino DUE
Adafruit Ultimate GPS breackout V3
Adafruit TFT LCD 2.8" touchscreen

The GPS is connected to DUE Serial1 (pin 18, 19).
The LCD is connected via SPI (because i'm planning to use the sd-card slot).

The GPS and the LCD work fine alone, but when i put the sketch together the DUE freeze in setup() method when i call tft.begin().
But if i comment the parsing instruction [GPS.parse(GPS.lastNMEA())] in loop(), the sketch run ok.

Code: Select all

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "Adafruit_GPS.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

// GPS
#define gpsSerial Serial1
Adafruit_GPS GPS(&gpsSerial);

void setup() {
  Serial.begin(115200);
  Serial.println("Start SETUP!");
  
  Serial.println("Setup GPS");
  GPS.begin(9600);
  gpsSerial.begin(9600);
  GPS.sendCommand(PMTK_SET_BAUD_9600);
  
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_5HZ);
  GPS.sendCommand(PGCMD_NOANTENNA);
  
  Serial.println("Setup TFT");
  tft.begin();
  Serial.println("Setup TFT begin finish");
  tft.setRotation(3); // Landscape destra (cavi a sinistra)
  tft.fillScreen(ILI9341_BLACK);
  
  Serial.println("Setup finish!");
}


void loop(void) {
  // read data from the GPS in the 'main loop'
  char c = GPS.read();
  //if (c) Serial.print(c);
  
  if (GPS.newNMEAreceived()) {
    Serial.println(GPS.lastNMEA());   // this also sets the newNMEAreceived() flag to false
 
//  IF I UNCOMMENT THIS 2 LINE THE SKETCH FREEZE on tft.begin();
//    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
//      return;

    updateFixGps(GPS.fix);
  }
}

void updateFixGps(bool state) {
  if(state) {
    tft.fillCircle(68, 19, 10, ILI9341_GREEN);
  } else {
    tft.fillCircle(68, 19, 10, ILI9341_RED);
  }
  tft.drawCircle(68, 19, 10, ILI9341_WHITE);
}
Reading the other post in the forum i find that can be a memory problem.

How can i verify it ?
And if is really a memory problem, how can i fix it ?

Thanks

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Arduino DUE - ultimate GPS - TFT 2.8 touch

Post by adafruit_support_rick »

I don't know what to tell you. I ran your code here, and it does not hang or crash with those lines uncommented.

User avatar
tongo
 
Posts: 8
Joined: Fri Aug 08, 2014 10:48 am

Re: Arduino DUE - ultimate GPS - TFT 2.8 touch

Post by tongo »

Thank you for the reply.
I can't understand where i'm wrong.

Other info:
I develop on MAC book late 2008 (OSX 10.9.4 BANNED)
Arduino IDE 1.5.7
Board: Arduino DUE R3-E
Library: the last version (update today) Adafruit-GPS-Library, Adafruit_ILI9341, Adafruit-GFX-Library

With the loop() code in this configuration:

Code: Select all

//Serial.println(GPS.lastNMEA());   // this also sets the newNMEAreceived() flag to false
 
//  IF I UNCOMMENT THIS 2 LINE THE SKETCH FREEZE on tft.begin();
    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
      return;
The code blocks on tft.begin(), i don't see "Setup TFT begin finish" in serial monitor.

In the attachment there is the schema of the circuit, maybe i'm wrong here.
Circuit schema
Circuit schema
gps-circuit.png (468.18 KiB) Viewed 528 times
Thanks

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Arduino DUE - ultimate GPS - TFT 2.8 touch

Post by adafruit_support_rick »

That's exactly what I'm running. The only difference is that I have the IM solder jumpers closed on the back of the TFT, rather than running jumpers from 3.3V

User avatar
tongo
 
Posts: 8
Joined: Fri Aug 08, 2014 10:48 am

Re: Arduino DUE - ultimate GPS - TFT 2.8 touch

Post by tongo »

I solved the problem using the Arduino IDE 1.5.6 rather than the 1.5.7 version.
Maybe can be useful to someone else.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”