Getting Started with X-CUBE-GNSS1
Sep 1, 2020 11:27 · 1567 words · 8 minute read
Getting Started with X-CUBE-GNSS1 In this webinar we will see an introduction to STM32Cube the list of the required hardware and software tools how to install an STM32Cube Expansion Package in STM32CubeMX how to get started with the X-CUBE-GNSS1 in STM32CubeMX Introduction to STM32Cube STM32Cube is the Software Ecosystem for STM32, made and supported by STMicroelectronics, and proposed to all STM32 developers for free. It combines a set of PC software development tools and a set of embedded software bricks. STM32CubeExpansion packages provides an easy and powerful way to integrate additional components to the project, such as drivers for other ST components (sensors, for instance) or middleware components. The latest STM32CubeExpansion specifications offer the ability to configure and integrate these components directly into the project from STM32CubeMX and STM32CubeIDE. The embedded software environment for STM32 offers the standard STM32Cube MCU packages (such as STM32CubeF4, STM32CubeH7, STM32CubeL5 …).
01:38 - STM32Cube Expansion packages extend it with additional software components enabling high-level application solutions. Those packages can come: - from STMicroelectronics, to support digital or high-level software component from ST portfolio (eg: NFC, MEMS, Bluetooth or even AI). - from ST Partners or third parties - from communities and education programs, or from your own, personal or professional, to share embedded software components with each other or just within restricted groups. The STM32Cube Expansion guidelines are publicly available on www.st.com/stm32cube Required hardware and software You need an ST Nucleo board or any evaluation board equipped with an STM32MCU on the ST Nucleo board you have flexible board power supply through USB or external source integrated ST-Link/V2-1 for mass storage device flash programming 2 push buttons and 2 color LEDs the Arduino connectors to easy access to add-ons the STM32 MCU the Morpho extension headers to directly access the MCU pinout.
03:03 - In this webinar we will use a Nucleo-F401RE. You need the ST X-NUCLEO-GNSS1A1 expansion board equipped with the Teseo-LIV3F GNSS device On this board you have also the Arduino connectors to easy access to add-ons. The X-NUCLEO-GNSS1A1 expansion board must be plugged on top of the STM32 Nucleo board. Finally, you need the latest STM32CubeMX tool, available on st.com, installed on your PC. How to install an STM32Cube Expansion Package in STM32CubeMX Launch the STM32CubeMX on your PC. Click the INSTALL/REMOVE button. Go to STMicroelectronics tab. Expand the pack you need to install (e.g. the X-CUBE-GNSS1).
04:03 - Click the Refresh button to retrieve all the available pack versions. Select the version you want to install (it is suggested to install the latest one). Click the Install Now button to install the selected pack version. To successfully complete the installation process, accept the license terms and click Finish. The green box indicates that the pack has been successfully installed. Close the window.
04:46 - Getting Started with X-CUBE-GNSS1 in STM32CubeMX To set up a new project, the user can start either selecting an MCU or an ST board. In this webinar we will set up a new project selecting an ST board. As previously said, we will use the ST Nucleo-F401RE board. To easily find it in the ST board list, use some filter: check the Nucleo-64 box in the board Type list and the STM32F4 box in the MCU Series list Once you find your board, double click on it to start the project. Click Yes to initialize all peripherals with their default mode.
05:28 - From the Pinout view it is possible to configure the MCU pins enable the Peripherals Clicking the Software Packs menu it is also possible to include additional software components to the project. Just expand the line of the STM32 Expansion Package components you want to add and start to select the components. The best way to get familiar with an STM32Cube Expansion Package is generating one of the included sample application. For example, select the GetPos sample application. Double clicking the Application row, some useful information are displayed: you can open the application readme or the Getting Started Guide containing all the information on how to set up a project using the X-CUBE-GNSS1 components.
06:22 - You can find, for instance, the sample application descriptions and the Configuration Steps section with the information on the pins, the peripherals and the middlewares to use. After selecting the sample application all the required software components can be easily detected from the Component dependencies window. You need to select either the Custom Board Support (if you are using a custom board) or the GNSS1A1 Board Extension (if, like in this case, you are using the X-NUCLEO-GNSS1A1) and the LibNMEA GNSS library. Then, you can continue solving the component dependencies clicking each row with the yellow icon and selecting the components listed in the Component dependencies window until all icons become green. Gray icons that may appear indicate that other components are required.
07:37 - For some GNSS applications, the FreeRTOS middleware is required. It must be selected from the Middleware list, accessible after closing this window. Now the pinout configuration can start using the information contained in the Getting Started guide. Open it and take note of the pins, peripherals and middlewares that must be enabled and configured then you can start. Let’s start from the I2C bus Set PB9 as I2C1_SDA PB8 as I2C1_SCL and enable the I2C1 from the Connectivity list.
08:27 - Set now the pins used by the Teseo LIV-3F module for the Reset and the Wake Up: set the PA8 as GPIO Output, reset the status of the PA5 and set it as GPIO Output. Nothing has to be done for the USART since it is enabled by default. Now we can move to enable the FreeRTOS middleware that can be found under the Middleware category. Enable the FreeRTOS interface selecting either the CMSIS_V1 or the CMSIS_V2. Verify that the parameters are set as reported in the Getting Started guide. In particular, verify the value of the MINIMAL_STACK_SIZE and of the TOTAL_HEAP_SIZE. Now we can configure the GNSS components clicking on Software Packs and then on STMicroelectronics.X-CUBE-GNSS1 pack. Select all the GNSS components and associate peripherals and pins to their proper function: - the I2C1 as bus for the communication between the MCU and the Teseo LIV-3F module - the PA5 for the chip Wake Up - the USART2 as bus for the COM logs (the serial communication between the MCU and the user’s PC) - the PA8 for the chip Reset Clicking the User Constants and the Parameter Settings tabs the user can set constants or parameters such as the Debug for the log messages or the Odometer, Geofencing and Datalog features. Clicking the System View the user can access the NVIC section to enable the interrupt lines. After clicking the NVIC, a pop-up will appear.
10:28 - It warns you to make sure all interrupt handlers, calling RTOS functions, have a preemption priority lower than the highest syscall interrupt priority. Among the NVIC, enable the I2C1 event and error interrupts and set to 5 their Preemption Priorities (we’ll verify later it is equal to the highest syscall interrupt priority value) For any further check on all other settings the sections in System View (System Core,…, Connectivity,…) can be accessed. For example, clicking USART2 it is possible to check that it is configured as indicated in the Getting Started guide. Clicking on FREERTOS, it is possible to verify its parameters are correctly set. We can verify the LIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY value.
11:18 - Its value is 5, so we don’t need to change the I2C1 interrupt preemption priorities previously set. Now click the Project Manager tab. Go to Advanced Settings and in the Register CallBack section enable the I2C register callback. Go back to Project section. Insert your project name. Set the Project Location on your file system. Select your preferred toolchain among the list of the supported ones. In this example we use the STM32CubeIDE (without the Under Root option).
12:16 - Now we are ready to generate the code clicking the GENERATE CODE button. A pop-up ask you if you want to use the HAL timebase source or to keep the Systick. You can click Yes to keep the Systick. Wait few seconds until the code generation process finish. To open the generated STM32CubeIDE project click the Open Project button. The STM32CubeIDE will start opening… Once the STM32CubeIDE is open, a pop-up will show the project import status, Close the pop-up, expand the project structure and browse the generated code (where you can find the application, the driver and the middleware files).
13:20 - Build the project to generate the binary file. The Console output in the IDE shows the logs of the build process. Wait until the build process finishes… After connecting your STM32 development board to your PC, flash it with the generated binary file. Right-click on the project name and select the Run As –> STM32 Cortex-M C/C++ Application Accept the default settings in the Edit Configuration clicking OK. The flashing process will start (its progress is shown in the Console output).
14:05 - Once the flashing process has successfully terminated open a serial terminal on your PC and start playing with the application (speed: 115200, data: 8 bits, parity: none, stop bits: 1 bit, Flow control: none, Transmit delay: 5 msec/char, 5 msec/line). For more information, please, visit www.st.com/stm32cubemx Thank You! For further information on our products, please, visit us at www.st.com .