There are some great examples of interfacing a ILI9341 tft display to an esp32 but most of them use the Arduino IDE to develop-test-deploy. In this project I decided to see for myself if using the esp-idf is comparable to the Arduino. If you are not familiar with using the command prompt or Windows Powershell, you may want to gather some experience in that department. I created a directory to hold everything esp32 related: "D:\esp", you can use whatever directory you wish. I used esp
I also created sub-directories examples and projects under esp.
After your install you will have a sub-directory "esp-idf"
NOTE: Use a name with no spaces. "bobs esp" is OK in Windows etc, but not for this environment. Using "bobs_esp" is valid.
If you need to install Python and Git, do so, they are needed components.
It can be found here: https://www.python.org/downloads/
Once Python has been installed or has been installed prior, update pip
>pip install --upgrade pip
You may also require Nodejs. It can be found here: https://nodejs.org/
Here is the link to the espressif idf getting started section.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html
First to do is download the framework. For Windows, go here and follow the instructions to install the IDF via the installer.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/windows-setup.html
The installer also allows reusing the existing directory with ESP-IDF. The recommended directory is %userprofile%\Desktop\esp-idf
where %userprofile%
is your home directory. Here I substituted Desktop for a location I preferred.
Once the install is complete. You are ready to code.
Although I use VS Code to edit, I tried to add the espressif idf extension to Visual Studio Code with no success. I will re-visit that implementation at a later date. I use the created IDF Powershell (on desktop) from the espressif Windows install to run the python scripts required. Here are the basic commands you need to know in order to build a specific project/example. Just change to the project's main directory [cd]. And...
idf.py menuconfig
idf.py clean (if necessary)
idf.py build - the first build may take awhile! If you are Qapla' then you burn!
idf.py -p [port] flash monitor - port esp32 is connected typically COM6 or COM7
Ctrl-] terminates monitor session if [monitor] is specified.
This is the first example from git I tried with Qapla'(success).
PS D:\esp\examples\> git clone --recursive https://github.com/lvgl/lv_port_esp32
If you just download the folder you will get empty folders in the example and will not compile!! Why because ( --recursive ) is needed to get other components from other repositories that is required to compile.
Once this folder has completed its download, you can open your IDF Powershell and navigate to the folder and setup and compile. First run idf.py menuconfig first to setup your device.
Select Component config
Then select LVGL configuration. this is the graphics handler.
more info at:
set Maximal horizontal and vertical to match your screen size.
set tft configuration
set touch config
Once all setting have been done.
ESC to leave
Save and now you are ready to build.
Then idf.py build to compile the example. If you are error free then flash with the idf.py -p COM6 flash [monitor}.
Here is a screenshot...
Sorry about the picture quality, it's a scrolling display!!
In conclusion, the demo worked "right out of the box" and I look forward to the next project in this environment. Say tuned! Next up - interfacing i2c devices.
Cheers Nash!
Comments