R8875 and GLX library tutorial
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 9
- Joined: Wed Apr 23, 2014 6:37 am
R8875 and GLX library tutorial
Can i make some questions. I have a tft touchscreen with the R8875. I can nto make it work with the Adafruit library. The library give warnings on the compile and only the backlight works cause i give seperate feed. I saw the demo code but i do not know how to use it with arduino. It includes some headers that does not exist in the files and it is not clear for a beginner how he can work with it.Adafruit libraries (glx ,graphic) give several errors on arduino (on the last version of arduino ide and without touching them). Is there any guide to work with the R8875 or should i write a library according to the datasheet of the chip?
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: R8875 and GLX library tutorial
What error messages do you get when you try to compile the code?
-
- Posts: 9
- Joined: Wed Apr 23, 2014 6:37 am
Re: R8875 and GLX library tutorial
This is the log of the compiler in the terminal
In file included from C:\Program Files\arduino\libraries\Robot_Control\Adafruit_GFX.cpp:17:
C:\Program Files\arduino\libraries\Robot_Control\/glcdfont.c:9: warning: only initialized variables can be placed into program memory area
C:\Program Files\arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\Program Files\arduino\hardware\arduino\cores\arduino -IC:\Program Files\arduino\hardware\arduino\variants\standard -IC:\Program Files\arduino\libraries\SPI -IC:\Program Files\arduino\libraries\Robot_Control -IC:\Program Files\arduino\libraries\AdafruitRA8875 -IC:\Program Files\arduino\libraries\Robot_Control\utility C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp -o C:\Users\Platonas\AppData\Local\Temp\build2231831025049169548.tmp\Robot_Control\ArduinoRobot.cpp.o
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp: In constructor 'RobotControl::RobotControl()':
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:8: error: 'LCD_CS' was not declared in this scope
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:8: error: 'DC_LCD' was not declared in this scope
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:8: error: 'RST_LCD' was not declared in this scope
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp: In member function 'void RobotControl::begin()':
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:18: error: 'MUXA' was not declared in this scope
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:18: error: 'MUXB' was not declared in this scope
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:18: error: 'MUXC' was not declared in this scope
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:18: error: 'MUXD' was not declared in this scope
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:19: error: 'MUX_IN' was not declared in this scope
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:22: error: 'BUZZ' was not declared in this scope
C:\Program Files\arduino\libraries\Robot_Control\ArduinoRobot.cpp:25: error: 'Serial1' was not declared in this scope
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: R8875 and GLX library tutorial
Most of that is due to a quirk of the Arduino IDE version 1.0.5 or later.
For the 1.0.5 release of the IDE, the Arduino folks built support for their robot kit into the program. That's fine, but one of the libraries they used was an older version of the Adafruit_GFX library. We updated the library some time later to fix some problems, and hijinks ensued.
The easiest way to solve the problem is to drop back to version 1.0.4 of the IDE. If you want to stick with version 1.0.5, find the application's internal libraries path (C:\Program Files\arduino\libraries\) and delete the folder named 'RobotControl'.
For the 1.0.5 release of the IDE, the Arduino folks built support for their robot kit into the program. That's fine, but one of the libraries they used was an older version of the Adafruit_GFX library. We updated the library some time later to fix some problems, and hijinks ensued.
The easiest way to solve the problem is to drop back to version 1.0.4 of the IDE. If you want to stick with version 1.0.5, find the application's internal libraries path (C:\Program Files\arduino\libraries\) and delete the folder named 'RobotControl'.
-
- Posts: 9
- Joined: Wed Apr 23, 2014 6:37 am
Re: R8875 and GLX library tutorial
I took the GFX lib from gifhub and managed to compile correctly. I fell into an infinite loop tho. The buildtest sketz uses spi mode 0 and and clock divider at 128 (i think that spi mode is 3 cause of the figure 6-18 in page 65 of the datasheet(tho it did not worked also). Also the sketz tries to read a register 0x0h i think and and returns false (witch goes in the infinite loop) if the value is not 75? I am trying to find this register in the datasheet to check its normal value in order to find where is the problem.
Why after initializetion function library changes the clockdivider?
The code from the lib i am talking about is this:
Why after initializetion function library changes the clockdivider?
The code from the lib i am talking about is this:
Code: Select all
boolean Adafruit_RA8875::begin(enum RA8875sizes s) {
_size = s;
if (_size == RA8875_480x272) {
_width = 480;
_height = 272;
}
if (_size == RA8875_800x480) {
_width = 800;
_height = 480;
}
pinMode(_cs, OUTPUT);
digitalWrite(_cs, HIGH);
pinMode(_rst, OUTPUT);
digitalWrite(_rst, LOW);
digitalWrite(_rst, LOW);
delay(100);
digitalWrite(_rst, HIGH);
delay(100); SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV128);
SPI.setDataMode(SPI_MODE0);
if (readReg(0) != 0x75) {
return false;
}
initialize();
SPI.setClockDivider(SPI_CLOCK_DIV4);
return true;
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: R8875 and GLX library tutorial
I didn't work on the RA8875 library, but I assume the library changes the SPI clock to match the chip's requirements.
The '0x0h' refers to register 0, using active-HIGH logic signals (LOW=0, HIGH=1). Hexidecimal numbers stop at F.
The '0x0h' refers to register 0, using active-HIGH logic signals (LOW=0, HIGH=1). Hexidecimal numbers stop at F.
-
- Posts: 9
- Joined: Wed Apr 23, 2014 6:37 am
Re: R8875 and GLX library tutorial
But i do not see the 0 register in the datasheet registers starts at 0x01h and before this there is a status register that they do not give a number and it is Read Only(i supposed that this was the 0h register) but 75 as the dec number result for the 8bits register does not have any meaning for this register. I tried to reads and write to the first 4 register but the readReg function return always 255. I have tried all the spi modes cause i think it is not mode 0 but mode 3 and i have tried different clock dividers but nothing worked, also i saw that the first check of the existance of the chip is done with clock divide 128 and after the initialization the lib turns the clock to 4, why is this done?
- adafruit2
- Posts: 22194
- Joined: Fri Mar 11, 2005 7:36 pm
Re: R8875 and GLX library tutorial
To initialize the chip you need a slower clock. then when its all set up you can send data much faster!
-
- Posts: 9
- Joined: Wed Apr 23, 2014 6:37 am
Re: R8875 and GLX library tutorial
Ok but you do not answer about the register 0 which is not shown at the datasheet and about the number 75 you need the register to be equal in order to check the chipset. I use version 1.6 of the datasheet from 31 of July 2013.
I have tried to read registers 0,1,2,3 and all are set to 255.Basicaly i think that the protocol communication has problem. Please correct me if i am wrong and give me the solution.
I have tried to read registers 0,1,2,3 and all are set to 255.Basicaly i think that the protocol communication has problem. Please correct me if i am wrong and give me the solution.
Please be positive and constructive with your questions and comments.