Hello.
Welcome back.
So in this section we are going to see how to deploy D M nest data sets module on a while.
As Tim Pettit to microcontroller in order to make this a very practical very practical tutorial what
we're going to do is we are going to use the SDM to a discovery board with the LCD touch screen on it
and for those of you who are not aware of amnesty I'm sure you are aware of it but for the 1 percent
out there the m this data sets is basically a data set for training a model to be able to detect handwritten
characters.
So at the end of this section or at the end of this case study I should say we should be able to write
something on our way out LCD touch screen and then our neural network is supposed to predict it for
us and we're going to have a motto trained in care us and then we're going to take this module pass
it through our SDM 32 cube Amex AI and then run analysis on it and then convert it to a C function or
converted to C type and then deploy our neural network using this model.
So I'm going to get started I'll say access port selector and this time we're not going to use the like
I said we're not going to use the nuclear board we're going to use the disco board with the with the
LCD screen on it.
So if you don't have that board currently I suggest you just watch along and then if you want to practice
you ordered a board late later.
Yeah I think this is the most practical way to show this.
We could have just written a dummy model deploy it on the new clue and there'll be no way to actually
get a real world example about it.
So this the board we're going to use we're going to use this as temp 32 F for 1 f 4 2 9 1.
It's corporate board.
So you can order this board this board here SDM 32 f 4 2 9 discovery kit and it's core it's got a touch
screen um and we'll be able to use that in a way.
So that's what we going to use.
I've selected this board here.
And what I'm gonna do actually
is I'm going to select corporate for here.
Actually I'm going to close this and open it again.
So I'm going to close Cuban mics and started again because we just installed our cube I expect us to
have something here to to allow us to analyze the model whether it fits on this microcontroller.
So just bear with me I'll close this and then I'm going to open it again.
SDM 32 Cuban X
right.
It's open it.
Okay.
I'm going to go to access to port selector.
Before we do that I'm going to go back to my niche embedded software packages to make sure my cube is
indeed restored.
The C Okay we have this one we have version 5 installed.
Okay.
So I'm going to click over here access port selector or access MCU selector or just click any of them.
It doesn't matter cause this is it.
This is Port selector MCU selector.
So if you click access MCU selector it starts with this page by click port selector.
This page starts.
Okay.
So I go to see you selector.
The reason I'm doing this is when I come to MCU selector it allows me to enable artificial intelligence.
If you are at the port selector there is no way to enable it.
So MCU selector Andy Debord I'm going to use.
Let's take a look at it.
We're going to use the estimate that you brought this one here with the LCD screen is gone LCD touchscreen.
We can create a simple graphical user interface yet such that we can make people write something here.
You can simply write and then pass it through the neural network to predict what.
No you've written using the amnesty motto.
So this is the embassy you are going to be using SDM 32 F for a 4 2 9 0.
So I'll come to see you selector and then I'll search this particular MCU
code that it's called SDM said it to f 4 2 9 0 4 2 9.
I Okay so I just select any of them so I'll just go with this and then I'll come down here.
I'll see enable artificial intelligence.
And over here we can just upload our model to see if it fits in this microcontroller that we've selected.
Cuba makes allows us to firstly check the MCU that we've selected Well it's got enough memory to deal
with the model we're dealing with.
So right here on artificial intelligence I'm going to upload both the M D.
I'm going to upload a model I should see you select a model type here.
The model I'm going to upload is from Chris so select Chris over here and um yeah.
I've expanded this by mistake and then I'm going to browse to the location of the model simply let's
see if the model stored over here.
It's in Cuba.
Mix this one m this Chris model so it's in but h fi formats.
I'll double click this and then once that is done out click analyze to see.
So he's gonna spend some time analyzing the model this generates in the network.
Right.
I just received an error.
Okay.
So the reason I received the arrays because I'm the type I'm using here does not correspond with the
type of model I'm uploaded.
So what we want to do is upload both the model and add to the topology.
So I'm gonna some like to model in topology of a here and then a topology saved in Jason formats and
the model itself is a dot H5.
So I selected the model here and then browse over here and then topology.
I've got my Jason over here modeled what Jason.
And then click analyze
so you've got a changed type to model in topology.
Yeah
okay.
It's analyze the model.
It says the minimum flash is 940 kilobytes and then the minimum Rom is about one point five gigabytes.
Okay so this doesn't fit into our MCU.
This is how much a flush and how much RAM our MCU has.
So if you compare this and remember these um these these estimates do not take into account the um the
the the space requirements of the other use a code.
This is just to do with a neural network and a weight.
Right.
So maybe your code your programming code and other things might take extra space but this just gives
us an idea of the requirements of space which regards to the neural network if we wish to compress we
can come over here and apply a compression as well going to apply compression of H to see what I get
or click over here.
S on a license.
So there's the current size.
Let's see if we can reduce this.
After compression and compression will lead to some form of you know degradation in in the performance
of the model as well as you can see we've reduced the flush requirements drastically.
It's now one hundred and twenty three.
So if we wish to compress we can compress as well.
So anyway yeah we're going to set it up properly when we start a project.
So I'm gonna disable this.
This is just to analyze if our model fits into our microcontroller and we have to do this before you
know continuing.
So I'm gonna come to broad selector and this is the board we're using and like I said and this is we
were testing the module on the MCU of the Board estimated 2 4 2 9.
I saw a double click this and it would ask Initialize all power flows without default mode.
Oh please.
Yes this is very important to you if you don't.
If you do not click yes you might have to spend about 30 minutes initialize and a touch screen and other
things.
So I'm going to click yes over here and like I mentioned earlier.
If you do not have this board you can just watch the video and if you feel like you want to try it out
you can buy the board and you can you know run other experiments on it.
Okay.
So this one we have this the microcontroller with initialize that to its default mode.
That is why we have this picture here.
Right.
Okay um okay.
So generally the default mode should do.
But let's see maybe we want to customize a few things.
Let's go to clock configuration and then I'm going to push it to the maximum clock by typing 1 8 over
here
searching for a solution it says.
So that's going to take a while.
It says no solution found.
Do you want to use other sources.
I'll click Okay.
Sometimes the clutch generator has problems.
Given this the clock.
So if we don't get the one 80 hertz here would do it manually after we've generated our code.
It would do that.
Okay.
It's still roaming up and down
I'm simply going to consider this right.
So we ended up with this.
We ended up with this clock.
I'm going to click it.
I just I and I'm going to just give one sixty eight here no solution for this.
I see.
Okay.
It's accepted this HSV 168.
No problem.
So when we go to the code we would change it to 180 but we need not change it.
I mean this would work 168 megahertz.
It's a whole lot of megahertz for our application.
So that's just by the way.
So come back to pin out and plug configuration and the next thing I'm gonna do is check what we have
under the arm the connectivity connectivity we have our SPF ice I'm going to take a look at SPF 5 over
here.
Remember these SPF ice and other things are required for the touch screen and the LCD that is already
connected to deport.
So over here what I'm simply going to do is I'm gonna change DSM the preschooler for the port rate over
here it's given a preschool of 16 I'm going to set it to now.
Yeah.
And Vic it's not a neighborhood here that is fine.
Keep this.
And then the next day and I'm going to go to the.
I'm going to stay.
It's connectivity and we've got USP O T G here and I'm simply going to disable it if it's a neighborhood.
Let's see.
Yeah.
There's nothing to be done here.
Why do we have global interrupt here.
I see.
Right.
There's nothing.
There isn't much to be done here.
So like I said D.M. that default sets in.
It's like 99 percent.
Okay.
Just that I just want to be sure we've got a DME to d over here.
Let's take a look at it.
Um.
I'm simply going to disable global interrupt if it's a neighborhood okay of disabled that and we've
got the L T DC and this one as well.
If global interrupt a neighborhood I'm simply going to disable them so I'll come to and Vic's settings
over here and then let's see if we've caught in the middle was a neighborhood that we don't want we
can disable them for instance we don't need free artists we're not using free are just yes or disable
this USP Host Oh disable this as well okay.
Right.
So we're looking good so far.
Well we have to do is call figure out our artificial intelligence module so we click additional software
Yeah and then it brings us over here and over here we can include additional software.
I'm going to expand the cube a I over here and the next part cube I in here and then I'll take the call
and then expand artificial intelligence application or expand this over here and then our select application
template okay.
So so we simply click Okay.
Once we are done and then a new tab appears here called additional software or expand this and then
I'll click SD microelectronics and then when I click we'll get this here we get what we selected cube
cube a and then artificial intelligence application and then we've got a set of parameters here.
So we come to the network and we can give our network and name call this SDM Pettit to amnesty amnesty
next.
Okay so then once that is done if we can load a one network and topology it's already called the VM
the path over here cos we tried it before so it's already got a here.
So if you don't have your network in topology you can just browse and look at your daughter each file
and then you chase and file here.
Once that's done we can analyze or click over here to analyze and this is going to run to analyze the
network
and it's finish analyzing and it's given us the what it sees in the Indian network.
So it is a simple network if its performance is not good.
We can still change it with a better network would I recreate in the project from scratch.
Right.
So I'm going to close this and we can validate on the desktop or on the targets I'll click validate
on desktop over here
OK.
So there's that validation results if we want to take a closer look at it.
You can certainly do so right.
So we've got this setup where we have to do now is set up certain parameters of our network also setting
hardware requirements of our network
in fact I'm going to give our network a generic name network.
This will allow me to simply you know change the network data and the dot see files with separate networks.
If I want if I want to use a better network I don't want to rename those files before changing them
so I'll just keep them.
I'll call this generic network and you would understand why I'm keeping this later.
I can give it whatever name you want as long as you pay attention to what is going on here right.
Right.
So this all we have to do so far.
If you have an older version of Cuban makes five.
You would see that there's not a top here known US platform or settings and what you do is you click
on the top and you would find you at X and then you've got to click a drop down menu to select your
you reports that you want to use for your neural network and you simply select you to one in fact or
you add to that you are tier.
There's a lot that we enable somewhere.
The only you out that we enabled you are one that is still the one that would show up because that's
still the one we are using.
So you select that you UT and what does that would do is it would allow us to be able to monitor our
application from a serial program on the computer.
But in this new old version of Cuban mix it seems it detected it automatically so we need not make the
selection.
Right.
So let's take a look at the system view.
Let's see what we have so far.
OK.
We've got all of these.
This one here is shouldn't we shouldn't be using USP.
So I'm going to click this and disable it.
It's disappeared okay.
Right.
So I think we are set.
Okay.
Also in our neural network we could have compressed if you want to try compressing and other things.
You can certainly try this on network.
Remember I give it a generic name network you can give it whatever name you want.
If you want to compress you can compress and see it's performance.
Okay.
So now we can come to project you over here and we can generate our project but something important
we have to do is some increase the heap size and a stack size.
I'm going to order zero here and then another zero here and then see I'm going to give our project a
name.
I'm going to call it amnesty.
I'm simply going to call it
amnesty like this
capital amnesty.
Okay.
And I'm going to come to code generator and then create the s h and see folks come back to project and
then we're going to use the estimate that to keep IP over here.
Because if we used to call them decay we've got a 52 kilobytes code limit and I perceive that what we
have here is going to be created on that end.
Most of you won't be able to run the code unless you have a professional version of Call you vision
only you have a professional license but estimate that to cube I.D. allows us on a limited size so select
that and then before we move on now actually generates a report I'll come to follow right here and click
generates report and it says Give project a name first.
I'm going to call this amnesty.
I gave the four the name amnesty
numbness this fine and then this
core this project's location embedded amnesty.
Oh bother.
Okay but at Amnesty.
Right.
We use an estimate that to Cuba IDC generates under the.
I'm going to uncheck this and then I just click to generate that quote by clicking over here
yeah I was supposed to generate the reports but would do that later.
It's generating.
I'm going to click allow access over here.
And finish a click open project to open it.
And this is the first time we'll be open in Cuba D E.
It's asking this question How do you want to open this type of FA.
This means my computer hasn't located the entity to key vital e I remember we installed it did we.
I'm gonna I'm gonna check if my cube IDC is active.
Come over here SDM 32.
This is Cuba idc.
This the first time I'm working with it the first time I'm open in it after installation certainly of
use that
okay.
This would take a while.
This the first time we open it.
Okay.
It's created a workspace.
I'll just click launch
right so click allow access or if I hear
so this the cube IDC and it echo the Cuban makes integrated.
You can actually view your Cuban mix setup in this idc if you want to let him.
If you want to learn more about Cuba IDC you can search certainly take a look at getting started.
Um yeah.
So I just close this.
So the setup looks fine.
I'm going to open our newly created Project up close.
Q by D E.
Do you want to exits.
Yes I want to exit.
I'm gonna generate our report generate a report and then I'm going to open the folder.
This would give me the forward off my project as well.
So this is the um the report we generated.
Right.
And this report gives all the um the options that we made.
Okay right.
So let's open up project.
I'm going to come to this.
My project forward.
I remember I created a new photo called E and before embedded embedded amnesty in the name of the project
is amnesty.
So I'm gonna come to SDM 32 cube IDC for that in here and in here I'll double click see project file
to open our project from Q BY THE
GOING TO LUNCH.
IT'S STRANGE is called No Name.
You have to remember cube I.D. is very new so it would have certain issues and you've got to bear with
it for a while you're still out version one point two.
So this is very new
right.
Successfully imported Project M next into your workspace.
Okay.
This is good stuff right.
So here we go.
There s the project is still work and whenever you see this going on it means there's something happening
in the background.
I'm gonna close my SVM 32 um my Cuban mix when I close this
Okay let's pull it up project and see what we have.
This whole project you can simply expand it you can expand the tree to see what we have.
This application here over here we have use.
And then in here we have all of our use of force.
This may not see
this what we have.
I will have to increase the font size a bit.
Come over here window preferences.
I'll come to general appearance color in front.
And then I'll actually come to Ed over here.
I'm the general.
I think editors I'll expand editors and then text editors and then see colors and phones.
I'll click this over here.
We approach back here.
It says the current phone to size 10 query new.
I'll click edit over here
okay.
And I'm going to set this to size 16.
I think is fine and then okay and then apply and then apply.
Okay.
Right now this is Port enough.
Okay so let's start off by building our project.
I simply click over here build to see if we have any errors.
So it's built in right.
It's built successfully without any errors less less verified to see what the path or paths are sets
correctly or right click over here go to properties and then I'll come to general and then parts and
symbols.
Okay.
Um we've got these um we've got this uh we've got marks under them.
Meaning they will be problematic would have to fix them in Um over here.
The default is the relative port.
It says over here using relative parts.
That's ambiguous and not recommended.
It can cause unexpected effects.
And these are the unexpected effects.
Having these marks here if we get to some if we end up building and if we build later on in the project
if we are trying to make use of any of the files located in these various locations we might have arrows
to fix these in the library as well.
The library has the same the same issue we will have to bring the library.
We've got to have access to the library as well.
Anytime you see this yellow triangular Mark mean.
It's got problems.
So we'll fix these in the next lesson.
Yeah.
So that's all there is for this very lesson.
I'll see you in the next lesson.
Have a nice day.