Post by kanlok on Dec 12, 2020 22:54:33 GMT -8
hi,
Board: Arduino Mega 2560
I have problem initializing ft800 320x240 display. I have changed the CS pin to 53 in Wiring.h & set the Board to BOARD_FTDI_80x in GD2.h
however, FT800 screen just hangs with white background. i have debugged and traced that everything just hangs when code reaches/goes into to GDTR.begin0(cs);
I am just trying Hello World example of GD2 at the moment.
I am not sure where MISO, MOSI and SCK pins are defined, so I have defined them in GD2.h
Any clue what I am missing or what more modifications I need to make with above setup?
Thanks
Lokesh
GD2.h
wiring.h
Board: Arduino Mega 2560
I have problem initializing ft800 320x240 display. I have changed the CS pin to 53 in Wiring.h & set the Board to BOARD_FTDI_80x in GD2.h
however, FT800 screen just hangs with white background. i have debugged and traced that everything just hangs when code reaches/goes into to GDTR.begin0(cs);
I am just trying Hello World example of GD2 at the moment.
I am not sure where MISO, MOSI and SCK pins are defined, so I have defined them in GD2.h
Any clue what I am missing or what more modifications I need to make with above setup?
Thanks
Lokesh
#include <EEPROM.h>
#include <SPI.h>
#include <GD2.h>
void setup()
{
Serial.begin(9600); // JCB
GD.begin();
GD.wr32(REG_HCYCLE, 408);
GD.wr32(REG_HOFFSET, 70);
GD.wr32(REG_HSIZE, 320);
GD.wr32(REG_HSYNC0, 0);
GD.wr32(REG_HSYNC1, 10);
GD.wr32(REG_VCYCLE, 263);
GD.wr32(REG_VOFFSET, 13);
GD.wr32(REG_VSIZE, 240);
GD.wr32(REG_VSYNC0, 0);
GD.wr32(REG_VSYNC1, 2);
GD.wr32(REG_DITHER, 0);
GD.wr32(REG_PCLK_POL, 0);
GD.wr32(REG_PCLK, 8);
Serial.println(" after begin()");
}
void loop()
{
GD.ClearColorRGB(0x103000);
GD.Clear();
GD.cmd_text(GD.w / 2, GD.h / 2, 31, OPT_CENTER, "Hello world");
GD.swap();
}
GD2.h
#ifndef _GD2_H_INCLUDED
#define _GD2_H_INCLUDED
#define GD2_VERSION "%VERSION"
#if defined(RASPBERRY_PI) || defined(DUMPDEV)
#include "wiring.h"
#endif
#include "Arduino.h"
#include <stdarg.h>
#define RGB(r, g, b) ((uint32_t)((((r) & 0xffL) << 16) | (((g) & 0xffL) << 8) | ((b) & 0xffL)))
#define F8(x) (int((x) * 256L))
#define F16(x) ((int32_t)((x) * 65536L))
// Options for GD.begin():
#define GD_CALIBRATE 1 // enable touchscreen calibration at startup
#define GD_TRIM 2 // trim the built-in oscillator
#define GD_STORAGE 4 // initialize attached microSD
#define GD_NOBACKLIGHT 8 // don't turn on the backlight
#ifdef __SAM3X8E__
#define __DUE__ 1
#endif
#if !defined(SD_PIN) // {
#if defined(ESP8266)
#define SD_PIN D9 // pin used for the microSD enable signal
#elif defined(ARDUINO_ARCH_STM32)
#define SD_PIN PB1
#else
#define SD_PIN 9 // pin used for the microSD enable signal
#endif
#endif // }
#define BOARD_FTDI_80x 0
#define BOARD_GAMEDUINO23 1
#define BOARD_SUNFLOWER 2
#define BOARD_OTHER 3
#define BOARD BOARD_FTDI_80x // board, from above
#define STORAGE 0 // Want SD storage?
#define CALIBRATION 1 // Want touchscreen calibration?
// FTDI boards do not have storage
#if (BOARD == BOARD_FTDI_80x) || defined(RASPBERRY_PI) || defined(DUMPDEV) || defined(SPIDRIVER)
#undef STORAGE
#define STORAGE 0
#endif
#ifndef DEFAULT_CS
#if defined(ESP8266)
#define DEFAULT_CS D8
#elif defined(ARDUINO_ARCH_STM32)
#define DEFAULT_CS 53
#elif (BOARD == BOARD_FTDI_80x)
#define DEFAULT_CS 53
#else
#define DEFAULT_CS 8
#endif
#endif
#define MOSI 50
// for Arduino MEGA
#define MISO 51
// for Arduino MEGA
#define SCK 52 // for Arduino MEGA
wiring.h
#ifndef CS
#if defined(ESP8266)
#define CS D8
#elif defined(ESP32)
#define CS 12
#elif defined(ARDUINO_ARCH_STM32)
#define CS PB0
#elif (BOARD == BOARD_FTDI_80x)
#define CS 53
#else
#define CS 8
#endif
#endif