 Welcome to the HSC tuning video of the STM32WB Getting Started series. I'm Joe Tiorina and I'll be showing you how to tune the HSC oscillator frequency for RF applications such as Bluetooth LE, since the HSC accuracy is essential for RF performance. The accuracy of Bluetooth LE is 50 ppm and 40 ppm for IEEE 802.15.4. In this video though, I'll be focusing on Bluetooth LE. The 32 MHz NX2016A from NDK is what was used in our WB NUCLEO reference board, since this meets the required specifications for frequency tolerance and stability. Note that you can select other crystals as long as they have similar characteristics. And to make things simpler, the WB features internal programmable load capacitors that can be used to tune the crystal frequency. AppNode5042 describes three HSC tuning methods. The first one is the manual method, which I'll be demonstrating in this video. It consists in measuring the RF clock with a positioned frequency meter, while controlling the frequency from the buttons on the NUCLEO board. The second is the automatic method. And the third is the Qt Monitor RF method, which I invite you to read more about in the AppNode. Today I will focus on the manual method, since this is the most practical. Corresponding to the AppNode is the X-Cube Clock Trim Expansion Software Package, which includes examples to perform the HSC tuning with these methods. And here's the list of tools that are used to demonstrate how to tune the HSC on a WB NUCLEO board and verify. So let's go ahead and get started with the demonstration where we will perform these three basic steps. Step one, measure the HSC clock on one of the available MCO pins. Step two, perform step-by-step tuning of the load capacitance to reach the best accuracy. And step three, store this load capacitance value in the OTP register so it can be read and applied by the user application. I'll start by downloading the X-Cube Clock Trim Software Package from ST.com. Once downloaded, I'll go ahead and extract the zip file to install it. Once installed, I'll find the project corresponding to the manual method, which is the one name RCC-HSC-Calib. Then open the Set Calibration Q-by-D-E project by double-clicking the .project file. And once open, I'll go ahead and build it. Now I'll hook up the Precision Frequency Counter to the WB-SMCO pin, pin 25 of connector CN10 along with ground. Then I'll connect the NUCLEO board to my Windows PC to power it. Now I can load the Set Calibration Program that I just built a second ago. Now do so by using the provided batch script named Set-HSC-Calibration-OTP.bat under the Q-by-D-E project folder. And from my command window, I'll execute the script. Note that the script invokes the Q-programmer command line interface utility for programming. Once the Set Calibration Program starts, all three LEDs will turn on briefly. Now I'm ready to begin tuning. You can see from my frequency counter that the HSC frequency is not too far off the 32 MHz target, which is an indication of a good PCB implementation of the HSC circuit. Anyhow, I'll go ahead and start adjusting the frequency by changing the Load Capacitance from the Switch 1 button and Switch 3 button. Once the frequency is centered, I'll program the current HSC Tune value in the OTP register by pressing the Switch 2 button. For verification purposes, I can check the OTP register at address 1FF7000 from the Q-programmer's memory viewer, and see the HSC Tune Value program. In this case, it was 1A. Another way to verify the HSC frequency is tuned and centered is by measuring the accuracy of a known tone frequency with a spectrum analyzer, making sure that the frequency is within 50 kHz for all Bluetooth LE channels. The procedure is also described in Section 6 of application note AN5378. Then finding the BLE transparent mode example under the SCM32 QBB package, which you should already have handy from following the previous videos of the series. I'll go ahead and open the project with Q by DE and build it. Then I'll load and launch a debug session. And since I'm here, let me also show you how the program reads the 1A HSC Tune value from the OTP register. I showed you earlier and applies it to the corresponding RCC register. This function is performed by config HSC, which is included in all BLE examples in the QBB. But now I'll let the program run and get back to the tone frequency measurement. For that, I'll need the Q monitor RF utility to configure the device to transmit a carrier wave. So I'll go ahead and connect to my nuclear board. Then go over to the RF test tab and set it up for transmitter mode. Change my TX frequency to 2410 megahertz, which is channel 3, and start the tone. Then from my spectrum analyzer, I can measure the tone frequency. And as you can see, I'm only about 2600 hertz off well within the 50 kilohertz specified by the Bluetooth spec. This method can also be used as a tuning method when none of the MCO pins are available on the board. As mentioned before, there is a dedicated app note on the topic of HSC tuning for the SCM32 WB. So I invite you to review this one for further details. Related to this topic is tuning of the 32 kilohertz LSE, which is another crystal oscillator that's required by the Bluetooth LED radio. For this, please see app note AM4867. I hope you enjoyed this video and thank you for watching.