This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

There is a problem using the ST7735 driver in GFX example.

Hello

I'm going to use the GFX example of sdk v17.0.2 to running the ST7735 TFT LCD display.

I am using Adafruit's 1.8-inch (128*160) display and testing it on the nRF52DK board.  And I connected the pins as below as defined in sdk_config.h in the example.

//config.h

#ifndef ST7735_SCK_PIN
#define ST7735_SCK_PIN 25
#endif

// <o> ST7735_MISO_PIN - Pin number  <0-47> 


#ifndef ST7735_MISO_PIN
#define ST7735_MISO_PIN 24
#endif

// <o> ST7735_MOSI_PIN - Pin number  <0-47> 


#ifndef ST7735_MOSI_PIN
#define ST7735_MOSI_PIN 23
#endif

// <o> ST7735_SS_PIN - Pin number  <0-47> 


#ifndef ST7735_SS_PIN
#define ST7735_SS_PIN 22
#endif

// <o> ST7735_DC_PIN - Pin number  <0-47> 


#ifndef ST7735_DC_PIN
#define ST7735_DC_PIN 19
#endif

MISO - p0.24

SCK - p0.25

MOSI - p0.23

TFT_CS - p0.22 (ST7735_SS_PIN)

D/C - p0.19

When connecting like this and debugging, spi_write falls into a loop (while())

//st7735.c
static inline void write_command(uint8_t c)
{
    nrf_gpio_pin_clear(ST7735_DC_PIN);
    spi_write(&c, sizeof(c)); //loop error!
}


//nrfx_spi.c
//The following code for 'spi_write()'
while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)){} //loop error!!

Eventually, the display does not run anything.  Is the connection problem with the pins?  In this example, the Reset pin on the display is not used, is it correct?

Is there anything I missed on this matter?

Thank you.

//================================================================

I made one correction in this example code as follows.

//main.c

//line 82
//static const nrf_lcd_t * p_lcd = &nrf_lcd_ili9341; //not use
static const nrf_lcd_t * p_lcd = &nrf_lcd_st7735; //select st7735 lcd

Parents
  • Hi 

    Have you tried to probe the SPI signals with a scope or logic analyzer to see if there is any activity?

    It should not be necessary to connect the reset pin in order to control the display, as long as the reset pin is not pulled anywhere (so that the display is continuously in reset). 

    Can you show me the code where you try to update the display? 
    (the code that eventually leads to the hanging loop issue)

    Best regards
    Torbjørn

Reply
  • Hi 

    Have you tried to probe the SPI signals with a scope or logic analyzer to see if there is any activity?

    It should not be necessary to connect the reset pin in order to control the display, as long as the reset pin is not pulled anywhere (so that the display is continuously in reset). 

    Can you show me the code where you try to update the display? 
    (the code that eventually leads to the hanging loop issue)

    Best regards
    Torbjørn

Children
No Data
Related