0:23
everyone welcome to controllers tech
0:27
today in this video we will see how to
0:30
interface st 7735 tft display with sdm32
0:36
i am using a 1.8 inches tft display
0:39
and i will use spi to interface it
0:42
the libraries used in this project can
0:45
be downloaded from the link in the
0:49
let's start by creating a project in
0:53
i am using nucleo f446 re for this
0:59
here is our cube mx first of all i am
1:03
going to set up the clock
1:04
as the sp i will need it to set the
1:08
i have 8 megahertz crystal and i want
1:11
the system to run at maximum possible
1:24
clock i am using spi 1
1:27
and half duplex mode will be enough
1:30
since we will only be sending data to
1:34
as you can see the clock and the mossy
1:39
i am selecting the prescaler of 32 here
1:42
so the baud rate is around 2.8 megabits
1:47
i am keeping this board rate intentional
1:51
i will show you what happens when we
1:53
increase the baud rate
1:55
this here is the pin out of my mcu
1:59
pin pa5 is the sbi clock pin pa7 is the
2:04
and i am going to use pb6 pc7
2:12
let's take a look at the connection here
2:17
other than the clock and the mossy pins
2:20
reset and the dc pins are also connected
2:36
so i am going to select the pb6 pin for
2:40
c7 for the reset and the a9 for the data
2:44
pin that's all for the setup
2:47
click save to generate the project
2:55
here is our main file let's include the
3:01
copy the c files in the source directory
3:04
and header files in the include
3:22
let's take a look at the st 7735 header
3:27
change the sbi handler here if you are
3:32
define the pins that you are using for
3:42
now define the type of the display that
3:46
and also define the new width and the
3:50
that's all the changes you need to make
3:58
here are some functions available
4:00
specific for the st7735
4:11
and gfx functions have all the common
4:14
that are used in the tft
4:22
i have included a test all function
4:24
which will perform some tests by drawing
4:27
shapes on the display
4:42
let's go back to our main file now
4:46
include the sd 7735.h
4:49
and the gfx functions.h files
4:58
initialize the display first
5:02
this function takes the rotation as the
5:06
i will keep the default orientation at
5:08
first so rotation will
5:13
now fill the screen with black color
5:22
we have more colors available as you can
5:26
see the color list is right here
5:33
and now i am going to call the test all
5:36
function to perform the tests
5:39
let's build this now we don't have any
5:58
you can see all the tests being
6:00
performed on the display
6:07
now i talked about the sbi board rate in
6:10
let's try changing it
6:18
i am going to increase it to 11 megabits
6:22
let's build and flash the new code
6:32
you can see the display processing is
6:37
so choose the board rate according to
6:41
now let's print some strings on this
6:49
i am setting the rotation to zero and i
6:52
am going to print hello
6:54
there are some more fonts available in
7:17
this here is the color of the text and
7:20
then the background color
7:22
then i am rotating the display and
7:31
rotate again and print from
7:41
let's build and flash it
7:54
you can see the display rotation and
7:58
both are working all right
8:07
this is it for this video i hope the
8:13
this code is a port from the arduino
8:15
library so please don't ask for sd card
8:20
you can download the code from the link
8:24
keep watching be safe and have a nice