 In this second section of the app note video, we are going to get started with the creation of the project using STM32Q IDE. We are going to start by opening STM32Q IDE and create a new project. To do so, you can simply click on File, New, STM32 project, go on the Board Selector tab, and search for BL475, select the first board, click Next, give a project name, finish here, and when prompted to initialize all the peripherals with the default mode, select No to avoid generating unused code. We will be configuring an I2C interface to communicate with the accelerometer and a UART interface for the basic logging. We are going to start by adding the accelerometer driver from the XCube MEMS components. To do so, we need to open the software pack selector in the Pinout configuration, apply the board part filter, and under the MEMS package, select the LSM6DSL as I2C. We are back to the main interface and now we need to configure the I2C peripheral that is under Connectivity. We are going to select I2C2 and configure it as I2C. Here we need to select the I2C mode and configure it as Fast mode. So it's going to work at 400kHz, and in the GPIO settings we should check that PB10 and PB11 are configured as I2C. We actually need one more pin to interface the sensor and receive the Intrap1 signal. You can check out the IUT node user manual for the schematics and I2C pinout and the Intrap1 signal from the accelerometer. As you can see in the schematic, we need to configure PD11. So under GPIO, we search for PD11 and we need to make sure that it's configured as external Intrap mode with rising edge. And then under NVIC, we need to make sure that the corresponding Intrap is enabled here and it should be already done. Now we need to configure the XCube MEMS1 package. So we are going to need to expand the software pack here, select the ST Microrotronix XCube MEMS1, enable the package and on the platform settings, select I2C2. The last peripheral that we are going to use is the Usart1. Select Usart1 under the connectivity interface, enable the asynchronous mode. If not already configured, set the BodeRate to 115200 here. And then under the GPIO settings, make sure that PB6 and PB7 are associated with the UART1. This UART will be used to send log messages to the PC. The MCU configuration is now complete and you can generate the code either by saving your project or by clicking Project Generate Code. All the code needed for the peripherals configuration has been generated. Now it's time to add our application code. To facilitate this step, we'll copy the code directly from the wiki page. In the Project Explorer panel, double-click on core-source-main.c to open the code editor for the user application code. The first section to be added is the Private Includes. Here we have three different files and are the header files for the accelerometer, the I2C bus and the SDIO used for the print-def output. Simply copy this code here. The second part is the Private Variable section and it's here. We can go back to the wiki page and copy these two lines. Here we have the definition of a structure for the motion sensor and that already received variable that is used to notify when new data is available. Copy here. Now we're going to copy the memc init function definition and go back. We're going to copy the actual function. This function has to be copied in the user code section 4. Go back here and use it after all the code generated by the tool here. This function is used to configure the accelerometer for a 26 Hz sample rate plus or minus 4G range and an intrap for the data radius. Now we need to copy the callback that's used when we receive an intrap from the sensor and this function also goes inside the code begin4. Then we're going to redefine the write. This is done in order to be able to use the print-def. Now we're going to copy a new definition of the error handler to have a toggle LED in case of errors. At this point we can go back to the main and start copying application code in the main. First we need to initialize the variable and initialize the sensor. It's done in the main here. And then in the while loop we implement a simple loop that waits for data to be available and then send data over UART to the PC. At this point we can simply project, compile. Here we have zero errors, zero warning, so we are ready to download and debug the project. I already have a board connected to the PC so I can simply download the binary by clicking run, run as, STM32 application. Now QBID is going to download the binary into the board. Here now it's done. Now once done I can simply open TerraTerm and connect to the STLINK virtual comport. Make sure that the serial part is set to 1500,200. And here we can see the data from the accelerometer. Now that we are done with the code we can go back to the weak page for a few remarks. First to capture data you can copy paste the serial output into a CSV text file or you can use the following command on a Linux machine. In the weak page you can also find a Python script that can be used to plot data. Here you can see the output. The CSV file can be manually edited for data cleanup and once you are satisfied with the capture that can be used for machine learning model training.