 Right, OK. So I will come back to the virtual comport driver because we always have issues with that at some point because there's so many different variations of PC in this room. So what we're going to do now to create our oscilloscope, we will use the ADC to send the data over the USB. To trigger the ADC, we're going to use one of the timers. So we're going to set one of the timers up to periodically trigger the ADC to take a sample. The ADC will then use the DMA to load that into a buffer inside the memory. So the first thing we have to do is set up a timer to generate the triggers for our ADC. So what we're going to do is use the internal clock that's available inside the SDM32. We're going to configure the timer with a prescaler so that we get, I think it's a 10K interrupt, or 10 kilohertz interrupt. Then we'll set the compare value up so that when our counter hits that compare value, we'll then go out and trigger the ADC. So first thing we're going to do is select new project. So you can either do it from the menu up at the top or from the big new project button in the middle of the screen. This will present you with the selector guide for the microcontrollers that are available. Now there are different ways you can select your microcontroller. And this is a very good tool if you want to rationalize about 1,000 different sales types we now have for what you need in any application. You can either do it by board selection. So you can select it from the boards, where you've got nuclear boards, discovery boards. I think you'll find this discovery board in there if you want to use that channel. Or you can select it by specific peripherals. So if you need a TFT controller, or if you need ethernet, or five U-hertz, you can select it on this side. And it will reduce the number of items in this left-hand side. We know exactly which device we're going to use today. So we're going to select the series as being F7. The product line has been F7X6. And the package has been TFBGA216. And the package you want to select, so the device you want is the 746NGH. So that's the device that's on the bottom of your board. 746, yes? Ignore that for now. 746 is what's on your board. I have been advised that IAR now have the 746 included if you've all got the latest version of IAR, which you must have because you've already been compiling examples earlier today. So that should be OK. So everyone's telling me they've got the Pingrid array out, apart from one gentleman or the other who's just doing the same as you, upgrading. All right, I'll catch you up in a minute in the corner. So when you go into the PIN diagram, I'll go into this section here because we can see it. On the left-hand side, you will have all the periphery that is on the device. Now, some of these peripherals will have yellow icons. Some will be red icons as well. If it's a yellow icon, then you now have a conflict with part of another peripheral that's already been assigned to PINs. So some of you have selected the Discovery Board as your starting point, which means you've probably got quite a lot of yellow icons actually on that side because each PIN on this device has about six to nine different functions. So it means one of those functions, because you've assigned it to one peripheral, means it's no longer available in another peripheral. So you have to go and have a look to see what's in that each individual peripheral. One little element would have gone red when you expand each of these peripherals. You'll see that one part's gone red. So if you select, say, ADC 1 as a perfect example, you might find that some of the PINs have gone red because they're now assigned to a peripheral and you can't use them as an ADC channel anymore. So firstly, we're going to assign our timer 2. We're going to select timer 2, please. We're going to use the clock source for timer 2 as the internal clock, and then we're going to use channel 2 to be output compare with no output. Remember, we're only triggering the timer so we don't need the PIN. So we don't need the actual output PIN. We just need the timer to actually trigger something else. So it's output compare with no output. It yellow means it's half assigned inside because it is actually connected to the Arduino connector, which is what we're going to use in the example. So we're going to plug something into the Arduino connector at the end. So that's why it's yellow because it's physically hardwired to something at the moment. So hopefully it should have gone green now when you've done that. So we've now set your timer up to generate the clock source and the connection to the ADC. So we now need to set the clock source. So on the discovery board, we have a 25 megahertz resonator. So you need to go into the resetting clock control module, so RCC. And we need to select the HSE to be bypass the clock source. What that means is we're bypassing the internal clock source in the STM32 because you're using a resonator outside. So you're going to bypass our clock source that's inside the chip. So we're just going to feed it in. So that's what you've got on your board. So we need to bypass the clock source. Once you've assigned the clocks to be 25 megahertz, if you select the clock configuration tab from the top, near where it says pins, up at the top of your screen, and if you've assigned your bypass correctly, your 25 megahertz connected to your HSE should be blue now. That should be a blue. And hopefully it should say 25 megahertz. So once we've connected our HSE to the chip, we now need to select the multiplexer so it uses the HSE to feed the PLLs. So you need to change the dot from HSI to HSE so that you're feeding your PLLs with your 25 megahertz resonator that is on the outside of the chip. Once you've done that, you then need to select the PLL clock to be the source for the system clock in the multiplexer. So you need to pick your PLL clock to feed your system clock. And you should gain two red dots over this side. So some of you have probably got red dots dotted all over here now with PLLs and things like that. What you now need to do is type in a frequency into the H clock box. And to make my life easy, can we use 192 megahertz please? Because 192 is very easily divisible for the 48 megahertz USB clock I'm going to use. When you hit enter, it should automatically reprogram all your PLLs to be the correct values. So now if we move over to the configuration tab, we now need to go and configure our pre-scaler values for our timer two. So if you select timer two, you should be presented with a box that looks like that. Perfect. So what we're going to do now, we're going to configure so that we generate our nice square wave so that we trigger on rising and falling edges of the output compare. So to do this, we are going to use a counter period of 10,799. My frequencies are slightly out because I've not taken 216, but it'll do for what we need to show. It will work. So if you set the counter to be 10,799, and then down here in the output compare channel two section, we need to set it to toggle on match. So that means we'll toggle the low to high on the PDWM output every time we get a match. And then we can okay that screen. So that's your timer set up now to generate the square wave that we need to do the triggering of the ADC. Timer number two and channel number two. So the mode is toggle on match. So the next section is, we're now going to configure the ADC so that it takes our trigger event we've just created to read the ADC channel, copy the data register via the DMA into a memory buffer. So this is what we're going to do now in this section. So to do that, we need to go back to our PIN diagram because we need to assign an ADC PIN now. So if you all go back to your PIN out tab and you want to select ADC three, input zero or channel zero. We don't need to do anything with the clocks for the ADC. It's all coming from the system clock. So if we go straight to our configuration tab and select ADC three now so that we can configure the ADC three peripheral. So that means you should get a screen that looks something like that displayed with all the settings for ADC three. Now there's quite a few settings to go do inside the ADC. The first setting we need to do is enable the DMA. So it DMA continuous requests needs to be set to enabled. So that means every time we trigger an ADC reading, it'll then trigger the DMA to move the data out of the data register. Next, we need to set the trigger conversion edge and this needs to be set to rising and falling edge. So we want to trigger on both rising and falling edges and then directly below that, we need to say that we want to do timer two, capture, compare two events, I think it is. Capture two events, I can't remember exactly what it says on the screen. So we've now linked our timer two on rising and falling edges to the ADC. Then you will need to expand the rank function, change the cycle time or the sampling time to 144 cycles. So if you expand the rank command, you should find sampling time, which you need to set to 144 cycles. We all manage that, okay. Next, we need to go to the DMA settings for the ADC. So we're going to click on the DMA settings tab at the top there. So if we go on to the DMA tab, so we now need to set the DMA up to take commands from the ADC. So the first thing we need to do is add a channel. You click the big add button on there. You then need to select ADC free as the request. We're going to use it in circular mode. So we need to change the mode into circular. So we're going to continue, we go round and round with the DMA to do this request. And we need to increment the memory. So you need to tick box to increment the memory. So we're going to fill a buffer up. We're going to go round and round and increment the memory to load up all this information into a buffer. We need to set our word length. So it's a 12 bit A to D converter. So we need to set it to be half word data width. And then you can select okay. We've then configured the DMA to take the reading from the ADC and load it into a buffer.