Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions arch/arm/soc/st_stm32/stm32f0/Kconfig.defconfig.stm32f091xc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Kconfig - ST Microelectronics STM32F091XC MCU
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in the SoC patch

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also make it generic to STM32F091XX (rename to Kconfig.defconfig.stm32f091xx)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to soc patch.

Did not make it generic. IMHO this should be done in a separate pull request. I plan to do that when I adapt zephyr for my custom made F091xB board.

#
# Copyright (c) 2017 b0661n0e17e@gmail.com
#
# SPDX-License-Identifier: Apache-2.0
#

if SOC_STM32F091XC

config SOC
string
default stm32f091xc

config FLASH_PAGE_SIZE
hex
default 0x800

config NUM_IRQS
int
default 32

endif # SOC_STM32F091XC
3 changes: 3 additions & 0 deletions arch/arm/soc/st_stm32/stm32f0/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ depends on SOC_SERIES_STM32F0X
config SOC_STM32F030X8
bool "STM32F030X8"

config SOC_STM32F091XC
bool "STM32F091XC"

endchoice
4 changes: 4 additions & 0 deletions arch/arm/soc/st_stm32/stm32f0/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
#include <stm32f0xx_ll_system.h>
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */

#ifdef CONFIG_IWDG_STM32
#include <stm32f0xx_ll_iwdg.h>
#endif

#endif /* !_ASMLANGUAGE */

#endif /* _STM32F0_SOC_H_ */
10 changes: 10 additions & 0 deletions boards/arm/nucleo_f091rc/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Kconfig - STM32 Nucleo-64 development board with STM32F091RC MCU configuration
#
# Copyright (c) 2017 Bobby Noelte
#
# SPDX-License-Identifier: Apache-2.0
#

config BOARD_NUCLEO_F091RC
bool "NUCLEO-64 F091RC Development Board"
depends on SOC_STM32F091XC
13 changes: 13 additions & 0 deletions boards/arm/nucleo_f091rc/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Kconfig - STM32 Nucleo-64 development board with STM32F091RC MCU
#
# Copyright (c) 2017 Bobby Noelte
#
# SPDX-License-Identifier: Apache-2.0
#

if BOARD_NUCLEO_F091RC

config BOARD
default nucleo_f091rc

endif # BOARD_NUCLEO_F091RC
8 changes: 8 additions & 0 deletions boards/arm/nucleo_f091rc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2017 Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0
#

ccflags-y +=-I$(srctree)/drivers

obj-y += pinmux.o
7 changes: 7 additions & 0 deletions boards/arm/nucleo_f091rc/Makefile.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FLASH_SCRIPT = openocd.sh
DEBUG_SCRIPT = openocd.sh

OPENOCD_LOAD_CMD = "flash write_image erase ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}"
OPENOCD_VERIFY_CMD = "verify_image ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}"

export FLASH_SCRIPT OPENOCD_LOAD_CMD OPENOCD_VERIFY_CMD
26 changes: 26 additions & 0 deletions boards/arm/nucleo_f091rc/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2017 RnDity Sp. z o.o.
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef __INC_BOARD_H
#define __INC_BOARD_H

#include <soc.h>

/* USER push button */
#define USER_PB_GPIO_PORT "GPIOC"
#define USER_PB_GPIO_PIN 13

/* LD2 green LED */
#define LD2_GPIO_PORT "GPIOA"
#define LD2_GPIO_PIN 5

/* Create aliases to make the basic samples work */
#define SW0_GPIO_NAME USER_PB_GPIO_PORT
#define SW0_GPIO_PIN USER_PB_GPIO_PIN
#define LED0_GPIO_PORT LD2_GPIO_PORT
#define LED0_GPIO_PIN LD2_GPIO_PIN

#endif /* __INC_BOARD_H */
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.
168 changes: 168 additions & 0 deletions boards/arm/nucleo_f091rc/doc/nucleof091rc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
.. _nucleo_f091rc_board:

ST Nucleo F091RC
################

Overview
********
The STM32 Nucleo-64 development board with STM32F091RC 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_f091rc_board.jpg
:width: 500px
:height: 367px
:align: center
:alt: Nucleo F091RC

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

Hardware
********
Nucleo F091RC 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
- ARM* mbed*
- 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: USER and RESET
- USB re-enumeration capability. Three different interfaces supported on USB:
- Virtual COM port
- Mass storage
- Debug port
- Support of wide choice of Integrated Development Environments (IDEs) including:
- IAR
- ARM Keil
- GCC-based IDEs

More information about STM32F091RC can be found here:
- `STM32F091 reference manual`_


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

The Zephyr nucleo_f091rc board configuration supports the following hardware features:

+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| CLOCK | on-chip | reset and clock control |
+-----------+------------+-------------------------------------+
| FLASH | on-chip | flash memory |
+-----------+------------+-------------------------------------+
| IWDG | on-chip | independent watchdog |
+-----------+------------+-------------------------------------+

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

The default configuration can be found in the defconfig file:
``boards/arm/nucleo_f091rc/nucleo_f091rc_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_f091rc_connectors.png
:width: 800px
:align: center
:height: 619px
:alt: Nucleo F091RC connectors

Default Zephyr Peripheral Mapping:
----------------------------------
- UART_1_TX : PB6
- UART_1_RX : PB7
- UART_2_TX : PA2
- UART_2_RX : PA3

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

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

Flashing
========

Nucleo F091RC 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 F091RC
----------------------------------------

The sample application :ref:`blinky-sample` is being used in this tutorial.

.. code-block:: console

$ cd <zephyr_root_path>
$ source zephyr-env.sh
$ cd $ZEPHYR_BASE/samples/basic/blinky
$ make BOARD=nucleo_f091rc

Connect the Nucleo F091RC to your host computer using the USB port.
Then, enter the following command:

.. code-block:: console

$ make BOARD=nucleo_f091rc flash

You will see the LED blinking every second.

Debugging
=========

Access gdb with the following make command:

.. code-block:: console

$ make BOARD=nucleo_f091rc debug


References
**********

.. target-notes::

.. _Nucleo F091RC website:
http://www.st.com/en/evaluation-tools/nucleo-f091rc.html

.. _STM32F091 reference manual:
www.st.com/resource/en/reference_manual/dm00031936.pdf

.. _STM32 Nucleo-64 board User Manual:
http://www.st.com/resource/en/user_manual/dm00105823.pdf

9 changes: 9 additions & 0 deletions boards/arm/nucleo_f091rc/nucleo_f091rc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
identifier: nucleo_f091rc
name: NUCLEO-F091RC
type: mcu
arch: arm
toolchain:
- zephyr
- gccarmemb
ram: 32
flash: 256
53 changes: 53 additions & 0 deletions boards/arm/nucleo_f091rc/nucleo_f091rc_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Zephyr Kernel Configuration
CONFIG_ARM=y
CONFIG_ARCH="arm"
CONFIG_SOC="stm32f091xc"
CONFIG_SOC_SERIES="stm32f0"
CONFIG_SOC_FAMILY="st_stm32"
CONFIG_BOARD="nucleo_f091rc"
CONFIG_SOC_SERIES_STM32F0X=y

# Platform Configuration
CONFIG_SOC_FAMILY_STM32=y
CONFIG_SOC_STM32F091XC=y
CONFIG_BOARD_NUCLEO_F091RC=y

# General Kernel Options
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000

# Serial Drivers
CONFIG_SERIAL=y
CONFIG_SERIAL_HAS_DRIVER=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_STM32=y
# enable USART2 - passthrough to STLINK v2 connector
CONFIG_UART_STM32_PORT_2=y
# enable console on this port by default
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Pinmux Driver
CONFIG_PINMUX=y
CONFIG_PINMUX_STM32=y

# GPIO Controller
CONFIG_GPIO=y
CONFIG_GPIO_STM32=y
CONFIG_GPIO_STM32_PORTA=y
CONFIG_GPIO_STM32_PORTB=y
CONFIG_GPIO_STM32_PORTC=y

# Clock configuration
CONFIG_CLOCK_CONTROL=y
# SYSCLK selection
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# HSE configuration
CONFIG_CLOCK_STM32_HSE_CLOCK=8000000
# PLL configuration
CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
# produce 48MHz clock at PLL output
CONFIG_CLOCK_STM32_PLL_PREDIV1=1
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=6
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=1
37 changes: 37 additions & 0 deletions boards/arm/nucleo_f091rc/pinmux.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2017 RnDity Sp. z o.o.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel.h>
#include <device.h>
#include <init.h>
#include <pinmux.h>
#include <sys_io.h>

#include <pinmux/stm32/pinmux_stm32.h>

/* pin assignments for NUCLEO-F091RC board */
static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_STM32_PORT_1
{STM32_PIN_PB6, STM32F0_PINMUX_FUNC_PB6_USART1_TX},
{STM32_PIN_PB7, STM32F0_PINMUX_FUNC_PB7_USART1_RX},
#endif /* CONFIG_UART_STM32_PORT_1 */
#ifdef CONFIG_UART_STM32_PORT_2
{STM32_PIN_PA2, STM32F0_PINMUX_FUNC_PA2_USART2_TX},
{STM32_PIN_PA3, STM32F0_PINMUX_FUNC_PA3_USART2_RX},
#endif /* CONFIG_UART_STM32_PORT_2 */
};

static int pinmux_stm32_init(struct device *port)
{
ARG_UNUSED(port);

stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));

return 0;
}

SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);
12 changes: 12 additions & 0 deletions boards/arm/nucleo_f091rc/support/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
source [find board/st_nucleo_f0.cfg]

$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}

$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}
Loading