0:08
hello and welcome to controllers Tech
0:12
few months ago I covered a 10.1 inch
0:15
stm32 embedded display from rivety
0:19
rivety makes these displays around the
0:21
sdm-32 controllers so we get the
0:24
performance of sdm-32 with a stunning
0:27
display design and smaller form factor
0:30
we can use the touch gfx to design the
0:33
UI and the cube ID to write the code
0:37
so far they made these displays around
0:39
the H7 series mcus which has its own
0:42
advantages like high RAM and Flash
0:44
capacity high performance dual core
0:50
recently rivety sent me a 5-inch display
0:52
which is from their new lineup and is
0:55
built around the stm32u5 series
0:59
this display has a 5-inch TFT LCD screen
1:03
with a resolution of 800x480 pixels and
1:08
stm32u599 or u5a9 microcontroller
1:12
the u5 is itself a new series from
1:15
Street and it features low power
1:17
utilization with high performance
1:20
these microcontrollers come with a four
1:22
megabytes of internal flash storage
1:24
along with a super huge 2.5 megabytes of
1:29
we can basically save an entire frame
1:31
buffer in the ram itself
1:33
here is how the display looks in person
1:40
at the back we have the port for the USB
1:44
rs-485 swd power port on the right a
1:48
Rebus connector an expansion port a
1:51
Micro SD card holder and a coin battery
2:01
here is the power connector where I am
2:04
only using the pin 1 and pin 6 on the
2:08
I am using a 12 volts 1 ampere adapter
2:13
let's connect the power supply to the
2:18
I tested this display and I must say it
2:23
it overcomes all the issues I had with
2:25
the H7 based display that I tested
2:29
basically we can Flash the entire
2:31
project using the cube ID itself and we
2:35
can also regenerate the code from Cube
2:37
MX without any major issues
2:40
I will cover these points in the video
2:42
where I will regenerate the project from
2:44
Cube MX and then Flash the code to the
2:48
I will also show how to load this game
2:51
to the board towards the end of the
2:54
let's start the touch gfx and create a
2:59
I am using the latest version available
3:01
at the time of making this video that is
3:08
click on create new go to Partners Tab
3:11
and select the 5-inch display
3:14
give some name to the project and click
3:18
I am fast forwarding the designing part
3:21
as I have covered it a lot of times in
3:25
basically I am adding a background image
3:29
then adding a gauge and setting the
3:31
value range from 0 to 100.
3:35
next add a text area to display the
3:39
add a wild card here so that we can set
3:44
let's add one more text area to display
3:46
the voltage on the ADC pin
3:55
we will add another wild card here too
4:02
now go to the typography and add the
4:13
that's all for the design let's generate
4:23
open the files and open the project in
4:27
you can actually Flash the project
4:29
directly from the touch gfx itself but
4:34
I will explain this in the cube IDE
4:38
here you can see all the peripherals are
4:40
pre-initialized when the project is
4:43
the project flashed from the touch gfx
4:46
doesn't run because of this
4:49
actually when there is no SD card in the
4:52
slot the sdmnc initialization fails and
4:56
the code halts at that point
4:58
so we need to comment this out or
5:00
otherwise you insert a Micro SD card in
5:04
rivety Engineers know about this issue
5:07
and they told me that they have fixed it
5:10
so hopefully when you will purchase it
5:13
it will be fixed by then
5:15
anyway I need to leave it commented out
5:18
I haven't flashed the project to the
5:20
board yet and I will do it directly from
5:25
the code builds without any errors but
5:27
we need to edit the debug configuration
5:30
go to the debugger tab scroll down to
5:34
the external loader click on the loader
5:37
the debugger shows the error that the
5:39
loader is not found but this loader is
5:42
present inside the cube programmer
5:45
so we will just set the location of the
5:48
loader in my case it is present inside
5:50
program files SD microelectronics stm32
5:55
Cube programmer then external loader
5:59
browser for the external loader and
6:03
now Flash the project to the board
6:12
the project has been loaded successfully
6:15
so we were able to load the project from
6:17
Cube ID itself now we will regenerate
6:20
the project from Cube MX edit the code
6:25
basically I am going to use the ADC to
6:28
read the potentiometer and update the
6:30
value on the gauge and the text area
6:33
let's open the cube MX
6:36
in the meantime let's see the datasheet
6:47
it supports a wide range of voltages
6:49
from 6 volts to 48 volts and as I said I
6:53
am using a 12 volt adapter to power this
6:57
here is the pin out for the power port
7:00
I have connected the VCC to pin 1 and
7:06
we have the pin outs for the rs-485 FD
7:12
here you need to connect all the pins to
7:15
the respective pins on the sd-link
7:18
all right here is the pin out for the
7:22
as I mentioned earlier I am going to use
7:25
the ADC to read the potentiometer
7:28
the pin 2 is connected to the VCC which
7:31
is 3.3 volts and pin 6 is connected to
7:36
the pins 20 and 22 are assigned to the
7:39
adc1 and they can be used in the
7:44
for the potentiometer I will use the pin
7:47
pa7 in the single-ended mode
7:50
I have the potentiometer which has the
7:53
red wire for VCC black for the ground
7:55
the white is not connected and the
7:57
yellow wire is the ADC out
8:00
here you can see the expansion connector
8:03
has the pins numbered on it
8:06
this entire row has the even numbered
8:08
pins where we will connect the
8:13
let's connect pin 2 with the VCC pin 6
8:18
and pin 20 that is pa7 with the ADC pin
8:23
all right everything is set now let's
8:31
here you can see the channels 11 and 12
8:34
are being used in the differential mode
8:39
the pins pa6 and pa7 are switched to no
8:44
now I am enabling Channel 12 in the
8:47
single-ended mode and this sets the pin
8:49
pa7 in the single-ended mode
8:53
let's configure the parameters now
8:55
I want the ADC resolution of 12 bits
8:59
here the vbat channel is set for the
9:01
rank 1. let's change it to channel 12 as
9:05
we don't need vbat for now
9:07
that's it for the configuration
9:10
I haven't enabled the interrupt as we
9:12
will measure it in the Blocking Mode
9:15
we also need to create a task and a
9:18
queue to measure and send the ADC data
9:29
I am creating the ADC task with normal
9:40
and for the queue I am configuring it to
9:43
have five elements of integer size
9:47
that's it for the cube MX click save to
9:53
the stmmc is being initialized again so
9:58
you can confirm the changes in the ADC
10:09
our task and cues are defined in the
10:15
in the ADC task we will first read the
10:23
we also need to define the ADC Handler
10:26
as an external variable here
10:39
this map function will be used to map
10:42
the 12-bit ADC values in the range 0 to
10:45
100 so that we can send them to the UI
10:48
this file is from my test project
10:52
so we start the ADC Poll for conversion
10:55
read the value and stop the ADC the
10:58
typical process to read ADC values
11:01
then map the ADC values which can range
11:06
4095 to the values 0 to 100. now we will
11:11
check if there is some space in the
11:14
if there is then send the converted
11:16
value to the queue now we will read the
11:19
queue in the model send it to the
11:21
presenter which will send it to The View
11:24
I have covered it a lot of times already
11:26
so I am fast forwarding this part also
11:36
we check if there is some data in the
11:38
queue and if there is then read the data
11:41
and store it in the variable
11:51
Define this variable in the model header
11:54
file and make sure to include the types
11:57
header file so that it can identify what
12:20
in the presenter we will call another
12:23
function in The View
12:34
view is where we will actually send the
12:39
first convert the integer value to the
12:41
ASCII characters and store them in the
12:46
invalidate the text error 1 so the
12:48
changes can take effect
12:51
to convert the float values we need to
12:54
use the SN printf float function
12:57
I will modify this code in a while for
13:00
now I am just setting the value variable
13:03
finally we will set the value to the
13:07
all right let's build it to see the
13:11
there is an error for the adcq handle
13:14
let's include the CM sysos 2 header file
13:24
all right you will see these seven
13:26
errors when you build the regenerated
13:28
code for the first time
13:31
to resolve it go to the touch gfx and
13:34
regenerate the project from here
13:37
now rebuild the project and those errors
13:40
should be gone those errors are gone now
13:42
but we still have one error and that is
13:45
about the adcq handle again
13:48
it should have been an external variable
13:51
all right all the errors are fixed
13:53
I still need to convert the ADC value to
13:58
let's define a float variable to store
14:02
a value of 100 corresponds to the
14:05
voltage of 3.3 volts
14:08
so this should do the job
14:15
all right let's flash it to the board
14:31
here you can see the gauge is responding
14:34
according to the potentiometer the text
14:37
Area 1 shows the gauges value and the
14:39
text area 2 shows the voltage on the ADC
14:43
so we were able to make the project work
14:46
even after regenerating it from the cube
14:48
MX which is quite convenient
14:51
now before I end this video Let's see
14:54
the game I was playing in the beginning
14:59
go to touch gfx click on demos now
15:09
here are the available demos you can use
15:13
I was playing this night hits zombie
15:16
but let's upload this dice animation
15:20
click create to create the project
15:25
generate the project
15:27
I still need to comment out the sdmc
15:30
initialization but I don't need to open
15:33
the queue ID for that
15:35
just open the main file in the project
15:40
now comment out the sdmc initialization
15:46
now I will upload the project directly
15:48
from the touch gfx itself
15:51
you don't need to do this on the newer
15:53
boards which are available on the rivety
15:56
they sent me an old unit with old
15:59
firmware so I have this issue
16:08
all right you can see the animation now
16:12
this is it for this video
16:15
we saw how we can Flash the project from
16:17
the touch gfx from the cube IDE and we
16:20
can even regenerate it from Cube MX
16:24
this was the issue with the previous
16:25
rivety display I covered but this time I
16:30
I am even thinking of continuing the
16:32
touch gfx series on this board itself so
16:35
you might see more touch gfx videos on
16:38
this rivety display in the future
16:40
also there will be more videos coming up
16:43
next covering the lvgl on the rivety
16:45
display and another covering their Poe
16:48
the power over ethernet module
16:51
you can purchase the display or order a
16:54
sample unit from the rivety website
16:57
the link to the website is in the
16:59
description of this video
17:01
I will also leave the link to download
17:03
the code in the description
17:08
keep watching and have a nice day ahead