17 Tutorial 7 - Using the X-Cube-BLE1 software pack ¶
9. Click Open project. The Oryx software components are displayed in the generated project (see Figure 685).
17 Tutorial 7 – Using the X-Cube-BLE1 software pack
This tutorial demonstrates how to achieve a functional project using the X-Cube-BLE1 software pack.
Below the prerequisites to run this tutorial:
• Hardware: NUCLEO-L053R8, X-NUCLEO-IDB05A1 and mini-USB cable (see Figure 686)
• Tools: STM32CubeMX, IDE (Atollic ® or any other toolchain supported by STM32CubeMX)
• Embedded software package: STM32CubeL0 (version 1.10.0 or higher), X-Cube-BLE1
1.1.0 (see Figure 687).
• Mobile application (see Figure 688): STMicroelectronics BlueNRG application for iOS ® or Android ™
Figure 687. Embedded software packages
Proceed as follows to install and run the tutorial:
1. Check STM32CubeMX Internet connection:
a) Select the Help > Updater Settings menu to open the updater window.
b) Verify in the Connection tab that the Internet connection is configured and up.
2. Install the required embedded software packages (see Figure 689):
a) Select the Help > Manage Embedded software packages menu to open the embedded software package manager window.
b) Click the Refresh button to refresh the list with the latest available package versions.
c) Select the STM32Cube MCU Package tab and check that the STM32CubeL0 firmware package version 1.10.0 or higher is installed (the checkbox must be green). Otherwise select the checkbox and click Install now.
d) Select the STMicrolectronics tab and check that the X-Cube-BLE1 software pack version 1.0.0 is installed (checkbox must be green). Otherwise, select the checkbox and click Install now.
Figure 689. Installing Embedded software packages
3. Start a new project:
a) Select New Project to open the new project window.
b) Select the Board selector tab.
c) Select Nucleo64 as board type and STM32L0 as MCU Series.
d) Select the NUCLEO-L053R8 from the resulting board list (see Figure 690).
e) Answer No when prompted to initialize all peripherals in their default mode (see Figure 691).
Figure 690. Starting a new project - selecting the NUCLEO-L053R8 board
4. Add X-Cube-BLE1 components to the project:
a) Click Additional Software from Pinout & Configuration view to open the Additional Software component Selection window.
b) Select the relevant components (see Figure 692)
The Application group comes with a list of applications: the C files implement the application loop, that is the Process() function. From the Application group, select the SensorDemo application.
Select the Controller and Utils components
Select the Basic variant for the HCI_TL component . The Basic variant provides the STMicroelectronics implementation of the HCI_TL API while the template option requires users to implement their own code.
Select the UserBoard variant as HCI_TL_INTERFACE component. Using the UserBoard option generates the <boardname>_bus.c file, that is nucleo_l053r8_bus.c for this tutorial, while the template option generates the custom_bus.c file and requires users to provide their own implementation.
Refer to the X-Cube-BLE1 pack documentation for more details on software components.
Click OK to apply the selection to the project and close the window. The left panel Additional Software section is updated accordingly.
Figure 692. Selecting X-Cube-BLE1 components
5. Enable peripherals and GPIOs from the Pinout tab (see Figure 693):
a) Configure USART2 in Asynchronous mode.
b) Configure SPI1 in Full-duplex master mode.
c) Left-click the following pins and configure them for the required GPIO settings:
PA0: GPIO_EXTI0
PA1: GPIO_Output
PA8: GPIO_Output
d) Enable Debug Serial Wire under SYS peripheral.
Figure 693. Configuring peripherals and GPIOs
6. Configure the peripherals from the Configuration tab:
a) Click the NVIC button under the System section to open the NVIC configuration window. Enable EXTI line 0 and line 1 interrupts and click OK (see Figure 694).
b) Click the SPI button under the Connectivity section to open the SPI configuration window. Check that the data size is set to 8 bits and the prescaler value to 16 so that HCLK divided by the prescaler value is less or equal to 8 MHz.
c) Click USART2 under the Connectivity section to open the Configuration window and check the following parameter settings:
Under Parameter Settings:
Baud rate: 115200 bits/s
Word length: 8 bits (including parity) Parity: none
Stop bits: 1
Under GPIO Settings:
User labels: USART_TX and USART_RX
Figure 694. Configuring NVIC interrupts
7. Enable and configure X-Cube-BLE1 pack components from the Pinout & Configuration view:
a) Click the pack items from the left panel to show the mode and configuration tabs.
b) Click the check boxes from the Mode panel to enable X-Cube-BLE1, the configuration panel appears showing the parameters to configure. An orange triangle indicates that some parameters are not configured. It turns into a green check mark once all parameters are correctly configured (see Figure 695).
c) Leave the Parameter Settings Tab unchanged.
d) Go the Platform settings tab, configure the connection with the hardware resources as indicated in Figure 695 and Table 29.
Table 29. Connection with hardware resources
|
Name |
IPs or components |
Found solutions |
|
BUS IO driver |
SPI in Full-duplex master mode |
SPI1 |
|
EXTI Line |
GPIO:EXTI |
PA0 |
|
CS Line |
GPIO:output |
PA1 |
|
Reset Line |
GPIO:output |
PA8 |
|
BSP LED |
GPIO:output |
PA5 |
|
BSP Button |
GPIO:EXTI |
PC13 |
|
BSP USART |
USART in Asynchronous mode |
USART2 |
Check that the icon turns to . Click OK to close the Configuration window .
Figure 695. Enabling X-Cube-BLE1
Generate the SensorDemo project:
a) Click ** to generate the code. The **Project Settings window opens if the project has not yet been saved.
b) Click ** ** to generate the code once the project settings have
been properly configured (see Figure 696). When the generation is complete, a dialog window requests to open the project folder (Open Folder) or to open the project in IDE toolchain (Open Project). Select Open Project (see Figure 697).
Figure 696. Configuring the SensorDemo project









