RA8875 and readData()

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
andromeda92
 
Posts: 9
Joined: Sun Jan 20, 2019 6:08 pm

RA8875 and readData()

Post by andromeda92 »

Hi,
I have the RA8875 (1590) module and a TFT 5 " (1596) screen with touchscreen from Adafruit.
at the beginning did not work despite the connection with my teensy 3.6 and the RA8875 was correct, I realized that the readData () function used by the function readReg () always returned the value 0xFF in the code of the file Adafruit_RA8875.cpp.

I am using arduino 1.8.8 and Adafruit_RA8875 v1.0.4 and teensy 3.6.
my wired connection is ok from teensy 3.6
CS = 10
RESET = 9
SCK = 13
MOSI = 11
MISO = 12
INT = 3


I was able to modify some code of the Adafruit_RA8875.cpp library so that the examples work like buildTest and textMode bypassing functions to avoid using the readData () function, but for the touchscreen I can't.

what i do not understand is the writeData () and writeReg () functions work perfectly, it's only the functions of reading registers readData() that return always 0xFF for all registers.
the code below does not work because they use readData ().

Code: Select all

uint8_t  Adafruit_RA8875::readData(void) 
{
    
  digitalWrite(_cs, LOW);  
    spi_begin();
   
  SPI.transfer(RA8875_DATAREAD);
  uint8_t x = SPI.transfer(0x0);  
    spi_end();
         
  digitalWrite(_cs, HIGH);
    
  return x; 
  
}

Code: Select all

uint8_t  Adafruit_RA8875::readReg(uint8_t reg) 
{
  writeCommand(reg);  
  return readData();  
        
}
i have tested with other library version as 1.03, is a same.
I was forced to comment the following code otherwise the code was not executed because the return value is always 0xFF

Code: Select all

 uint8_t x = readReg(0x0);
    Serial.print("x = 0x"); Serial.println(x,HEX);
  /*  if (x != 0x75) {
        return false;
    } */     

can you help me for this problem this is two days and two night that i do not understand why readData () always returns me 0xFF.

thanks for your help.

User avatar
andromeda92
 
Posts: 9
Joined: Sun Jan 20, 2019 6:08 pm

Re: RA8875 and readData()

Post by andromeda92 »

Any idea ?

User avatar
andromeda92
 
Posts: 9
Joined: Sun Jan 20, 2019 6:08 pm

Re: RA8875 and readData()

Post by andromeda92 »

no one has ever had this problem that readdata always returns 0xFF?

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: RA8875 and readData()

Post by adafruit_support_carter »

What are you trying to do with readData()? If you are trying to read registers, use readReg().
ra8875_read_reg.jpg
ra8875_read_reg.jpg (105.04 KiB) Viewed 97 times

User avatar
andromeda92
 
Posts: 9
Joined: Sun Jan 20, 2019 6:08 pm

Re: RA8875 and readData()

Post by andromeda92 »

i resolved the problem, its because the wire was too long.

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

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”