spi driver for lcd interfacing
spi driver for lcd interfacing
Hi,
I would like to work on esp32 interface with lcd. Can anyone give me the updated driver for SPI.
I would like to work on esp32 interface with lcd. Can anyone give me the updated driver for SPI.
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: spi driver for lcd interfacing
We do not have a mainstream SPI driver yet, sorry; we're working on one and it should appear in esp-idf quickly. If you want to experiment in the mean time, however, feel free to take a look at the LCD driver in the NES emulator code:
https://github.com/espressif/esp32-nese ... /spi_lcd.c
https://github.com/espressif/esp32-nese ... /spi_lcd.c
Re: spi driver for lcd interfacing
It's possible to use SPI-Driver in Arduino-IDE.
(here: https://www.mikrocontroller.net/topic/405743#4789019;
and: https://www.mikrocontroller.net/topic/405743#4796334)
(here: https://www.mikrocontroller.net/topic/405743#4789019;
and: https://www.mikrocontroller.net/topic/405743#4796334)
Re: spi driver for lcd interfacing
To add to that, we have written some codes for building a UI on ILI9341, and we can push the sample codes as soon as the SPI driver is out.
Re: spi driver for lcd interfacing
Here's an example code for ILI9341 using the adafruit library & Sermus' compile of ILI9341 on ESP8266 found here : https://github.com/Sermus/ESP8266_Adafruit_ILI9341.
It's now using a finished SPI driver & it can be used for building a simple UI on the screen. It's based on the esp-idf official sdk, and you can directly run a make flash in the example folder attached with this reply. It's yet to be merged, hence the attachment.
It's now using a finished SPI driver & it can be used for building a simple UI on the screen. It's based on the esp-idf official sdk, and you can directly run a make flash in the example folder attached with this reply. It's yet to be merged, hence the attachment.
- Attachments
-
- ili9341_ui.rar
- (100.45 KiB) Downloaded 1129 times
Last edited by ESP_nilay on Wed Jan 25, 2017 6:54 am, edited 2 times in total.
Re: spi driver for lcd interfacing
Hi Nilay,
Thank you for your sharing.
I download this firmware to ESP_wrover, but no response. Is it supposed to run on ESP_wrover? Or I should use another board?
Thank you for your sharing.
I download this firmware to ESP_wrover, but no response. Is it supposed to run on ESP_wrover? Or I should use another board?
Re: spi driver for lcd interfacing
hi ESP_Greg,ESP_Greg wrote:Hi Nilay,
Thank you for your sharing.
I download this firmware to ESP_wrover, but no response. Is it supposed to run on ESP_wrover? Or I should use another board?
cause i get last days one of the fantastic ESP-WRover Kits from Santa Claus
https://twitter.com/eMbeddedHome/status ... 8278486016
( test on DevKitC )
https://twitter.com/eMbeddedHome/status ... 6283441152
i can test and help you ( thanks @espressif )
no sure what fail in your ESP_WRover
first, see the shema of the ESP_WRover Board
then change the code in the Header File "Adafruit_ILI9341_fast_as.h"
to the ESP_WRover Kit Shema:
DC Data ( Gpio 21 on Wrover )
Backlight BKL ( GPIO 5 on Wrover and swap 0,1 )
RST Pin ( GPIO 18 on WRover )
Code: Select all
// orig
// #define TFT_DC_DATA GPIO_OUTPUT_SET(25, 1)
// #define TFT_DC_COMMAND GPIO_OUTPUT_SET(25, 0)
// #define TFT_DC_INIT PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO25_U, FUNC_GPIO25_GPIO25); TFT_DC_DATA
/* changed rudi */
#define TFT_DC_DATA GPIO_OUTPUT_SET(21, 1)
#define TFT_DC_COMMAND GPIO_OUTPUT_SET(21, 0)
#define TFT_DC_INIT PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO21_U, FUNC_GPIO21_GPIO21); TFT_DC_DATA
// orig
// #define TFT_BKL_INIT gpio_set_direction(GPIO_NUM_16,GPIO_MODE_OUTPUT);TFT_BKL_ON
// #define TFT_BKL_ON gpio_set_level(GPIO_NUM_16,1)
// #define TFT_BKL_OFF gpio_set_level(GPIO_NUM_16,0)
/* changed rudi */
#define TFT_BKL_INIT gpio_set_direction(GPIO_NUM_5,GPIO_MODE_OUTPUT);TFT_BKL_ON
#define TFT_BKL_ON gpio_set_level(GPIO_NUM_5,0) // Important - here was 0,1 swap so your screen is now light
#define TFT_BKL_OFF gpio_set_level(GPIO_NUM_5,1) // Important - here was 0,1 swap so your screen is now light
// orig
// #define TFT_RST_ACTIVE GPIO_OUTPUT_SET(17, 0)
// #define TFT_RST_DEACTIVE GPIO_OUTPUT_SET(17, 1)
// #define TFT_RST_INIT PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO17_U, FUNC_GPIO17_GPIO17); TFT_RST_DEACTIVE
/* changed rudi */
#define TFT_RST_ACTIVE GPIO_OUTPUT_SET(18, 0)
#define TFT_RST_DEACTIVE GPIO_OUTPUT_SET(18, 1)
#define TFT_RST_INIT PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO18_U, FUNC_GPIO18_GPIO18); TFT_RST_DEACTIVE
next step: driver hspi.c
change the Pins for HSPI like ESP-WRover used the pins for HSPI
Code: Select all
void hspi_init(void)
{
/*GPIO Inits according to Dev board for ILI9341*/
spi_fifo = (uint32_t*)SPI_W0_REG(HSPI); //needed?
// orig
// PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO19_U, 2);
// PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO23_U, 2);
// PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO18_U, 2);
// PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO5_U, 2);
/* changed rudi */
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO25_U, 2); //MISO GPIO19 // -> 25
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO23_U, 2); //MOSI GPIO23 // -> 23
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO19_U, 2); //CLK GPIO18 // -> 19
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO22_U, 2); //CS GPIO5 // -> 22
// orig
// gpio_matrix_in(GPIO_NUM_19, HSPIQ_IN_IDX,0);
// gpio_matrix_out(GPIO_NUM_23, HSPID_OUT_IDX,0,0);
// gpio_matrix_out(GPIO_NUM_18, HSPICLK_OUT_IDX,0,0);
/* changed rudi */
gpio_matrix_in(GPIO_NUM_25, HSPIQ_IN_IDX,0);
gpio_matrix_out(GPIO_NUM_23, HSPID_OUT_IDX,0,0);
gpio_matrix_out(GPIO_NUM_19, HSPICLK_OUT_IDX,0,0);
// orig
// gpio_matrix_out(GPIO_NUM_5, HSPICS0_OUT_IDX,0,0);
/* changed rudi */
gpio_matrix_out(GPIO_NUM_22, HSPICS0_OUT_IDX,0,0);
spi_attr_t hSpiAttr;
hSpiAttr.mode = SpiMode_Master;
hSpiAttr.subMode = SpiSubMode_0;
hSpiAttr.speed = SpiSpeed_20MHz;
hSpiAttr.bitOrder = SpiBitOrder_MSBFirst;
hSpiAttr.halfMode = SpiWorkMode_Half;
spi_init(HSPI, &hSpiAttr);
}
dump your Firmware from ESP-WRover before you flash with new firmware
flash your ESP-WRover with the example and smile
@ESP-Nilay
thank you. good work! honest good work
two things for proposal:
-> make pins as user friendly define and use menuconfig for the PINS example
see blink example how user can set gpio in menuconfig
-> more from you ( great worker! )
btw: You are a candidate for "ESP_ " cause your Member start with "ESP_ "
like your work - good candidate
hope this helps
thanks again for ESP_WRover Kit espressif!
best wishes
rudi
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
Re: spi driver for lcd interfacing
rudi, thanks!~~~
I'm just rookie on ESP32. I will keep working on that~~~~~~
I'm just rookie on ESP32. I will keep working on that~~~~~~
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: spi driver for lcd interfacing
Fyi, do keep in mind that that SPI driver is preliminary. We're working on a different one which is probably going to have an entirely different API, but which should make it possible to easily talk to different devices on the SPI-bus from different parts of the program.
Re: spi driver for lcd interfacing
Nice to see my code is in demand. Sad to see the credits are lost.ESP_nilay wrote:Here's a driver & example code for ILI9341 using the adafruit library.
Who is online
Users browsing this forum: No registered users and 14 guests