Skip to content

Commit

Permalink
boards: arm: add initial support for NUCLEO-L152RE board
Browse files Browse the repository at this point in the history
The board features a STM32L152RET6 MCU.

Tested samples:

    * hello_world
    * basic/blinky
    * basic/button
    * gui/lvgl + SHIELD=ssd1306_128x64
    * philosophers
    * sensor/hmc5883l
    * subsys/shell/shell_module + CONFIG_EEPROM_SHELL=y
    * synchronization

Signed-off-by: Antony Pavlov <[email protected]>
  • Loading branch information
frantony authored and MaureenHelm committed Jan 21, 2020
1 parent fc1cdf2 commit f144e39
Show file tree
Hide file tree
Showing 13 changed files with 409 additions and 0 deletions.
7 changes: 7 additions & 0 deletions boards/arm/nucleo_l152re/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_PINMUX)
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
endif()
9 changes: 9 additions & 0 deletions boards/arm/nucleo_l152re/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2019 Antony Pavlov <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
#

config BOARD_NUCLEO_L152RE
bool "NUCLEO-64 L152RE Development Board"
depends on SOC_STM32L152XE
26 changes: 26 additions & 0 deletions boards/arm/nucleo_l152re/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Copyright (c) 2019 Antony Pavlov <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
#

if BOARD_NUCLEO_L152RE

config BOARD
default "nucleo_l152re"

if UART_CONSOLE

config UART_2
default y

endif # UART_CONSOLE

if I2C

config I2C_1
default y

endif # I2C

endif # BOARD_NUCLEO_L152RE
39 changes: 39 additions & 0 deletions boards/arm/nucleo_l152re/arduino_r3_connector.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2019 Antony Pavlov <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
arduino_header: connector {
compatible = "arduino-header-r3";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <0 0 &gpioa 0 0>, /* A0 */
<1 0 &gpioa 1 0>, /* A1 */
<2 0 &gpioa 4 0>, /* A2 */
<3 0 &gpiob 0 0>, /* A3 */
<4 0 &gpioc 1 0>, /* A4 */
<5 0 &gpioc 0 0>, /* A5 */
<6 0 &gpioa 3 0>, /* D0 */
<7 0 &gpioa 2 0>, /* D1 */
<8 0 &gpioa 10 0>, /* D2 */
<9 0 &gpiob 3 0>, /* D3 */
<10 0 &gpiob 5 0>, /* D4 */
<11 0 &gpiob 4 0>, /* D5 */
<12 0 &gpiob 10 0>, /* D6 */
<13 0 &gpioa 8 0>, /* D7 */
<14 0 &gpioa 9 0>, /* D8 */
<15 0 &gpioc 7 0>, /* D9 */
<16 0 &gpiob 6 0>, /* D10 */
<17 0 &gpioa 7 0>, /* D11 */
<18 0 &gpioa 6 0>, /* D12 */
<19 0 &gpioa 5 0>, /* D13 */
<20 0 &gpiob 9 0>, /* D14 */
<21 0 &gpiob 8 0>; /* D15 */
};
};

arduino_i2c: &i2c1 {};
arduino_serial: &usart2 {};
3 changes: 3 additions & 0 deletions boards/arm/nucleo_l152re/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
173 changes: 173 additions & 0 deletions boards/arm/nucleo_l152re/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
.. _nucleo_l152re_board:

ST Nucleo L152RE
################

Overview
********
The STM32 Nucleo-64 development board with STM32L152RE MCU, supports Arduino™ and ST morpho connectivity.

The STM32 Nucleo board provides an affordable, and flexible way for users to try out new concepts,
and build prototypes with the STM32 microcontroller, choosing from the various
combinations of performance, power consumption and features.

The Arduino Uno V3 connectivity support and the ST morpho headers allow easy functionality
expansion of the STM32 Nucleo open development platform with a wide choice of
specialized shields.

The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer.

The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together
with various packaged software examples.

.. image:: img/nucleo_l152re.jpg
:width: 500px
:height: 367px
:align: center
:alt: NUCLEO-L152RE

More information about the board can be found at the `Nucleo L152RE website`_.

Hardware
********
Nucleo L152RE provides the following hardware components:

- STM32 microcontroller in QFP64 package
- Two types of extension resources:

- Arduino Uno V3 connectivity
- ST morpho extension pin headers for full access to all STM32 I/Os

- On-board ST-LINK/V2-1 debugger/programmer with SWD connector:

- Selection-mode switch to use the kit as a standalone ST-LINK/V2-1

- Flexible board power supply:

- USB VBUS or external source (3.3V, 5V, 7 - 12V)
- Power management access point

- Three LEDs:

- USB communication (LD1), user LED (LD2), power LED (LD3)

- Two push-buttons: B1 (USER/blue) and B2 (RESET/black)
- USB re-enumeration capability. Three different interfaces supported on USB:

- Virtual COM port
- Mass storage
- Debug port

More information about STM32L152RE can be found here:

- `STM32L152 reference manual`_
- `STM32L152 data sheet`_

Supported Features
==================

The Zephyr nucleo_l152re board configuration supports the following hardware features:

+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| CLOCK | on-chip | reset and clock control |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c controller |
+-----------+------------+-------------------------------------+
| EEPROM | on-chip | eeprom |
+-----------+------------+-------------------------------------+

Other hardware features are not yet supported in this Zephyr port.

The default configuration can be found in the defconfig file:
``boards/arm/nucleo_l152re/nucleo_l152re_defconfig``

Connections and IOs
===================

Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
capable except for analog inputs.

Board connectors:
-----------------
.. image:: img/nucleo_l152re_connectors.png
:width: 800px
:align: center
:height: 619px
:alt: Nucleo L152RE connectors

Default Zephyr Peripheral Mapping:
----------------------------------

- UART_2 TX/RX : PA2/PA3 (ST-Link Virtual COM Port)
- I2C1 SCL/SDA : PB8/PB9 (Arduino I2C)
- B1 (USER/blue) : PC13
- LD1 : PA5

For mode details please refer to `STM32 Nucleo-64 board User Manual`_.

Programming and Debugging
*************************

Applications for the ``nucleo_l152re`` board configuration can be built and
flashed in the usual way (see :ref:`build_an_application` and
:ref:`application_run` for more details).

Flashing
========

Nucleo L152RE board includes an ST-LINK/V2-1 embedded debug tool interface.
This interface is supported by the openocd version included in the Zephyr SDK.

Flashing an application to Nucleo L152RE
----------------------------------------

Here is an example for the :ref:`blinky-sample` application.

.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: nucleo_l152re
:goals: build flash

You will see the LED blinking every second.

Debugging
=========

You can debug an application in the usual way. Here is an example for the
:ref:`hello_world` application.

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: nucleo_l152re
:maybe-skip-config:
:goals: debug

References
**********

.. target-notes::

.. _Nucleo L152RE website:
https://www.st.com/en/evaluation-tools/nucleo-l152re.html

.. _STM32L152 reference manual:
https://www.st.com/resource/en/reference_manual/cd00240193.pdf

.. _STM32L152 data sheet:
https://www.st.com/resource/en/datasheet/stm32l152re.pdf

.. _STM32 Nucleo-64 board User Manual:
https://www.st.com/resource/en/user_manual/dm00105823.pdf
56 changes: 56 additions & 0 deletions boards/arm/nucleo_l152re/nucleo_l152re.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2019 Antony Pavlov <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <st/l1/stm32l152Xe.dtsi>
#include "arduino_r3_connector.dtsi"

/ {
model = "STMicroelectronics STM32L152RE-NUCLEO board";
compatible = "st,stm32l152re-nucleo", "st,stm32l152";

chosen {
zephyr,console = &usart2;
zephyr,shell-uart = &usart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};

leds {
compatible = "gpio-leds";
green_led_0: led_0 {
gpios = <&gpioa 5 GPIO_INT_ACTIVE_LOW>;
label = "User LD2";
};
};

gpio_keys {
compatible = "gpio-keys";
user_button: button {
label = "User";
gpios = <&gpioc 13 GPIO_INT_ACTIVE_LOW>;
};
};

aliases {
led0 = &green_led_0;
sw0 = &user_button;
eeprom-0 = &eeprom;
};
};

&usart2 {
current-speed = <115200>;
status = "okay";
};

&i2c1 {
status = "okay";
};

&eeprom {
status = "okay";
};
16 changes: 16 additions & 0 deletions boards/arm/nucleo_l152re/nucleo_l152re.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
identifier: nucleo_l152re
name: NUCLEO-L152RE
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
ram: 80
flash: 512
supported:
- arduino_gpio
- arduino_i2c
- eeprom
- gpio
- i2c
- uart
32 changes: 32 additions & 0 deletions boards/arm/nucleo_l152re/nucleo_l152re_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_ARM=y
CONFIG_SOC_SERIES_STM32L1X=y
CONFIG_SOC_STM32L152XE=y
CONFIG_CORTEX_M_SYSTICK=y
# 32MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000

# enable uart driver
CONFIG_SERIAL=y
# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# enable pinmux
CONFIG_PINMUX=y

# enable GPIO
CONFIG_GPIO=y

# clock configuration
CONFIG_CLOCK_CONTROL=y
# SYSCLK selection
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# Use HSI source
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
CONFIG_CLOCK_STM32_PLL_DIVISOR=2
# produce 32Mhz clock at PLL output
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=4
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=1
Loading

0 comments on commit f144e39

Please sign in to comment.