 Hello and welcome to this new SM32 technical video. Today I'm gonna talk about one of the SM32 firmware library which is the assert function. The assert function can be used to detect any possible errors during the function calls, specifically the parameters on the function calls when we call one of the firmware libraries function. To show you that I've started with one of the SM32 library examples, which is the DMA example that transfer data from flash to RAM. Here we can see that in the project that we have defined one table in flash and another table with the same size in RAM. Here we will use the DMA1 channel 6 to transfer that constant buffer from flash to RAM and also the DMA is configured to transfer to transfer data in memory to memory mode. So I will go ahead and load that project to my target board. In my case I'm using the SM32103e eval board with with the jailing. I will put a break point at the end of the main function. Here we can see that at the end of the DMA transfer we will copy, we will compare the transfer data to the original one. So now I run the project and we can see here that the transfer was not completed correctly and there were some errors during the transfer. So now I'm going to stop the project the program and I will enable the assert functionality of the SM32 library. To do that we need to open the SM32F10x underscore com.h file and at the end here we see that there is a parameter that is commented out, that is commented and we need to uncomment that. Save it and now rebuild my project. Now before running the project I will need to put a break point and the assert failed function and now run the project. Okay here we can see that we hit the break point on the assert failed function. This will tell us that there was an error on the parameters that are passed to one of the library functions. So to track down the error and the function that caused the error so I will use the call stack window of the IAR. So here the call stack tells us that the assert failed function has been called by the DMA underscore in it. So means that the DMA underscore in it there was an error during the call of the DMA underscore in it that was called by the main function. Okay so now we go ahead and double-click on the DMA underscore in it. So this will take us to the function and here we can see that this parameter caused the call to the assert function and specifically here will tell us that the DMA memory data size field on the DMA in its structure who caused that error. Means that parameter is wrong in our configuration. So I will double-click on the main here and you can see here is the DMA structure and as we said the DMA underscore memory data size field is has a wrong parameter. Here we can see that we have a wrong parameter. So here we can see that we need to transfer a 32 bit to the to the memory and now we need to to correct that error. I'm gonna stop the program execution. So now to find the correct parameter and for the DMA underscore memory data size field I will go to the DMA underscore in it function. The DMA memory data size I'm gonna right-click on that and go click go to definition. So here we will see the possible parameters that we that we can use with the DMA underscore memory data size field. So here is the parameter that we need to use because we need to transfer 32 bit to to the memory. So I'll go and copy that and then go back to my main function and correct the DMA underscore the memory data size field. Place that and then now save my main file and rebuild my project again. Okay so I have my break point at the end of my main file and then I will run the project. Okay now we can see at the end of the transfer that the transfer that the buffer is has been correctly transferred. Okay so this will conclude my video and to have more information on the assert function so you can refer to the STM32 firmware library user manual and there you will find more information about the assert function. Thank you.