Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The QSL includes a SimplePublish example for the STMicroelectronics NUCLEO-L053R8 development board. This is given as a project for the Eclipse/GCC based System Workbench for STM32, where the  STM32CubeMX has been used to auto-generate the necessary Hardware Abstraction Layer (HAL) code. The application behaves just like SimplePublish for the other platforms, and like the example for SAM C21; debug prints are re-targeted through a second serial port. A green LED on the Nucleo board is also toggled to indicate whether the mote has connected to a network or not.

...

Go to the OpenSTM32 community webpage and download the System Workbench for STM32. The IDE is free and available for all platforms that support Eclipse, but you will have to register and validate a user to get access to the download and accompanying installation instructions. The standard installation should include any necessary drivers for the integrated ST-LINK/V2-1 debugger.

Note

Make sure to check your spam filter if you don't receive a validation email after registering.

...

Figure 8: NUCLEO-L053R8 extension connectors.


NUCLEO-L053R8

Mote

Anchor
tab_mote2nucleoMap
tab_mote2nucleoMap

+3V3VBAT
GNDGND
PA9 / D6RX
PA10 / D2TX
GNDRX RTSn
GNDTX CTSn

Table 10: NUCLEO-L053R8 to mote pin mapping.

...

  1. File > Import... > General > Existing Projects into Workspace and press Next >.
  2. Select root directory: Click Browse... and navigate to the SimplePublish example: examples/nucleo-l053r8/SimplePublish/
  3. Press OK
  4. Select SimplePublish that appears in the Projects list.
  5. Make sure to leave the option Copy projects into workspaceworkspace unchecked and press
  6. Press Finish.
Note

The System Workbench project expects to find the sm_clib and sm_qsl as they appear in the Directory Structure. If you chose the zip download or subversion checkout, the sm_clib/ directory from the separate unzipped folder/svn checkout need to be copied into the QSL repository to achieve the same structure.

...

  1. Run > Debug (F11)
  2. Select Ac6 STM32 C/C++ Application and press OK.
    Image Modified
  3. Eclipse should now prompt you to change to a Debug perspective, before starting a debug session.

After this you should will be able to debug/run the project with Run > Debug (F11) and Run > Run (Ctrl+F11) (or press the icons: ) without any configuration.

STM32CubeMX and Customization

Other than the files that implement the necessary porting functions (i.e. dn_uart.c, dn_lock.c, dn_endianness.cdn_time.c and dn_watchdog.c), all the platform specific source and header files are auto-generated with STM32CubeMX. In addition, all user code in these generated files has been placed between "USER CODE BEGIN xxx" and "USER CODE END xxx" comments, which will be left unchanged if you make changes to the STM32CubeMX project and generate new code. Therefore, the STM32CubeMX project files used to generate code for the example has been included in the repository:

  • SimplePublish.ioc - Configuration settings, defining the STM32CubeMX project.
  • .mxproject - Used to track previously generated files and directories.

This means that you can add or change features included in the generated HAL code by simply opening SimplePublish.ioc in STMCubeMX, make the necessary changes and generate new code.

Change Toolchain/IDE
Anchor
sec_changeToolchain
sec_changeToolchain

If you have a look at the project settings in STM32CubeMX, you will see that you can generate project files for other toolchains than the System Workbench (SW4STM32), e.g.:

  • IAR Embedded Workbench for ARM
  • Keil MDK
  • TrueSTUDIO

Again, this will preserve the user code entered between the "USER CODE BEGIN xxx" and "USER CODE END xxx" comments, but you will have to manually add the files that are not auto-generated:

  • The porting functions: dn_uart.cdn_lock.cdn_endianness.cdn_time.c and dn_watchdog.c
  • The QSL and C Library: sm_qsl and sm_clib

Port to Similar Platforms

Unfortunately, you can not simply change platform in the STM32CubeMX settings and generate code for another MCU. What you can do instead is to create a new STM32CubeMX project, select the platform of your choice and configure the same settings as in the provided project. Other than activating the two USARTs and correctly configuring their parameters, the default settings should do the trick (make sure to also have a look at the project settings before generating code).

After generating the code, libraries and project files, you will again have to add the files that are not auto-generated (see the previous section). You will also have to copy the user code from the auto-generated files in the original project and into the corresponding files in the new project. Auto-generated files with user code in SimplePublish:

  • main.c
  • usart.c/.h
  • stm32l0xx_it.c