 Okay, in this section we're going to take a look at what is underneath that metal cover that's in the middle of our discovery board. So we're actually going to look now at what is in the STM32 that is included inside the Murata module. So there are two versions of the Murata module. There's a version that contains the L082 and there is a version that contains the L072. The one that's attached to our discovery board is the L072. The difference between those two modules is the hardware encryption cell that is integrated inside the STM32 L0. So inside the module we have our STM32 L0. Connected to that via the SPI1 peripheral and some GPIO lines is the SEMTECH radio, the SX1276. And then beyond that there's all the RF component tree to go outside to the actual antenna that you can see attached to your discovery board. There is also an option for an ST safe inside this module. It's not present on the versions that we've got on the discovery board but there is a footprint there and that is connected via I2C2 to the STM32 L0. And this can provide you with the extra security for storing cryptography keys in a real life application. All the other pins on the STM32 are actually bonded to external pins on the module. So if we take a look actually at the module now you can see that all the pins that are there are available for you to use within your actual application. So when you're generating your own application you've got pretty much every peripheral on the STM32 available to you on this particular module. So you can see all the timers ADC, SPI number two is available to you there and some of the other debug functions I2C1 and everything else is actually bonded to the pins. So you can actually generate a full application using the STM32 L0. So if we now have a look actually at the block diagram for the STM32 L0 we're actually showing here the block diagram for the L082 device family. The difference between that and the 72 is in this bottom right hand corner which is the encryption part. The rest of the device are exactly the same between the L072 and L082. For those of you who don't know STM32 we are using the Cortex M0 plus core here in the device. We've got seven channels of DMA available to us. We've got all the system peripherals you can probably wish for, internal oscillators, internal brown out detects, power on reset, power down reset, program voltage detects. We've got a system tick timer for providing the interval for an RTOS. We've got dual watchdog CRC checking and the core can have three different voltages applied to it to try and help you reduce power consumption for the overall device. Integrated in this device family we have up to 192K of flash. The versions we're using in the modules are the 192 dual bank versions which means we've got 20K of SRAM and 6 kilobytes of E-squared PROM built into this particular device. Connectivity wise we've got lots of different communication channels. We've got two SPI, only one available on the external pins. Three I-squared Cs, two of them are available on external pins, four U-Arts, one low power U-Arts and a full speed USB peripheral inside there. We've got lots of analog functions as well, so we've got two comparators, two 12-bit DACs and one 12-bit 8D converter at one microsecond with 16 channels available to you. So there's lots of features inside this device that can build a relatively in-depth application. If we're now looking a lot more detail at the core itself, the system architecture of the STM32L0 device family means there are two masters on the bus matrix. You've got the Cortex core itself and you've also got the DMA controller. Everything else on the device is classed as a slave, the memories, flash and E-squared PROM and the SROM, and then the two peripheral bridges which have all the various peripherals attached to them are both classed as slaves. Therefore, either the Cortex core can access the peripherals or the memories or the DMA can access the peripherals and the memories. There is one unique thing on this device and that is in respect to the GPIO. On this device, the GPIO is connected directly to the Cortex M0 core through the IOPORT. So this means it doesn't need to go through the bus matrix to actually control any signals or toggling of pins. It's directly controlled by the core itself. So we now have a look in more detail at the memories inside the device. We've still got the standard 4GB addressable memory space provided by ARM and each of the various types of memory, flash, E-squared PROM, SROM and peripherals are located at different addresses within that 4GB memory map. Boot modes are available on the device, so we can either boot from main flash or if you enable the boot zero pin, we can jump into the system memory where we've included a bootloader for UART or SPI. So if you want to do firmware upgrades, you've got the option of an inbuilt system bootloader. You can always still run your own bootloader in main flash, that is not a problem, but you will have that extra step of loading your own bootloader and then loading your original code. So the flexibility is there depending on what you want to do with the booting of your device when it comes to firmware upgrades. Protection for the flash itself, so to protect your IP and your firmware that's included inside the flash. We have readout protection available on the flash. By default, the device is set to level zero, which means you've got full access to all the memories, all the system memory and there's no readout protection at all. So you can actually read and write the device as you wish. This is what you normally use when you're doing development. When you go out into the field, your chances are you will probably want to protect your software from people reading it out. So therefore you've got two options available to you. You've got level one option, which protects access from SRAM, the system memory and the serial wide debug. So therefore the only commands available to you are to change the option bytes to remove readout protect. If you do this, then a full mass arrays of the chip is automated and when you remove the option bytes and you're able to read the memory out, then there is actually nothing left in the memory to read out. So your code is actually protected. You also have the option to move to level two. Level two means that we will blow the serial wide debug fuses and this will disable the serial wide debug, the system memory so that no one else can ever read out the device ever again through either of those two methods. Once you've gone to level two, you're stuck at level two. You can never go back to any of the other levels. So you can't go back to level one or level zero at this point. So whereas in level one, you always have the option of changing the option bytes, creating the automatic mass arrays and put you back into an empty device back at level zero state. So level two is a permanent feature. If you do that, you will have to either unsolder the chip and put a new device on. There's no way us at ST can change that fact as well. So the general purpose IO pins. So these are very, very flexible pins. They have lots of functions available to them. They can be input, output. They can be analog peripheral or they can be one of the alternate functions from any of the other digital peripherals available on the device. So there are multiple registers that are available to control this that can select the input output features. If it's open drain, push, pull, floating with or without pull ups or pull downs. So there's a multiple registers that can control all these features. There is also another nice feature to help with EMC and that is a variable slew rate control. So there are different settings depending on how fast you want to toggle each individual GPIO pin. So you have the ability to change every single clock cycle if you want because the IO port is connected straight to the core. So you can actually change the level on an IO pin at every clock cycle. So in that case you might want the fastest slew rate settings available inside the device. All the GPIO pins are 5 volt tolerance and you can have up to 25 milliamps max available on each GPIO pin. You are still limited by the package characteristics. So you have to be careful when you're configuring GPIO pins where you want to need 25 milliamps of power. Another feature is that all GPIOs can be configured to generate an interrupt on an external event. So all the pins have the ability to do this. You can only have the 16 of them configured at any one time. So that is the only limitation for the interrupts is that you can only have 16 wired in at any one time. But all of them have their feature to be configured to that interrupt feature whenever you want. So specific layouts are needed for this STM32L0 device. External interrupts. So the external interrupts are a way of taking all the interrupts and connecting them to the NVIC control which is part of the ARM core. So here you can see all these GPIO channels that I just mentioned. So every GPIO pin is connected to an external interrupt and each of them will go through a multiplexer. So this is the reason why we can only have 16 connected at any one time. There are some other external peripherals connected to the interrupt controller. And these are the peripherals that can weight the device from some of the low power modes. So things like RTC alarm, low power, UART, low power timer, RTC tamper and things like that. And all of these will then go into the NVIC and weight the core up from the various low power modes that you can put the STM32 into. The low power modes that we have available on the STM32L0, there are six of them available. The modes that we're using the most in the LoRa software are those highlighted, so run and stop. So these are the two modes that we're alternating between to give us the lowest power class A node available for the LoRa protocol. But you can use whichever modes you want. So these are just the two modes that we have selected. You can use low power run, sleep, low power sleep or the stop mode. The mode that you can't use is the standby mode because at this point you have lost your SRAM retention. Therefore you have no parameters to return back to. So you'll have to come back at that point through a system reset. So standby is probably not the most useful mode when you want to keep waking up, doing things, going back to sleep. So it's the reason why we have chosen run and stop mode for our LoRaWAN examples. Just to give you an idea of the power consumptions available on the STM32L0. So the modes that we're using are the run mode. So therefore we're about 6.65 milliamps in run mode. And when we drop down to stop mode, if we don't have the RTC running, we're about 430 nanoamps with retaining all the registers and all of the SRAM data. So we're alternating between those two modes with our LoRaWAN examples that we've got. The other peripherals that we need to run for the LoRa are the RTC. So this is providing us with all the ticks for our time servers. And we will also need to have the low speed external crystal running as well. So we're actually adding another 518 nanoamps to our current consumption there. So we're getting to the realms of a microamp at that point or just over the microamp region. So this is the block diagram of the RTC. So it's a fully functional RTC inside the device. You do have backup registers built into the RTC, which can be erased on a tamper input. So you've got that feature available to you. Alarm A event highlighted is what we're using to generate the time servers. So the system tick for the time servers that are part of our LoRa software stack. All the other features of the RTC are available for your application. So you can use any of the other tamper events, timestamp events or wake up events to generate part of your application inside the STM32. The use arts. So we have three use arts on board the STM32L0. Two of them are general purpose. One of them is the low power you want. So all three of them have the fully flexible control functions. So you can set frames of seven, eight or nine data bits, different number of stop bits, different types of parity. The modes available are on the two general purpose use arts. So lin mode, smart card mode, half duplex, synchronous modes. There's those features are only available on the general purpose use arts. And all the use arts have DMA support as well. So you can use them while the core is asleep to transfer information from an external device into the SRAM. Wake up when the transfer is complete. The core can then go and process the information that's in there. Both the main general purpose use arts can run to four megabits per second. The low power you are runs from a different clock source. So you can run it from the low speed external. Therefore, the highest board rate we can achieve through the board rate generator is 9600 board. So this means that we can keep the low power you are running even when the rest of the device is in stop mode and all the other clock trees are frozen. We can still receive information over this low power you are. So here's a nice comparison list of the features that we have available on all three of the you are in the SDM 32 L zero. So main difference is it's all the alternate function modes that we don't have in the low power you are. All the other programmable and configurable information is available in all three of the use arts stroke you are. Timers so we have free 16 bits general purpose timers on board the device. All of these are fully configurable so you can see from the diagram on the right hand side that there are usually up to four channels on each of the timers. And they can be configured to be input capture output compares PWMs one pulse mode or encoder interfaces. So these are all the general purpose timers there are various triggers as well to control these timers so that you can link the timers together to generate larger time bases. So you can use the synchronization functions and you can also trigger them from external peripherals like the comparators or other peripherals like that. We have also have a 16 bit basic timer. So this is there to provide extra support for the DAC. And we also have a 16 bit low power timer on the SDM 32 L zero. So the low power timer is slightly different to the general purpose timers. And we have multiple clock sources available for the low power timer so it can be clocked from the main clock low speed external low speed internals. There are glitch filters on the two inputs available from the low power timer so it can filter any external signals into the device and it can also work in synchronous or fully asynchronous mode. So so we can use the glitch filter to filter the input stream in the synchronous modes or we can use that input one as the actual clock source to drive the actual counter itself so it can count the number of pulses while the rest of the device is currently in stop mode. The ADC so on this device we have a 1.14 mega sample per second 12 bit resolution ADC. There is a hardware oversampler integrated into this peripheral so therefore we can get up to a 16 bit resolution out of this device. You won't be able to achieve 1.14 mega samples per second at that point but you can get 16 bits on a slower frequency if you require it to be. There are multiple channels available to you for the ADC so you've got 16 external channels available and the free internal channels. One of which is the temperature sensor which we'll use later on this afternoon. You can do single or continuous conversions you can set different programmable sampling times and you can put different delays in between each conversions. The ADC is linked to the DMA so rather than having an interrupt every time you get an interconversion when you're doing 1.14 mega samples per second. You can set it up to fill a buffer and then you'll get an interrupt when your buffer is complete and then the core can go off and process all the data that's been received through the ADC converter. Another nice feature of the ADC converter is the fact that we have an analog watchdog available. The analog watchdog means that you can set up or lower thresholds for what a value needs to be and then every time you read the ADC converter you don't care about the results but you'll then get an automatic interrupt if that result passes one of the two thresholds that you've set for the analog watchdog. So these are the peripherals that are available inside the STM32 L0 that's hidden inside that metal can on your Laura Discovery board.