0:09
hello and welcome to controllers Tech I
0:12
have covered different SDM 32 embedded
0:15
displays from rivy in the past that
0:17
includes the 10-in display 7-in display
0:20
and the 5in display we have also seen
0:24
how to use the touch gfx and the lvgl on
0:28
displays one thing that I was getting a
0:31
lot of requests about is the ethernet
0:35
displays majority of the applications of
0:38
these displays are industrial and hence
0:43
necessity so today in this video we will
0:45
finally cover the ethernet on SDM 32
0:50
displays rivid has sent me this SDM 32
0:54
h7p OE addon the power over
0:58
ethernet I will just call it the
1:02
module this module can connect to the
1:04
existing rivid SDM 32 H7 based displays
1:09
and enable the ethernet functionality
1:12
displays it can support the ethernet
1:15
speed up to 10 mbes per second although
1:19
there is a very important point to
1:20
consider before you purchase it it is
1:23
not compatible with the older series and
1:26
hence if you have a 10-in display it
1:28
should be revision 1 4 or newer
1:32
similarly for the 7-in display it is
1:34
compatible with the revision 1.1 or
1:37
later so make sure you check the
1:40
revision on the display before
1:41
purchasing the ethernet
1:47
module here is how the module looks in
1:51
person you can see at the back it has
1:53
the pins to connect to the
1:55
display on the front there is a RJ45
1:59
connect Conor that supports the Lan 8742
2:03
drivers I am going to use the rivid SDM
2:06
32 H7 based 7in display which I covered
2:11
video here we have the two connectors
2:14
where this module will connect to you
2:17
can see this board is the revision 1.2
2:20
so the module is indeed compatible with
2:22
the board let's connect the module to
2:26
the display now to ensure the proper
2:29
connection align the screw holes
2:31
together you can connect the module in
2:34
two different ways if you have the rout
2:37
that supports power over ethernet you
2:39
can simply use the ethernet cable to
2:42
power the module and the board if you do
2:44
connect to the poe router Molex power
2:47
connector shall be disconnected
2:49
otherwise it can lead to overheating the
2:51
PO adapter rivid will update Poe Lan
2:55
add-on design to select the power source
2:58
automatically but for the current
2:59
current add-ons it needs to be managed
3:01
by the user new Poe add-ons will be
3:07
December but I am connecting the cable
3:09
directly to the computer so I need to
3:12
power the board with the power connector
3:14
itself you can see the LEDs are blinking
3:16
this is because the test program is
3:20
display for now I would recommend not to
3:23
use the touch gfx if you want to use the
3:26
ethernet I have already mentioned how
3:29
hard it is to regenerate the project
3:31
from Cube MX on these H7 based
3:34
displays and if we copy the project
3:37
somewhere else like we did in the
3:39
previous videos it would still be hard
3:41
to work with the ethernet as there are a
3:43
lot of files that need to be
3:45
included the solution is to use the
3:49
lvgl I have covered in the previous
3:51
video how convenient it is to use the
3:56
displays we can regenerate the projects
3:59
we can can even flash them directly from
4:02
IDE I am going to use the lvgl where I
4:05
will design a simple UI and then make
4:10
ethernet I will start the project from
4:12
scratch so let's download the rivy lvgl
4:15
repository and the lvgl version
4:19
8.3 now extract the downloaded files and
4:22
rename the lvgl directory open the rivy
4:26
project folder go to middleware third
4:30
lvgl folder and copy the lvgl folder
4:36
here let's import the project to the
4:52
ID all right the project has been
4:54
imported so let's open the ioc file to
4:57
set up the ethernet I have covered a lot
5:00
of videos on the ethernet and if you
5:02
have seen the first few videos it will
5:05
be easier for you to understand what I
5:08
next otherwise just follow what I will
5:11
do here here you can see the ethernet is
5:15
already enabled for the M7 core the
5:19
board uses the ethernet mode R
5:22
Mii the RX descriptor address is at 3
5:25
million hex and TX descriptor is at 3,2
5:30
hex we will leave these things to
5:33
default just keep in mind these
5:35
addresses as we need to Define them in
5:38
script go to the nvic tab and enable the
5:44
interrupt the pins are already
5:46
configured and they are correct as my
5:48
test program worked with these
5:50
pins now go to the middleware section
5:54
and enable the lwi for the M7
6:01
here we will disable the DHCP and set
6:04
the static IP for the
6:06
module this is the same address that I
6:08
used throughout the ethernet series and
6:14
too the Heap size needs to be bigger so
6:17
I am setting it to 14
6:19
kiloby set the Heap pointer to 3,
6:24
4,000 leave the rest of the
6:28
default go to the platform setting and
6:32
8742 here now go to the free
6:38
RTO we need to increase the Heap size
6:41
since we will be creating few tasks and
6:45
runtime just set it around 30 or 32
6:49
Koby the default task stack size is set
6:52
to 512 bytes and I am increasing it to 1
6:57
Koby we still need to to configure the
7:00
mpu but we will come back in a while
7:03
that is all the configuration we need
7:05
for now click save to generate the
7:08
project or right here in the application
7:11
folder you can see the lwi folder got
7:15
generated open the etherne if. C
7:19
file here you can see the TX and rxd Ma
7:23
descriptors have been assigned an
7:25
attribute we need to Define these
7:27
sections in the Flash script file but
7:31
before we do that let's build the
7:37
once you will see these errors in the
7:40
build actually the ethernet
7:42
initialization file is generated twice
7:45
so we will disable the one which was
7:47
generated prior to our
7:49
modification right click on this file go
7:52
to Resource configuration and select
7:56
build now select all and click okay okay
8:00
here you can see the file has been
8:05
configurations let's build the project
8:07
again all right we don't have any errors
8:11
now here you can see the address 3
8:13
million hex is in the ram
8:16
D2 this is where the dma descriptors are
8:19
defined right now none of the space in
8:22
the ram D2 is occupied let's create a
8:25
new section in the flash script now
8:28
Define the RX descriptor section at 3
8:31
million hex and TX descriptor section at
8:41
hex all right let's build the code again
8:45
now you can see around 600 bytes have
8:47
been occupied in the ram
8:49
D2 keep this in mind as we would need
8:55
configuration just like the dma
8:57
descriptors we also need to define the
8:59
memory pool here an example is given for
9:05
same let's copy this and paste in the
9:15
code we need to remove these
9:21
slashes let me rename this section to RX
9:25
pool and also delete this array
9:32
hover on the memory pool definition and
9:34
copy the array name from
9:39
here now we need to Define this section
9:42
in the flash script we will put it in
9:54
itself at an offset of 400 we have the
10:03
pool let's build the code again here the
10:07
D2 Ram's occupancy has been increased to
10:10
19 kiloby now this means all our
10:13
definitions are set now let's go back to
10:16
the cube MX to set up the mpu the mpu
10:20
configuration is in the system code
10:23
M7 in the ethernet configuration we set
10:27
the start address of the dma description
10:29
at 3 million hex and we saw in the ID
10:32
that the total space occupied by these
10:34
descriptors is around 600
10:36
bytes also we have set the lwi Heap at
10:41
3,400 hex and the total space occupied
10:47
kiloby we need to configure the mpu for
10:52
locations let's enable the mpu in the
10:55
default privileged mode now enable the
10:59
mpu region and set the address at 3
11:02
hex since the dma descriptors are
11:05
occupying 600 bytes we will set the
11:10
kilobytes permit all the access set the
11:13
instruction access and enable the
11:20
permission Now set the second region at
11:22
the address 3, 4,000
11:25
hex the Heap size is 14 kiloby so we
11:29
will set the region of 16 kiloby here
11:33
set the text field level one enable all
11:36
the access enable instruction access and
11:40
permission you can watch the mpu series
11:43
to understand what these permission
11:45
means and why they are
11:47
important all right let's generate the
11:50
code now the eth source file has been
11:54
generated again so exclude it from
11:57
build let's build the code
12:06
now our earlier modification is
12:08
unchanged as we defined it in the user
12:14
section let's take a look at the free
12:19
file here in the default task the LW IP
12:25
initialized this will basically
12:27
initialize everything needed for the
12:29
ethernet to work the code builds without
12:32
any errors so let's flash it to the
12:34
board we need to create a new run
12:37
configuration first double click on SDM
12:41
32 application and this will create a
12:45
configuration now go to the debugger Tab
12:48
and scroll down to external
12:50
loaders I already have the loader for
12:53
this board so I will just add it here I
12:56
will leave the link to the loader in the
12:58
Des description below now click apply
13:02
and click run to flash the project to
13:05
board you can see that the project is
13:10
board actually by default the widgets
13:13
demo project loads to the board so
13:15
that's what you are seeing on the
13:20
display let's ping the board to confirm
13:22
if ethernet is working fine I have
13:25
connected the board directly to the
13:27
computer and therefore or I need to
13:29
configure the ethernet settings on the
13:31
computer also by default the ipv4 is set
13:35
to DHCP so change it to static IP and
13:39
then set the IP and Max as shown here if
13:42
you are connecting through the router
13:44
you don't need to do this and you can
13:46
proceed with the next
13:49
step all right let's ping to the IP we
13:55
MX here you can see we are getting the
13:58
response so this means that the
14:07
successful just to show you that this is
14:10
working I will ping to some other
14:16
address here you can see I am not
14:18
getting any response from it so the
14:21
connection to the ethernet is successful
14:23
that means we can use everything that we
14:25
covered in the ethernet tutorial series
14:29
to demonstrate an example I will create
14:31
an UDP server on the board and then we
14:34
will connect to the server from the
14:36
computer I am going to build an UI also
14:39
which we will use in combination with
14:41
the ethernet let's use the same project
14:44
that we created in the previous video I
14:47
am going to readjust things
14:52
here this big text area will display the
14:55
data received from the client on the
14:58
other other hand the server will send
15:00
the slider's value to the
15:12
client the only change we need to make
15:15
here is in the event part the event
15:18
should trigger when the slider is
15:20
released rather than when its value is
15:23
changed this will slow down the rate at
15:25
which the event will trigger we are
15:27
still calling the same function slider
15:33
changed all right let's export the UI
15:37
files we will now copy the UI folder
15:43
folder I am putting it beside the lvgl
15:50
itself let's refresh the project so that
15:53
we can see it here here we got the UI
15:56
folder I have the ud PP server files
15:59
which will allow us to create a server
16:01
on the board let's copy these files into
16:06
directory here you can see the files
16:09
let's quickly see the source
16:12
file this is the same as I have
16:14
explained in the ethernet tutorial
16:17
series although I have made few
16:19
modifications here the UDP thread
16:22
creates a new connection
16:24
identifier then it binds the connection
16:26
to Port 7 and the available IP address
16:29
basically what we set in the cube MX if
16:32
the binding is successful it will
16:35
receive the data from the client
16:37
basically it will wait until the data
16:40
has been received if the data is
16:43
received we will extract the client
16:45
address and client port and store them
16:49
variables then extract the payload and
16:52
store it in the message array and then
16:55
display the message on the text area
16:57
that we created on the U I the object
17:00
name is text area one and the text here
17:02
is the message buffer I have defined one
17:05
more function to send the data to the
17:08
client the parameter of the function is
17:11
the pointer to the buffer that needs to
17:13
be sent here we first Define a p buff
17:17
then calculate the size of the data to
17:19
be sent then allocate the P buff of this
17:23
size copy the data into the buffer and
17:26
then refer the P buff to the main net
17:28
buff then connect to the client using
17:31
the address and Port we saved earlier
17:34
then send the data to the client and
17:37
clear the address and the
17:39
buffers the UDP server in it function
17:42
creates a new thread the UDP thread that
17:51
above since we have copied the UDP files
17:54
in the core folder we need to add it to
18:03
go to the free rtos source file and
18:06
after the lwip has been initialized
18:09
initialize the UDP server this will
18:12
start the entire process of the UDP
18:25
server the UDP send function will be
18:28
used used to send the data to the client
18:30
so we will call it inside the UI event
18:34
let's include the main header file and
18:36
the UDP server header file when the
18:39
slider is released the slider changed
18:42
function will be called here we will
18:45
first get the value of the slider then
18:48
convert the value in the character
18:49
format and store it in a buffer Now call
18:53
the UDP send function and pass the
18:55
buffer to it that is it let's build the
19:02
now we have some errors in the fonts
19:06
actually I used the bigger fonts in the
19:08
UI which are not enabled in the lvgl
19:11
configuration file let's enable
19:15
it also in the main file we need to
19:18
initialize the UI so include the UI
19:21
header file after the lvgl has been
19:25
initialized call the UI init function to
19:36
UI let's rebuild the
19:41
project all right there are no errors so
19:49
board I am going to use the packet
19:51
sender to send and receive the UDP
19:56
packets all right the UI has been loaded
19:59
onto the display this is the server
20:02
address and the port is seven the
20:05
connection is set to
20:09
UDP let's send hello world to the
20:14
server here you can see we got the data
20:17
on the display let's adjust the slider
20:20
on the display here we got the data from
20:23
the server containing the slider's
20:27
value let's send another string to the
20:39
display here we got it on the UI we
20:42
received the updated sliders value on
20:45
the computer too so we are able to
20:48
communicate to the display using the UDP
20:51
protocol basically you can use
20:53
everything that we have covered in the
20:55
ethernet tutorial series that includes
20:57
the UDP server and client TCP server and
21:04
Etc I will leave the link to the
21:06
playlist in the description
21:08
below this is it for this
21:11
video I hope you understood how to use
21:13
the power over ethernet module from
21:16
rivy you can purchase the module from
21:21
description the link to download the
21:23
code is also in the description below
21:26
leave comments in case of any doubt keep
21:30
watching and have a nice day ahead