Author Topic: Adafruit STR7735R 1.8" display help  (Read 3389 times)

0 Members and 1 Guest are viewing this topic.

Offline Boscoe

  • Regular Contributor
  • *
  • Posts: 116
Adafruit STR7735R 1.8" display help
« on: November 08, 2015, 10:12:24 PM »
Hi I'm running into a problem with this display.

I've written some C code for an STM32F4 dev board to communicate with this display via SPI but I can't seem to get any life out of it.

I know my code works because I'm decoding the SPI on my scope.

The documentation from adafruit is awful - that bad this product doesn't have a part number from themselves. I'm using the 4 wire serial which is about the only bit of information given from Adafruit.

Basically I'm not sure on how to initialize this display as I find the datasheet to be very vague. From what I can gleam from the datasheet and Adafruit's libraries you can simply start writing to the display RAM and once it's full the controller displays the image, but this doesn't work. I've tried sending the 'RAM WRITE' command then start writing of SPI but still nothing. I've tried sending commands like 'DISPLAY ON' and 'DISPLAY OFF' as well as display inversion to try to tell whether the display is receiving data but I get nothing.

Does anyone have any experience with this display where they can help me?
Thanks

PS Display link http://www.adafruit.com/products/358
Datasheet: http://www.adafruit.com/datasheets/ST7735R_V0.2.pdf
 

Online Kalvin

  • Super Contributor
  • ***
  • Posts: 1500
  • Country: fi
  • Embedded SW/HW.
Re: Adafruit STR7735R 1.8" display help
« Reply #1 on: November 08, 2015, 10:22:30 PM »
You may want to look at this code from Adafruit and try to figure out what the display driver is doing.

https://github.com/adafruit/Adafruit-ST7735-Library

The file Adafruit_ST7735.cpp has a table of initialization commands and values, which are written to the display after reset/power-up.

Check also that your the voltage level of your SPI signals are right. I have used SPI displays with 3V3 interface with 5V Arduino, and the interface requires series resistors or level shifters to work correctly.
 

Offline obiwanjacobi

  • Frequent Contributor
  • **
  • Posts: 763
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
Re: Adafruit STR7735R 1.8" display help
« Reply #2 on: November 08, 2015, 10:42:26 PM »
I have used the AdaFruit driver with a 1.8" display (same datasheet) successfully.
(Only I am unsure what library I used exactly  :palm: I See that I have TFTLCD on my system... - but that may be for another LCD I played with?)



You say you have "a problem" and "get nothing" - can you be a bit more specific in what your problem actually is? (or I don't get what you're writing)

One mistake I made was that you need to put a pot (or PWM? - haven't tried that) on BL to trim the backlight intensity.
After that it worked in one go. I used the example sketch that came with the AdaFruit driver.


Offline Boscoe

  • Regular Contributor
  • *
  • Posts: 116
Re: Adafruit STR7735R 1.8" display help
« Reply #3 on: November 09, 2015, 12:39:48 AM »
Okay thank you both for the feedback. I have gone through the initialization that is in the Adafruit libraries for the Blacktab parameter. I don't know whether this is the right option but again the documentation is poor for the libraries so I didn't know which to use so I went with the simplest.

This is my initialization followed by my write to the memory:

//Display initialization
void init_display(void){
  uint8_t       command[1];             //Initialize send buffer
  uint8_t       data[6];                //Initialize send buffer
 
  //    1: Software reset, 0 args, w/150 ms delay
  command[0] = ST7735_SWRESET;
  TFT_Write(command, 1, CMD);
  delay(150);                                   
 
  //    2: Out of sleep mode, 0 args, w/500 ms delay
  command[0] = ST7735_SLPOUT;
  TFT_Write(command, 1, CMD);
  delay(500);                                   
 
  //    3: Frame rate ctrl - normal mode, 3 args: Rate = fosc/(1x2+40) * (LINE+2C+2D)
  command[0] = ST7735_FRMCTR1;
  data[0] = 0x01;
  data[1] = 0x2C;
  data[2] = 0x2D;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 3, DATA);
                               
  //    4: Frame rate control - idle mode, 3 args: Rate = fosc/(1x2+40) * (LINE+2C+2D)
  command[0] = ST7735_FRMCTR2;
  data[0] = 0x01;
  data[1] = 0x2C;
  data[2] = 0x2D;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 3, DATA);
                               
  //    5: Frame rate ctrl - partial mode, 6 args: Dot inversion mode, Line inversion mode
  command[0] = ST7735_FRMCTR3;
  data[0] = 0x01;
  data[1] = 0x2C;
  data[2] = 0x2D;
  data[3] = 0x01;
  data[4] = 0x2C;
  data[5] = 0x2D;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 6, DATA);
                               
  //    6:      Display inversion ctrl, 1 arg, no delay: No inversion
  command[0] = ST7735_INVCTR;
  data[0] = 0x07;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 1, DATA);
 
  //    7:      Power control, 3 args, no delay: -4.6V, Auto
  command[0] = ST7735_PWCTR1;
  data[0] = 0xA2;
  data[1] = 0x02;
  data[2] = 0x84;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 3, DATA);
 
  //    8:      Power control, 1 arg, no delay: VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD
  command[0] = ST7735_PWCTR2;
  data[0] = 0xC5;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 1, DATA);
 
  //    9:      Power control, 2 args, no delay: Opamp current small, Boost frequency
  command[0] = ST7735_PWCTR3;
  data[0] = 0x0A;
  data[1] = 0x00;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 2, DATA);
 
  //    10:     Power control, 2 args, no delay: BCLK/2, Opamp current small & Medium low
  command[0] = ST7735_PWCTR4;
  data[0] = 0x8A;
  data[1] = 0x2A;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 2, DATA);
 
  //    11:     Power control, 2 args, no delay
  command[0] = ST7735_PWCTR5;
  data[0] = 0x8A;
  data[1] = 0xEE;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 2, DATA);
 
  //    12:     Power control, 1 arg, no delay:
  command[0] = ST7735_VMCTR1;
  data[0] = 0x0E;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 1, DATA);
 
  //    13:     Don't invert display, no args, no delay
  command[0] = ST7735_INVON;
  TFT_Write(command, 1, CMD);
 
  //    14:     Memory access control (directions), 1 arg:
  command[0] = ST7735_MADCTL;
  data[0] = 0xC0;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 1, DATA);
 
  //    15:     set color mode, 1 arg, no delay:
  command[0] = ST7735_COLMOD;
  data[0] = 0x05;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 1, DATA);
}






//Draw a bitmap to the display
void draw_bmp_display(uint8_t* TxBuffer){
  uint8_t       colstart = 2;
  uint8_t       rowstart = 1;
  uint8_t       command[1];             //Initialize send buffer
  uint8_t       data[4];                //Initialize send buffer
 
  command[0] = ST7735_CASET;
  data[0] = 0x00;
  data[1] = colstart;
  data[2] = 0x00;
  data[3] = colstart + 159;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 4, DATA);
 
  command[0] = ST7735_RASET;
  data[0] = 0x00;
  data[1] = rowstart;
  data[2] = 0x00;
  data[3] = rowstart + 127;
  TFT_Write(command, 1, CMD);
  TFT_Write(data, 4, DATA);
 
  command[0] = ST7735_RAMWR;
  TFT_Write(command, 1, CMD);
 
  for(int lines = 0; lines < 165; lines ++){   //Just a test for now dumping values to the memory.
    TFT_Write(TxBuffer, 128, DATA);
  }
}
 

Offline obiwanjacobi

  • Frequent Contributor
  • **
  • Posts: 763
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
Re: Adafruit STR7735R 1.8" display help
« Reply #4 on: November 09, 2015, 01:03:53 AM »
But what do you see? What makes you think it doesn't work?

Offline Boscoe

  • Regular Contributor
  • *
  • Posts: 116
Re: Adafruit STR7735R 1.8" display help
« Reply #5 on: November 09, 2015, 01:13:02 AM »
Nothing happens to the display when the data is written. I'm writing all zeros so I expect it to turn black or white. Neither happens even if I enable display inversion.
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 5286
Re: Adafruit STR7735R 1.8" display help
« Reply #6 on: November 09, 2015, 01:23:38 AM »
A version 0.2 datasheet is all they have, when there's a v1.4 out already? :palm:

Anyway the ST7735(R) is a "big Philips" type controller (similar to the old PCF8833) so if you find code for any of that family it should work. The datasheet describes the power-on process starting in section 9.13. After power-on and hardware reset you need to issue commands software reset, delay 120ms, sleep out, delay 120ms, display on. The other settings usually don't need to be changed unless you want to fine-tune the display appearance. Make sure the interface selection is correct.

Also, Adafruit is overpriced. You can get the same type of display elsewhere for cheaper.
 

Offline Boscoe

  • Regular Contributor
  • *
  • Posts: 116
Re: Adafruit STR7735R 1.8" display help
« Reply #7 on: November 09, 2015, 01:36:08 AM »
Thanks for that it's good help! However, in the link for the v1.4, there is no section 9.13.
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 5286
Re: Adafruit STR7735R 1.8" display help
« Reply #8 on: November 09, 2015, 01:37:52 AM »
Did you look at page 68? ::)
 

Offline Boscoe

  • Regular Contributor
  • *
  • Posts: 116
Re: Adafruit STR7735R 1.8" display help
« Reply #9 on: November 09, 2015, 02:00:03 AM »
Sorry I didn't think section 9 would go on for so long!
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 738
  • Country: us
Re: Adafruit STR7735R 1.8" display help
« Reply #10 on: November 09, 2015, 03:31:24 AM »
I played with these displays a while ago and got a couple of different versions to work. The init sequences I used are here: https://github.com/andyturk/libakt/blob/master/akt/views/st7735r.cc

Your code is using a different MADCTL (0xc0) than mine (0xa8), so you might try changing that.
 

Offline Boscoe

  • Regular Contributor
  • *
  • Posts: 116
Re: Adafruit STR7735R 1.8" display help
« Reply #11 on: November 09, 2015, 06:45:36 AM »
Thanks for the help everyone. It was the crucial 'turn display on' command I was missing. It's working nicely now!
 

Online Kalvin

  • Super Contributor
  • ***
  • Posts: 1500
  • Country: fi
  • Embedded SW/HW.
Re: Adafruit STR7735R 1.8" display help
« Reply #12 on: November 09, 2015, 07:05:02 AM »
Thanks for the help everyone. It was the crucial 'turn display on' command I was missing. It's working nicely now!
:-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf