 Hello, and welcome to the STM32Q Badgements Debug Features R3. Today we are going to cover the debug using the serial wire viewer. So let's get started with the serial wire viewer debugging session. I'm going to change to the STM32Q by DE with the same code that we saw last time. And here just to recap real quick, I do have a few things going on the firmware side, but for this first part of the video we are going to really highlight on the main loop and I want you guys to pay real close attention to these delay here and these other ones here because these two times are going to be relevant for us while we are checking the serial wire viewer data. So we do have one delay that's changing every 500 milliseconds, second delay that's changing the variable loop. Throughout the code I've highlighted so it's easier to see all the times that the loop is being changed. Even also for the data we have it being written every once in a while. So the loop is actually being read and write from time to time and our data variable is just being written up. So without further ado, let's enter in our debug session. Now that the perspective has changed we are in our debug session and I do want to use the serial wire viewer. The very first thing that I need to do is go to window, show view, serial wire viewer and select which one of the viewers I want to start. So the variable first one will be the serial wire viewer data trace, so I'm going to start with that one and just give more room so we can check the entirety of the tab and as we can see right now there's nothing on the watch list, there's nothing on the history, the code that has not been started and the very first thing that I want to do is actually go to the configure trace and this window will show to us. This window just to highlight all the parts of it will give you the information on the clock settings. You can see here the 84 megahertz. It's also going to show which trace events we are monitoring, there are a few options for us here. It shows also the periodicity that we can monitor, it's either using PC sampling or timestamp. In this particular case I'm going to use timestamps with the per scaler set to one. So here we have the data trace and as you can see there are up to four different variables that we can do the trace and I've already added the first two, the two global ones that we have, the loop and data and even though the loop is actually going to be a read and write axis for just part of the example and demonstration just interest on the write times and the same will go for the data. So every time there is a write action on any of those two variables we're going to have the information being printed out for us. And then we have the ITM stimulus part that are actually 32 parts ranging from zero up to 31 and we can by default use the port zero to output information that we have. So now that this is already set it can be okay. It's very crucial to first start the trace to then start the programming otherwise the window will not load properly with the information. Now that we started the code we can actually see the information on both are both being changed and we can see that each and every action that is a write the stimulus is outputting the information for us on the trace view. So let me just pause here real quick so we can actually see the amount of time that was spent throughout one of those two actions right here. And we can see here it's very clear that from the first time it was acted to the second and third and so on so forth. We are seeing that around 550 milliseconds delay playing along which match to our code execution in the main loop. So if you guys recall there were two how delays here and the other one is here plus the time to execute the code itself. So these information is actually a pretty accurate measurement of time span. Now let's say that I want to also add these graph information being plotted with the actual data that I'm acquiring. So I'm no longer interested in the value that I'm fetching information but the actual plot of this data throughout the time. So what I can do here is go to window, show view, show wire viewer and then go to the data trace time graph. So here this information was already being fetched so we can see the loop incrementing and the data going to a high value and then decrementing which matches pretty much with the behavior that we want in our code. So if I just continue logging that we can see that as the time goes by information is going back and forth and we do have two different scales. The scales are matching the colors for the variables. So if I just let the code run for a little bit I'm going to fast forward the video right now so you guys can actually see the code performing in its entirety and it's a pretty good view. All right I'm not sure if everyone was expecting this particular behavior for the data when you saw the code. So this does facilitate a lot the overall view of how our code execution is being placed. I'm just going to stop here right now. This was the serial wire viewer data trace. Just checking the values and also the timeline graph. On the next video I'm going to cover the part of the others features. Thank you for watching this video. I hope to see you soon on the next one when we are going to explore the other parts of the serial wire viewer. Thank you.