 Okay, now part about STM32 Coupemix about the install you are received the complete package for motor control session but if we upgrade the new Coupemix tool you can found in this website in ST website and the packages for micros for families be careful the Coupemix needed to Java to the properly working the Coupemix support those ID Atolic, Atolic True Studio and System Warbench are free for STM32. IR and Kale are free and for the debugging you need the ST Link drivers in your PC. You can found in this website and also you can found in receive package and for installing you need admin rights. If you use the alone the STM32 Coupemix this is the main window and how to use and how to works with STM32 Coupemix. In the repository it's all code all functions everything and in the through the ID is generated through the repository to your project this is the ideology of Coupemix. Be careful with the placing of repository for motor control because the our at now the part of STM32 workbench use the Coupemix but in the path of repository needs to backslash for the proper working. If you don't add to the repository sometimes appended you haven't got in the in the path you can see some errors during the generation in motor control workbench and you can you can check in update the setting which is the slash is in the after repository and in the repository you can found all packages which was downloaded and all codes you will see in the way. The cube is ID and you for full work you need the packages for families. In repository you can found your downloaded packages and also in the install install new libraries in the next slide you can check which libraries you downloaded and you can check whether families are updated. What is inside the Coupemix ID? You can found the MCU selector, pinout configuration, clock tree, peripherals and middle middlewares, power consumption, calculator and the main code regeneration. As I mentioned inside the pinout wizard, clock tree wizard, peripherals wizard and middlewares and for computing of consumption of micro. Inside the Coupemix is light version of the MCU finder. When you click to the new you can select through the peripheral choice and whatever proper micro you can sort by series, package and etc and when you select the micro you can switch to the pinout and in the pinout you can select pinout for peripheral or manually. Manually I mean that you click the right button mouse and see the list which function pin supports or you can select the periphery and automatically add the pin. Also in the top you can see the middleware the support middleware. At this moment the motor control library is not part of Coupemix. The library is generated by the motor control work bench. Help with the Coupemix which is integrated to the in the motor control workbench. In the future version 6 will be integrated fully to the STM32 Coupemix. When you see that the peripherals are green you can the pinout is assignment. The yellow it's only for ADC. It's the means that you can use but some restriction because ADC has a single mode and differential mode and when you occupy some pins of differential mode the pins the ADCs are real. And the red is that the signalization that you are not able to use. All pins are occupied by other peripheral or use or other function. This is about the function now the keep user placement. When you select the R-square system which is defaulted ported to PA14-15 also occupy the SVD which is in the PA15. It's for serious communication for the bug. It's important and when you select the R-square scene and after that you can see that the pin assigns to this and after that select the serial levels automatically change the pinout form R-square scene and select the clock for SVD. But when you select the keep current signals you are not able to enable the debug. Be careful for keep current signal placement please unselect and you can after you can able to turn off the system the serial level for debug. And how to change the pinout configuration. You can use control and click to the pin and after that you can see the pinout which support this function. It's a very useful function for example when you porting micro from 32 pin to 48 pin you can change only the right click control and click and see the the next pins which is support and move. The next is the clock configuration is a nice tree. The function of this tree is view the frequencies which is used and dividers and also we can automatically calculate the frequencies. When you set the I want maximum for example 180 megahertz automatically dividers are set it to the proper value. The next is the configuration where you can see the used middle verse and all peripheries. When is the green plus the peripheries not configured for example GMA when you see the green it's okay but when you see the red cross you have to go to the peripheral and see what is the wrong and etc. In the left you can see the used IPs but only for the view not impact to the middle verse. When you open the used middle verse you can see the for example interrupts GPO and DMA and inside the parameters you can set your requirements for example protocols etc and in the NVIC folder you can see and add the DMA for the periphery which you use and if you need the mode and which is to peripheral to memory data wide and the next. The important is also the NVIC panel here you can see the interrupt table with the possible used function and when you check you can enable and after that you can use in the code and also we can set the priority and sub priority the same for configuration of DMA panel you can set your requirements for DMA and again the GPO panel for all all peripherals which are used we will use for example XT13 and we will we have to change the GPI mode we will see in the example the last one is power consumption and calculator you can compute the consumption of micro for example the door locker you can compute the energy which is used for the opening and for the sleep and after you can calculate the the battery the capacity of battery you will need the last one is the generation of code the qpmx generate the code and in the in the top you can see the first is the the main function like a system configuration star thread and the peripherals in it and after that follows the main this is all generated by the qpmx be careful for updater when we generate code in the stm water control SDK sometime you can see that the in the background is open the window with the cube updater you can click to okay our recommendation is set the manual check for updater setting and refreshment to no auto refreshment that's about the updater the for project setting you can set the project name but is when you use the qpmx the motor control workbench which is generated the code for motor control this automatically fillet and in the toolchain id also is a fillet from the from the workbench and in this project setting you can see the firmware library which is used and the next is a code generator there is settings how to generate the code and it's a very useful because you can generate the pairs of c dot c and dot h or you can generate inside the main i will show you in the next slide in the first step is the film library package you can you can select that you want to use all libraries and from q repository is copy to your project all all functions all c code for the selected micro it's a good for the movable project computer by computer because you you have all libraries inside the one folder the next the save the space is you can copy only necessary which is used and the last one also the reduce the data in the computer you can use only the link to the repository it's a not good way for the movable project computer by computer because repository can be in the different this different folder and also in the for developing in your computer generate files with this configuration is the mx mx peripherals are generated to the main when you click to the generate peripherals in installation as a pair the peripherals are generated to the separate c code and this is the useful function because when you click to the generate you can lose the your work your your code but when you click to the backup to previous previous generated file the cube generate the new the new code or up to or regenerate but the previous version is saved to the backup folder this is a very important part please use only this part for your code use the code because when you wrote the the code and click to the generate you lose everything what is not inside the the brackets this configuration must be selected in the in the generated file but when you unselect and regenerate you lose the code inside the brackets this areas are in main scene in interrupts and how msp which is configured the the nvig gpro for the periphery and you can use for variables function etc the next is the delete previous generated files when not the regenerate it means that the regenerate the your project the cube mx delete the periphery which is not used and for better power consumption you can use the that the all pins are switched to the analog which is pins not to use but be careful when when you not set the system serial wire for the bug and set the all pins are free you lose chance to debug the micro before this you have to have to select the serial wire and generate to the cube mx in it and as i mentioned lose the debug future and for debugging it's use if a full asset it's a function which call it when is the unknown function like use the pin 17 and after that you when you put the breakpoint you can you can found what is the which line is problematic and now about the how package hl package the hl package you can download from the st website and this package use cube mix to generate the code and inside this package is the abstract layer embedded software now and low layer software and some middle verse like rts usb etc this is the ideology ideology of hall and hl we have the different hardware drivers but the layer in the top should be the same for the all devices also we have the examples as i mentioned middle verse and board demonstration i will show you in the next slides and the package organization when you download from st website the package the package contains the documents drivers middle verse project and utilities the comments you can found how to start with the f3 and some application notes in the utilities you can found the mainly for the graphics and for the audio like pictures and etc in the drivers so you can found the cmcs for from the arm cortex in the hall library you can found the the code for peripherally and in bsp it's a board supported package inside is the code for for example gyroscope accelerometer some codex which is in the st evolution board or the discovery board in the middle verse we have the middle verse which is developed by st it's st mv in library for usb audio and third party which is for fat fat fs library for jpeg and for crypto and free art us at this moment the motor control library is not include in this part in this part will be in the version six i believe now it's separately in the motor control workbench and in the project you can found the prepared example for each evolution board discovery board etc and it's inside it's templates examples which is examples means it's a for for peripherals jpeg us at etc an application it's a more complex code which is contain the usb motor control for example six step sensor life and the demonstration it's a full code for mainly for the discovery and for evolution board which is more complex application and again the organization of downloaded package you can see the in the drivers is bsp cmsys and hl drivers in the middle verse also the st and third part third party which is related to the function and prepare a project for evolution boards from st and utilities like a pc software for start communication now it's about the examples as you know we have the hl and low layer library and also we have the examples for hl for low layer and mix examples where is the hl and low layer part i mentioned you can see that the this is for low layer example it's the same structure but when you click to the drivers you can see that the used library is a low layer not not hl and the difference between cube and hl library and std library is that the the porting between the families it's useful to use the same code and port to the another the micro the std library was for f0 f3 and f4 but the hl libraries now is for the portfolio of stm32 and you can easily move micro to micro with the same middle verse and application code only you can change the the periphery and etc and therefore the new library used for the hl and now the the concept is that the you have the f4 family which is the rate some micros and you can use in the same package you can use the the same uh api layer this is the about the the ccoding and how to work with the hl libraries document we found documentation and the main part is the the generate generated structure you can see the inside the source code is user par interrupt par and the same is for the includes fires dot h user code and interrupt par the howl drivers this is all is it's for whole c and derivative function for periphery and you can see that the howl config is for part of hl drivers and part of user code you can add the user code to the hl underscore config and the third part is cmsis library where is the start up nv vectors enumerating for flash external flash and it's a link it's the h files is linked together and in the structure you can see the hl library the drivers are there and for the cmsis in the driver cmsis the same for the startup in the howl msp is a part of howl drivers the cube cube makes generate the howl howl msp and also you can add the user code to howl msp where is the initialization of gpl and dma and in the in the main it's a initialization of all and the third is a interrupt where is the also the generate the basic generate from the cube but you have to add the user code to the callback yeah and it's describing what is in the cmsis in the startup for the for the stm32 now is example for f4 and the interrupt vector table and you can see that the this name is used in the in the code is in the interrupt also in the startup is a reset interrupt handler and the first call it system in it and after it's jump to the main the ideology of all is that the use usad periphery and inside the use the function which is the which is the same for the one family for example for the rspi you have the in the reference manual you have to spr periphery and in the howl hl library you can found the howl spi.c which is the inside of all the functions the same is for usad and etc and the system periphery for the config and xt is not dedicated inside the howl hl drivers because they are in the strictly managed in the whole hl again the hardware abstraction layer you can use the is used the same same same uplayer for different families and you can easily port micro by micro here is the three possibilities always handle the the differences between micro you can see that the if death where is the the part the part number of micro and select the for example flash buys option buys for the the proper for the product and also the next is for the product family there is set the not the same for all but you can you can get the the for example clock this is the case two and the last one is the use the new model where is the also if death define and you can can select to the symbol inside the id and use the proper settings the hl con contains the hl configuration you can see that the ips which is used the qpe mix automatically delete the the slash when you use the proper when you use the the periphery and also inside the configuration is values for hsa ha and for the vdd voltage idology hl libraries use callbacks from interrupts and you can found the proper interrupts in the periphery for example now as you can see the hull xx for example for spi and use in the interrupts routine here is the flow how to how hl library initialization initialize the function the first the hull start initialization after that initialize the gpao dma and enable clock for periphery initialize the inside periphery and after that go back to the code when you use the hull function you can get this this callbacks this returns value if is everything okay you can get the whole okay it's sometimes happen you can get the busy error or timeout it depends on periphery and you can found in the description of function it's about the initialization and inside the hull msp in it you can see that the nvc is set it to the priority and gpao nvc in the cube in the cube mix in the nvc configuration you can select it and enable the for example system timer and in the code you will see that the priority is set to group 4 and the sys stick is set to the values which is fillet in the cube mix this is the part inside the msp in it which is for the user code you can see that this is generated from the cube mix and also you can add your code for initialization inside the hull hl library you can found the function for the initialization for get tick hull delay vvl use in the up examples and hull init tick is for the system tick and now about the low layers drivers the st developed low layer drivers because we haven't got the next next uh activation for spl stand up fl library therefore st developed the low layer which is for the deeply to the code go to deeply to the code and we uh add to the hl and to low layer together which is uh cooperate inside the code and now we can see the topology the low layer drivers it's inside the also drivers we add the low layer examples hl and low examples and it's in the deep to the code to the to the register programming this picture nice describe where is the low layer drivers now we had the hl library and the low layer is in the down and again you can see the comparison between standard peripheral library and low layer library and hl library the standard peripheral library is a wide range and when we use hl library and lower library the the range is it's higher than with the standard peripheral library you can recognize that how you can recognize that you are used the hl library after the name of the st m32 for example f3 underscore ll this is the libraries for which is based on the low layer drivers and differences between hl and low layer the hl is very easy to use but sometimes happen that you have to go to the deeply to the code after that you can use the low layer which is sometimes in the same level like the register programming the faster but it's difficult to write the code and or even with the low layer sometimes you can you can open the examples for the same periphery with for hl and for low layer and see that the the low layer it's a it's a long than the code is long than for hl but low layer it's for time critical uh operation it's better than hl for example inside the configurate gp o you can see that the the function start with the ll underscore gp l when you use the hl the function start with hl underscore this is the difference in the in the code how to how to found