 Hey guys, how is it going? This is lab 5 of our STM32C0 MOOC. So in this lab, we will look into the low-layers drivers, also known as LL. We offer both STM32Cube HAL and LL. So those are complementary and covers a wide range of application requirements. HAL drivers offer high-level and functionalities-oriented APIs with high portability level and high product or IPs complexity to the end user. LL offers low-level APIs at register level with better optimization but less portability and require deep knowledge of the product specification. The low-layer or LL library offers the following services. A set of static inline functions for direct register access provided in the header files. One-shot operations that can be used by HAL drivers or from application level. They are independent from the HAL and can be used in standalone. They offer full-feature coverage of the supported peripherals. This is the block view of the STM32Cube packages. So as you can see, we have one STM32Cube per series. And we have, of course, the C0, that is part of it. So we support all from C0 up to H7. So the way it's divided is first you have the drivers here with the HAL and also the low-layer drivers. And then you have some examples for that. So you have HAL drivers examples, you have low-layer drivers examples and a mix of HAL and LL examples. Middleware, so middleware you will find, for example, the networking stacks, the USB host and device stacks, the graphical stacks, like the .lgfx, file systems, and RTOS. And we support different boards. So we have a BSP board support package available for evaluation boards, discovery kits, and nuclear boards. Here is a real case scenario, so an application. So this is a USART used in a transmitter with interrupts. So we have GPIOs, we have USART peripherals used with interrupts. And this is the type of improvement that you can get between the HAL drivers and DLL, so the low-layer drivers. So in the table here, I'm putting the size of the code and also the RAM used by the example. So as you can see, for the code size, we see a significant improvement as we divide the size of the code by four. We also observe a RAM size reduction. So in conclusion, LL offers smaller footprints and higher performance, but is less portable and requires expertise. The HAL offers high-level API, so to hide the complexity, and is more portable, but it has a higher footprint and is less performance. Let's get started with the lab. The objective of this lab is to generate a SMPH2 QBID project using the low-layer drivers instead of the HAL. And then we look at the improvements comparing to a HAL project in terms of flash and RAM usage. So we're going to create a new project, use the LL instead of the HAL. And then, like we did in the first lab, with the Blinky, we're going to toggle a GPIO, so PFI, and we're going to compare the size of the code and the size of the RAM that is used to see the improvements. Create a new project, give a name, so I'm going to call it LL, and then we'll configure PFI as a GPIO output, like we did for the Blinky. So that's the IO connected to the LED. To use the low-layer drivers, what you're going to do is you're going to go to Project Manager, then click on Advanced Settings, and select all the peripherals to LL instead of HAL, that are by default. So that's the way to do it. Let's do it now. Okay, so we're going to go Project Manager, Advanced Settings, and you see, by default, the drivers used are HAL, so instead, we're going to select DLL for the RCC GPIO and also the Cortex M0+. Save the project to generate the code. Yes, and yes. We will look into the generated project and look at the drivers, so in the source folder, and you will see the LL indicating the low-layer drivers used instead of the HAL. And then what we'll do is we're going to add some line of code just to toggle the LED like we did for the Blinky. Alright, this is the generated code. We'll look at the drivers and now you see that the drivers that are used have the LL, so for low-layers. So all of this is using the low-layer drivers. In main.c we are now going to add the code in the Y loop to toggle the LED. So you can notice that we're using some functions here starting with LL underscore. So this is the low-layer drivers. So one function to toggle the GPIO and one function to add a 100 milliseconds delay. Let's build the code and plug your board if it's not plugged and then we're going to execute the code just to make sure that it operates properly. So we should see the LED blinking. Let's just run this code. Switch and I'm going to run it. And yes, I have the LED blinking as expected. So you can terminate. So now we're going to compare the flash and data usage. So RAM usage between the HAL and the LL projects. So when you build your project in the build console you will get some data that will give you indication about the size of the code and the data usage of your project. So we'll get this is the data that I get from the blinky using the HAL and this is the data that I get from the LL project. So the project using the low-layer drivers. So here are the data right there. So now what I'm going to do is I'm going to put that in a table to show you really the comparison between HAL and LL projects. In this table I summarize basically the HAL project data and here the low-layer drivers data. First row is going to be flash size or read only code memory in bytes and here we have the RAM usage which is the read write data memory in bytes also. So as you can see we see an improvement of about 20% when using the low-layer drivers. We also see about like a reduction of half so divided by two for the RAM usage. This gives you an example about the kind of improvement in code size and RAM size that you can get using DLL, so the low-layer drivers. We finish Lab 5 so you can close this project, so the LL project you can just close it.