17 Tutorial 7 - Using the X-Cube-BLE1 software pack ¶
STM32CubeF4 MCU package if it is not present in STM32Cube repository.
Click Open project. The Oryx software components are displayed in the generated project (see Figure 685).
Figure 685. Generated project with third party pack components ¶
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 ¶
Check STM32CubeMX Internet connection:
Select the Help > Updater Settings menu to open the updater window.
Verify in the Connection tab that the Internet connection is configured and up.
Install the required embedded software packages (see Figure 689):
Select the Help > Manage Embedded software packages menu to open the embedded software package manager window.
Click the Refresh button to refresh the list with the latest available package versions.
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.
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
Start a new project:
Select New Project to open the new project window.
Select the Board selector tab.
Select Nucleo64 as board type and STM32L0 as MCU Series.
Select the NUCLEO-L053R8 from the resulting board list (see Figure 690).
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
Add X-Cube-BLE1 components to the project:
Click Additional Software from Pinout & Configuration view to open the Additional Software component Selection window.
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
Enable peripherals and GPIOs from the Pinout tab (see Figure 693):
Configure USART2 in Asynchronous mode.
Configure SPI1 in Full-duplex master mode.
Left-click the following pins and configure them for the required GPIO settings:
PA0: GPIO_EXTI0
PA1: GPIO_Output
PA8: GPIO_Output
Enable Debug Serial Wire under SYS peripheral.
Figure 693. Configuring peripherals and GPIOs
Configure the peripherals from the Configuration tab:
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).
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.
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
Enable and configure X-Cube-BLE1 pack components from the Pinout & Configuration view:
Click the pack items from the left panel to show the mode and configuration tabs.
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).
Leave the Parameter Settings Tab unchanged.
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 .
Generate the SensorDemo project:
a) Click to generate the code. The Project Settings window opens if the project has not yet been saved. .. image:: ../../../assets/media/image1302.webp
- width :
1.16667in
- height :
0.20167in
b) Click to generate the code once the project settings have .. image:: ../../../assets/media/image1302.webp
- width :
1.16667in
- height :
0.20167in