Help with SPI based Nokia C100/1616 TFT with ESP8266 12E
Posted: Tue Nov 01, 2016 6:46 am
I am making a wifi scanner with ESP8266 and to display information I am using SPI based Nokia 1616/C100 display. This time I am coding ESP8266 natively rather than using mcu + esp8266 (running at command firmware) combination.
On the ESP side I have successfully coded the hardware spi (HSPI) to spit out 9 bit values in the proper format (msb first, spi mode 0) that the LCD expects. I can see the data being sent on spi just fine.
However when I connect the LCD, there is nothing on it. Its just plain white with backlight as if it's not even getting initialized. The initializatin code that I have used works just fine (with an AVR for a different project)
I have a feeling that this is something ESP specific but I don't have enough experience with it to pinpoint it. Its seems weird that the LCD is completely blank as if it't not even starting up.
The TFT is connected to ESP8266 as follows
ESP8266 --- NOKIA TFT
----------------------------
/RST ----------- GPIO4
/CS ----------- GPIO15 (HSPI)
SDA ----------- GPIO13 (HSPI)
SCK ----------- GPIO14 (HSPI)
Would appreciate any help on this
Thanks!
On the ESP side I have successfully coded the hardware spi (HSPI) to spit out 9 bit values in the proper format (msb first, spi mode 0) that the LCD expects. I can see the data being sent on spi just fine.
However when I connect the LCD, there is nothing on it. Its just plain white with backlight as if it's not even getting initialized. The initializatin code that I have used works just fine (with an AVR for a different project)
Code: Select all
void LCD_NOKIA_C100_init(void)
{
//SET GPIO4 AS OUTPUT FOR RST LINE
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4);
GPIO_OUTPUT_SET(4, 1);
LCD_NOKIA_C100_RST_LOW;
//DELAY FOR 200us
os_delay_us(200);
LCD_NOKIA_C100_RST_HIGH;
//DELAY FOR 10MS
os_delay_us(10000);
//SOFTWARE RESET
LCD_NOKIA_C100_send_command(0x01);
os_delay_us(5000);
//SLEEP OUT + BOOSTER ON
LCD_NOKIA_C100_send_command(0x11);
os_delay_us(6000);
//PARTIAL DISPLAY OFF
LCD_NOKIA_C100_send_command(0x13);
os_delay_us(6000);
//INTERFACE PIXEL FORMAT = RGB (5 6 5)
LCD_NOKIA_C100_send_command(0x3A);
LCD_NOKIA_C100_send_data(0x05);
//DISPLAY ON
LCD_NOKIA_C100_send_command(0x29);
//SET GAMMA PROFILE
LCD_NOKIA_C100_send_command(0x26);
LCD_NOKIA_C100_send_data(0x08);
}
void LCD_NOKIA_C100_send_command(uint8_t command)
{
(*LCD_NOKIA_C100_SPI_SEND_FUNCTION_POINTER)(1, 8, 0, command);
}
void LCD_NOKIA_C100_send_data(uint8_t data)
{
(*LCD_NOKIA_C100_SPI_SEND_FUNCTION_POINTER)(1, 8, 1, data);
}
void LCD_NOKIA_C100_reset_xy(void)
{
}
void LCD_NOKIA_C100_clear_screen(uint16_t color)
{
uint8_t h = (color>>8);
uint8_t l = (color);
//CASET (COLS = 0 TO 131)
LCD_NOKIA_C100_send_command(0x2A);
LCD_NOKIA_C100_send_data(0x00);
LCD_NOKIA_C100_send_data(0x00);
LCD_NOKIA_C100_send_data(0x00);
LCD_NOKIA_C100_send_data(131);
//RASET (ROWS = 0 TO 161)
LCD_NOKIA_C100_send_command(0x2B);
LCD_NOKIA_C100_send_data(0x00);
LCD_NOKIA_C100_send_data(0x00);
LCD_NOKIA_C100_send_data(0x00);
LCD_NOKIA_C100_send_data(161);
//RAMWR
LCD_NOKIA_C100_send_command(0x2C);
uint16_t i;
for(i=0; i<(132*162); i++)
{
LCD_NOKIA_C100_send_data(h);
LCD_NOKIA_C100_send_data(l);
}
}
I have a feeling that this is something ESP specific but I don't have enough experience with it to pinpoint it. Its seems weird that the LCD is completely blank as if it't not even starting up.
The TFT is connected to ESP8266 as follows
ESP8266 --- NOKIA TFT
----------------------------
/RST ----------- GPIO4
/CS ----------- GPIO15 (HSPI)
SDA ----------- GPIO13 (HSPI)
SCK ----------- GPIO14 (HSPI)
Would appreciate any help on this
Thanks!