 Right. So we're now going to go into the actual hands-on part of the workshop. So we're now going to get a grasp of the tool and this new feature that we've got within the tool to add these additional library packs that we've been talking about. So what we're going to do, we're going to go through the process of installing the library pack. So this will be the normal process that you'll do and your customers will do. We'll create a new project from scratch where we'll add this pack into the project so we can then add it to the generated code. We'll go through the configuration process which is one of the advanced features that Chris has just mentioned to configure the library pack or certain elements of the library pack that the BLE team have allowed us to configure. And then we'll generate the project, build the project, program it into a target board and test to make sure that we can do all that. So we're going to do quite what you would class as quite a complex project within the next 30 to 40 minutes to get a full Bluetooth system working from nothing. We're going to start from absolutely nothing. So it should be quite an interesting session. So these were the two formats that Chris was highlighting. So in the basic format, you just get the library stacks and all the API commands. But you have no way of configuring anything else. The advanced format which contains those extra XML files will give us the elements that we can configure. These elements are controlled by the team that generates the add-on pack. So the BLE team, for instance, have generated the XML file. All we as the micros people have done is define the structure that it has to be in. All the other people who generate the library packs are the MEMS team, the Laura team. What they do for their advanced part will be different. So they will decide what variables they can allow you to amend within the confines of the cube tool. So some will give quite a bit of flexibility in what you can configure. Some might be quite restricted on what you configure. But I'll show you how to access everything as we go through. There are ways to manually do things yourself. So if you've got a very advanced computer programmer at one of your customers, there is a way so that he can write everything himself. But start with the basic structure that we can generate with the cube. So there's lots of features we can do with these new packs. So the first thing you need to do, we need to launch our CubeMX tool. So I'll launch that. I'll follow it through on my laptop as well. So I'll launch CubeMX. And the first section that we're going to do is to... We're just going to do some checks to make sure your libraries are all installed. Some of you might have proxy servers built into your corporate networks. There is a way that you can get the Cube tool to run through a proxy server. It's in the update settings. And you have to put the proxy details in of your server and then in the log-on credentials that you've got. So that's in the help and update of settings. You will need to be online. Second element, hopefully you've all done this. You've gone into manage embedded software packs. Scroll down to the L0 family. And hopefully you've all got 1.10 library package installed for the L0 family. If you haven't, then you put a tick box in and we can install now. Or to speed things up because some of these library packages can be quite large, 73 megs. It's quite a small one actually. We can do it from local. So if you want to save your customer time, you can download it and hand it to them on the memory stick so they can do from local to do that. BLE pack was not part of your prerequisites. So some of you might have it because a few of you did. Not everybody would have installed this one. So if you switch on the manage embedded software packages to the ST Microelectronics tab, you'll have to hit a few down arrows. But you need to make sure you've got the BLE library version 1.0 installed. Now this, as I said, wasn't a prerequisite. So can you all make sure that that library is there, please? You need to have a green box in the BLE library pack. So now we can start our new project. So if you go into your cube, if you select new project, I'll follow this through on the slides. Go new project. First window that should open should be the MCU selector guide. You might get prompted for updates if you've not launched Cubemix for a few days. And if you have got pending updates, you will see this green arrow up here to tell you that you've got pending updates. But don't update this beta version that you're currently running on. So if it's the normal 4.26 version on the web and you see that green arrow, then happily go and follow the updates that are available. So we've got the MCU selector. Because we know what our target board is, we're going to do everything from our board selector. So I'm going to move across to our board selector. And here you can see a list of every board that we produce. But there's some nice filters down here on this left-hand side. So I'm going to expand the type filter. And it's a Nucleo 64. And then I'll expand the MCU series filter and hit the L0 family. And it should produce two boards. And it's the L053 Nucleo that you want to select. So if you just double-click on that, it should then go off. I'll give you this prompt to say, do you want to take the peripherals to be initialized or not initialized? Because we're going to customize it for our shield, please select no at this point. So we're going to customize each peripheral as we go along. So the first thing we now need to do, we now need to add our nice BLE package into our project. So that's the first thing we have to do. So up here on this top toolbar, there is a nice little icon. Which is that one. I'll get my mouse to go there. Come back mouse. Which is the add pack software component. Is the highlight. So you want to click on that and it should bring up this new window. Which is the software component add part. So when we have multiple libraries, there'll be a lot more listed in here. Because we've only got the BLE, there is only two lines listed. I'll expand that window a bit so we can see. There are currently two components of the BLE. The first component we can expand. And this is telling us what example applications are available within this BLE pack that we've installed. So we're going to take one of these default examples. That's in our pack. And we're going to take the sensor demo example. So if you highlight the sensor demo example. And click on it. You'll see a nice orange caution triangle has now appeared on the screen. So it's telling you that something needs to be fixed before we can go any further. So the easiest way is just double click on that triangle. And down here it's now telling us what we need to do. So it says that something is required or something's not selected. So you can double click on the line that says not selected. It expands the bottom half now, which is all the BLE stack and components and database systems. And it's already highlighted the block that we now need to add to fix our first caution cycle. So we need to put a tick in that box. So our first caution has now gone green. And it's gone green down here. But we've generated another caution now. So we do the same again. Double click on that one. If there's only one option, you can go and double click on it. This one's saying again something's not selected. Double click on that. It's highlighted there. We can click that box. My laptop does something. When you get two options, it means you've got to make a decision now. So you can't double click on those because you have to decide which one or the other. So for the second one, which is the wireless HCI TL, which is the top one, we have two options. We can either go for basic or template. For our example, we're going to take basic. I'll explain template in a second. So again, another dependence has popped up. So we can double click on that one. It's telling us again that we've got a decision to make. So we'll look at the decisions. We've got two options again, user board or template. We're going to take user board this time. And now everything should have gone green hopefully for you in there. The two options that said template that we didn't go for in this condition. That would have given you or your customer the option to write his own API command stack. The two that we've collected, basic and user board, that means you're now going to use ST's implementation of the AP command stack. The libraries are all still there. The profiles for Bluetooth are all still there. That part of the library structure. But how you address it in the API stack can be changed. We've done one implementation, but the customer can do his own. So this is one of the advanced features I said about. It's down to what the customer wants to do. We can take our implementation like we're doing, or he can go off and generate his own Based on his own labels and however he wants to write software. So he's got the flexibility within this method of adding the packs to the cube. So it's there as an option for him. So that's all we need to do. So we can okay that screen. And that should now have added another box to our blue section here Called third parties, which we need to go and expand. Expand the Bluetooth library and now you want to tick both of those Boxes to enable it into your project. So that those library files will now get loaded into your project. If you were on version 4.26, that block would have appeared Right at the top of this side. And again, you've still got to do the same thing and tick the two Boxes. So that's now everything that you Need to do for adding the library pack into the cuba mix ready for your project. Now we're actually going to generate our project. So we're going to do it in the normal cube way. So we're now going to add the various peripherals, assign them to pins, And then we'll go and configure those peripherals individually for What we need to do to provide the communication between the ble module On this board to the micro on the bottom board that we've got. So the first peripheral we need is the SPI. So the SPI is going to do the data transfer between the blue NRG module and the micro. It's SPI number one we need. So the SPIs are in the connectivity. SPI number one and it's full duplex master you need to select. Hardware NSS can stay disabled, please take the default version. So that should have assigned four pins on your green diagram. The next peripheral we need is use art number two. So this is going to provide the virtual comport back to the laptop. So we're going to take the two that are there already. We don't need it for this particular hands on but the demo Software needs that peripheral because one of the features of the Software will provide a virtual comport back to the pc. We don't need it as i said for the hands on but it has to be Implemented in the code because the library files are going to look for it. So we need to do use art number two. And that needs to be asynchronous. So that should send those two pins now green on your diagram. We also need a few control lines as well to interface between The blue energy module and the microcontroller. So one of them is chip select one of them is the interrupt Line and move on to reset command. So we need free GPIO pins assigning. So PA0 needs to be external interrupt. So you left click on PA0 which is in the bottom corner here of the chip. You'll get the menu up and you select GPIO EXTI 0. So that's enabling the pin to be an interrupt pin. So that the BLE part can interrupt the MCU. PA1 I think is the chip select line. So you just left click on PA1 and select GPIO output. And PA8 I think is the reset line which is on the far side of the chip. And that one needs to be a GPIO output as well. Go and do that on my diagram. PA0 is EXTI. PA1 is output. And PA8 as an output. The last pins we need to assign are the debug pins. So at the moment they're currently highlighted as yellow to say that they've been trapped on the board but they're not actually assigned. So we need to assign those to be the serial wire debug. Debug is in a system function. So it's system core or SYS on the other margin. And that just needs to be the serial wire debug. And that should send your last two pins into a green state on your diagram. So that's all your pin assignments done. The next tab is the clock configuration. We're going to take the default configuration in that was created by the template. Because we're not sending much data between the two modules. We don't need it to be specifically fast. So I think it's set for about two megahertz. I think the core clock. It's fine for what we're doing in this particular example. Yeah, two megahertz. So it's fine for what we need. So we're going to leave that as it is. So the next tab is the configuration tab. This is where we need to do some more work now. And this is where we now need to configure the BLE package that we've installed. This screen view is different depending on which version of the tool you're running. So if you're on 4.26 which is off the web. That BLE part is sat in the middle up here somewhere. So they've just rearranged it to be off the edge of the screen there. So that's the one that we're now going to go and configure. So if we select that module. And in here we want to look at the platform settings. So we're looking at what the actual interface is between the microcontroller and the BLE module that's on our shield. And we've got to go through this step by step. So you have to define your component first before you define the solution. So this is where we define SPI and the solution is SPI Channel 1. So you now need to go and fill all these components in now. So you've got to configure it all as it's laid out. So this is controlled by the hardware now. Of where the connectors are and the pins are linked between the Nucleo board and the X Nucleo shield that sits on top. And you have to fill that element in before you can fill that element in each of that table. If you chose an example. If you chose to do the project without taking the sensor demo example. This section here will be missing. Because that sensor demo software is going to use these features that are part of the board support package. So if you didn't take the example code and you were going to write the code yourself. This bit will be blank. You'll just have the top bit which is the interface between the two boards. Yep, everyone got that? Well, hang on. In that case you'll see me slowly filling in the element. EXTI line is PA0. Your chip select line is PA1. And your reset line is PA8. Down at the bottom, your LED is on PA5. Your push button is on PC13. And the use art is use art number two. Click apply and then click OK. That's the interface done between the micro and the BLE. One of those pins you noticed was an interrupt pin. So we've now got to enable that in the NVIC as well. So there's a button here for the NVIC. So we now have to go and make sure that the NVIC knows that there is an interrupt. And it was on EXTI0. So you've got to go and tick the box for EXTI0. So that means the NVIC controller now knows that there's an interrupt going to be coming in on that pin. Priority can stay as the default. We've only got one interrupt in there so we can leave it. If you have multiple interrupts then you'd have to make the decisions on which gets the highest priority within your particular application. So we can apply that and say OK. Now we need to configure each of those comms peripherals that we selected. So the SPI channel. So we need to make sure that we're on 8-bit data. And our pre-scaling needs to be 16. So this is the slowing the clock down. Because the SPI interface on the Blue NRG module is fixed to a certain speed. So we can't go above 8 megahertz. Remember our core clock speed was only 2. So we're picking 16 purely because your application might want the core clock speed to be maximum speed. So you have to have at least a divide by 16 inside there. So we'll just set ours to divide by 16. And OK that. Then we go into the USART. So we need to check the USART settings. So you should be on 115200 board. 8-bit data, no parity, one stop. It should be the default settings. And again, hopefully you've not changed it but if you go to the GPIO settings you can see the labels that have been assigned to those two pins. Now this sensor demo software is using labels as part of its format. So you need to make sure that they are correct. Which is USART underscore TX and USART underscore RX. Again it's the default configuration. So just in case you've not accidentally changed it when you were assigning pins. So then we can OK that screen as well. So that's all the configuration we need to do. Now we've got to set the system up to generate the code that we're going to generate. So up here we have a nice icon which is a little cog. There's still a caution warning, yes. It's not going to impact us. So we're going to accept all the default configurations that were in there. We don't need to change anything, we don't need to set any other labels. So it always stays as a caution just as a reminder for you that the default configuration settings. Because sometimes you might want a pin to be active high as soon as it starts. By default everything's active low on these particular pins. So it's all defined as low. It's there purely to warn you that you need to check what's in that box. So it will always appear as a caution sign there. But you don't always have to do anything to it. You might be happy with the default configurations. But it's purely for you to inspect and check on that one. And just select any line, you just highlight on each line and you can see the information that's there for each one. But no matter what you do, you will never get rid of that caution warning. If you change everything on that screen, it will still show yellow caution. Red is the danger one. When you see anything that's gone red, that's when you need to pay attention to yellow. You need to have a look, make sure it's okay with the caution. So we need to hit that little cog window there and that will bring up the project settings. So this is where we now give the project a name and location. The tool chain we're going to target this for is the Atolic True Studio. Now, Atolic True Studio is an Eclipse-based tool which means you have a workspace and a project. This workspace cannot be the same folder as the project. It's an Eclipse thing. It's not an ST issue. This is an Eclipse issue. So if you put them in the same path, your project will always need to be one folder lower than the workspace folder when you're defining your project location here. Alternatively, like you'll see when I put my screen up, mine are just in two completely separate folders. So it's your choice wherever you want it. If you want to keep it all local, always make sure your project folder is one lower than your workspace folder. Your workspace cannot sit on the root of C either. Eclipse does not like that. So that always has to be one off C. So therefore, this one potentially will have to be two folders off the root of the C drive. So always bear that in mind when you're giving your locations. So I'm going to call my project BLE. I've already got a project location which will be cube demo. So therefore, my active folder will be cube demo slash BLE. So that's where my project is going to sit. There's another button here which is application structure. So at the moment, the default setting is basic. This is fine for what we're doing because we've only got one set of middleware in use in this application, which is the Bluetooth middlewares. If you were doing a project that has a Bluetooth, lightweight IP, free RTOS, that's multiple different middleware library structures that you're now pulling in. You would need to change this to advanced because then it will organize things on your hard drive in a more logical fashion to separate all the middlewares out to make life easier for you when you're doing modifications to the project and the software. But if you're only running one middleware pack, basic, which is the default setting is fine for what you need to do. So I need to set my tool chain now. So there's all the different formats that we've got available. So it's the Atolic True Studio that we're going to enable. And then we just need to confirm in advanced settings that our USART has a tick box for not generating function calls because it's the virtual comport. And our blue NRG or our two blue NRG lines are visible and static. So it should be the default settings. There should be one tick box in that column, two tick boxes in that column. Up at the top, this is where you normally have the ability to switch between low layer and how. If you notice, SPI has disappeared, even though we've enabled the peripheral inside the tool. This is because the middleware is now in control of that interface. It's going to manage that SPI protocol between the Bluetooth module and the target board. So it's no longer in your control now. The SPI is in control of the middleware. If you had another peripheral that wanted to use the SPI, then potentially you're going to have conflict. This is one of the questions that we're still working on when it comes to some of these other shields because normally the whole point of the Arduino is you can stack shields. So you can have two, three, four potentially as you build up a project. Now there's only so many interfaces on those Arduino connectors. So there will become a point where multiple items need to do it and the chip select will have to change. This is something that will have to be worked on when the scenarios start happening based on the different stacks that we're going to integrate into the cube environment. So most of the projects today that use multiple stacks have a dedicated XQ package for it. It's not the standard BLE one, it's not the standard MEMS one. It's a third package where any conflicts like this have been resolved. At the moment, we don't have the conflicts there so I don't know how it's going to adapt in that screen yet. But yes, potentially that will be a problem at some point. The same goes as well, this library package is written in HAL. So normally this screen you'd change everything to low level if you wanted a smaller, more compact code footprint. Until the BLE library gets written into a low level driver format, it has to stay as HAL at this time. So we can okay that screen and it will now go off and generate our project. So it will pull all the libraries from the BLE pack, pull all the libraries it needs from the L0 library package and take the template for the Atolic screen that we've got.