 Hello and welcome to this video. I am Daniel and today I will show you the process of setting up a custom SPI display in TouchFX. By the end of this tutorial you have the expertise to create your own project from scratch using the TouchFX package. Here is our agenda for today. We are going to start with a brief introduction of the implementation. After that I will create a project from scratch showing how to set the necessary peripherals and import the TouchFX package. After finalizing this step I will include the display drivers and playmen then in the TouchFX package and finally the video will be concluded with a screen creation to be shown in the display. To follow this tutorial we need to have installed the STM32QBID, STM32QBG4, the XNUCLEO TouchFX expansion package and the TouchFX designer tool. You can find all the download links in the video description below. Don't worry if you haven't installed all these tools in your computer yet because if you just have the STM32QBID, the STM32QBG4 will be automatically downloaded when you created your first project for the STM32QBG4 microcontroller and also you can directly install the XNUCLEO TouchFX from the STM32QBID as I will show step by step in this tutorial. We will also add a link to access the project that will be created in this tutorial in the video description as well as the TouchFX wick that contains a lot of information about this package. For this tutorial I will be using the XNUCLEO GFX 01 M1 with a display which has 240 pixels by 320 pixels. The display corner mode will be set as RGB 565 which uses 16 bits for each pixel color. In the microcontroller side I will be using a NUCLEO board which has an STM32G4 microcontroller to control the display and to establish a communication between these two components an SPI bus will be used. Here are the necessary hardware to establish a communication between the display model and the STM32. First we need three pins for the SPI communication then the end reset pin of the display will be connected to the GPIO output allocated on the port A pin 1 of the microcontroller then the chip select pin will be connected to another GPIO output at PB5 the data command select pin will be connected to another GPIO output at PB3 and the turning effect pin will be connected into line 0 external interrupt of the microcontroller. Here I've already created a blank project for the STM32 G4 microcontroller and the first thing we need to do is to go to clock configuration tab to change the H clock frequency to 128 megahertz. This value was selected because it's a multiple of 32 that will be used in the SPI communication. After typing the value in the field just press enter and let the software to calculate everything for us to achieve the desired clock frequency. Now that everything was calculated we can back to the pinout and configuration tab and here under the connectivity group we have the SPI peripheral. We will enable that in the transmit only master and here in the configurations we need to change the data size of the package to 8 bits then change the per-scaler to 4 to achieve a 32 megabits per second of bulge rate. Here in the GPIO settings I will hold the shift button to select the both pins to change its configuration at same time. Here in GPIO mode I will select alternate function push pull I will enable the pull down and the output speed I will set as high. Now everything of the SPI is set. Let's go to system car and DMA to enable a channel for the SPI transmissions. Here the only thing that we need to change is the data width to the half-word to transmit 16 bytes at a time over the SPI. Now we need to set the GPIOs to control the data flow of our application. Let's start with the pb3 which is a GPIO output. Here I will set the user label as gsp underscore dcx. The next pin is the pb5 which will be also a GPIO output and its user label will be gsp underscore ncs. Next the PA0 will be set as line 0 external interrupt and its user label will be set as gsp underscore te. Finally the PA1 will be a GPIO output and its user label as gsp underscore nreset. Now we need to change these GPIO settings going to the GPIO tab under the system car group. Here in the PA0 we need to change the mode to external interrupt mode rising falling edge. For the PA1 we need to enable the pull up and change the output speed to very high. In the pb3 the output level will be high we need to enable the pull up and the output speed very high. And finally for the pb5 the output high pull up and also very high in the output speed. Finally I will go to the NVIC tab to enable the line 0 external interrupt. Then that all the peripherals of our project are set. Now we can go under the midwars group and select the xcubetagefx package. Each we will open the software packs component selector which we need to select the version of the cube touch effects that we want to use and enable that for our application. Now back to the IDE we can select the xcubetagefx package again and check the box to enable this package in our project. Note that the CRC peripheral is needed for this application so we can just enable that under the computing group. Now we need to back to the middle menu to set some configurations of the touch effects package. First in the interface let's select the custom interface. In the frame buffer pixel format let's add to the RGB 565. In the IDE is the 240 pixels and in height will be 320 pixels. In frame buffer strategy I will select the partial buffer because I'm using only the internal hand memory of the microcontroller and it hasn't the enough space to allocate an entire frame buffer for the application. In the number of blocks I will add three and I will increase the block size to 90600 and finally I will enable the partial frame buffer for v-sync. In this application we need to know what line of the display is being updated by the display controller. For that I will use the timer six to estimate what line is being updated. A better explanation of this functionality will be presented later in this video. Doing that all the needed peripherals are set and we can click in this button to generate the code. And that's all that I wanted to show you in this first video part. Thank you very much for watching with you here and hope to see you in the second part of this video for the coding part of the TouchFX implementation.