boards: st: add stm32c0116_dk board support

Add board support for stm32c0116_dk

Signed-off-by: Romain Pelletant <romainp@kickmaker.net>
This commit is contained in:
Romain Pelletant 2024-04-20 19:49:18 +02:00 committed by Fabio Baltieri
commit a58a7d0aa1
8 changed files with 335 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# Copyright (c) 2024 Kickmaker
# SPDX-License-Identifier: Apache-2.0
config BOARD_STM32C0116_DK
select SOC_STM32C011XX

View file

@ -0,0 +1,8 @@
# Copyright (c) 2024 Kickmaker
# SPDX-License-Identifier: Apache-2.0
board_runner_args(jlink "--device=STM32C011F6" "--speed=4000")
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)

View file

@ -0,0 +1,5 @@
board:
name: stm32c0116_dk
vendor: st
socs:
- name: stm32c011xx

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -0,0 +1,154 @@
.. _stm32c0116_dk_board:
ST STM32C0116-DK Discovery Kit
##############################
Overview
********
The STM32C0116-DK Discovery kit helps to discover features of the STM32C0 Series
microcontroller in a UFQFPN20 package. This Discovery kit features one UFQFPN20
to DIL20 module designed with the STM32C011F6 microcontroller and allows the user to develop
and share applications. It includes an on-board ST-LINK/V2-1 to debug and program the embedded
STM32 microcontroller. Important board features include:
.. image:: img/stm32c0116_dk.jpg
:align: center
:alt: STM32C0116-DK
More information about the board can be found at the `STM32C0116-DK website`_.
Hardware
********
The STM32C0116-DK Discovery kit provides the following hardware components:
- STM32C011F6 microcontroller with 32 Kbytes of Flash memory and 6 Kbytes of RAM, in a UFQFPN20 package
- On-board ST-LINK/V2-1 debugger/programmer with USB re-enumeration capability: mass storage and debug port
- User LED
- Reset push-button
- 5 way joystick using a single ADC input pin
- Individual STM32 UFQFPN20 to DIL20 module
- Board connectors:
- USB Micro-B
- DIL20 socket
- Dedicated LCD footprint
- Grove (UART)
- 2 x 10 pin headers for MCU daughterboard
- Extension connectors
More information about STM32C011F6 can be found here:
- `STM32C011F6 on www.st.com`_
- `STM32C0x1 reference manual`_
Supported Features
==================
The Zephyr stm32c0116_dk 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 |
+-----------+------------+-------------------------------------+
| RTC | on-chip | counter |
+-----------+------------+-------------------------------------+
| IWDG | on-chip | independent watchdog |
+-----------+------------+-------------------------------------+
| WWDG | on-chip | window watchdog |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+
| ADC | on-chip | ADC Controller |
+-----------+------------+-------------------------------------+
| die-temp | on-chip | die temperature sensor |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| DMA | on-chip | Direct Memory Access |
+-----------+------------+-------------------------------------+
Other hardware features are not yet supported on Zephyr porting.
The default configuration can be found in
:zephyr_file:`boards/st/stm32c0116_dk/stm32c0116_dk_defconfig`
Pin Mapping
===========
STM32C0116-DK Discovery kit has 4 GPIO controllers. These controllers are responsible for pin muxing,
input/output, pull-up, etc.
For more details please refer to `STM32C0116-DK board User Manual`_.
Default Zephyr Peripheral Mapping:
----------------------------------
The STM32C0116 Discovery board is configured as follows:
- UART_2 TX/RX : PA2/PA3 (ST-Link Virtual Port Com)
- UART_1 TX/RX : PA9/PA10
- PWM_1_CH3 : PB6
- ADC1_CH8 : PA8
- LD3 : PB6
Programming and Debugging
*************************
Applications for the ``stm32c0116_dk`` board configuration can be built and
flashed in the usual way (see :ref:`build_an_application` and
:ref:`application_run` for more details).
Flashing
========
STM32C0116-DK Discovery kit includes an ST-LINK/V2 embedded debug tool interface.
Flashing an application to STM32C0116-DK
-------------------------------------------
First, connect the STM32C0116 Discovery kit to your host computer using
the USB port to prepare it for flashing. Then build and flash your application.
Here is an example for the :ref:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: stm32c0116_dk
:goals: build flash
Run a serial host program to connect with your board:
.. code-block:: console
$ minicom -D /dev/ttyACM0
You should see the following message on the console:
.. code-block:: console
Hello World! arm
.. _STM32C0116-DK website:
https://www.st.com/en/evaluation-tools/stm32c0116-dk.html
.. _STM32C0116-DK board User Manual:
https://www.st.com/resource/en/user_manual/um2970-discovery-kit-with-stm32c011f6-mcu-stmicroelectronics.pdf
.. _STM32C011F6 on www.st.com:
https://www.st.com/resource/en/datasheet/stm32c011f6.pdf
.. _STM32C0x1 reference manual:
https://www.st.com/resource/en/reference_manual/rm0490-stm32c0x1-advanced-armbased-64bit-mcus-stmicroelectronics.pdf

View file

@ -0,0 +1,125 @@
/*
* Copyright (c) 2024 Kickmaker
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/c0/stm32c011X6.dtsi>
#include <st/c0/stm32c011f(4-6)ux-pinctrl.dtsi>
/ {
model = "STMicroelectronics STM32C0116-DK Discovery board";
compatible = "st,stm32c011f6-dk";
chosen {
zephyr,console = &usart2;
zephyr,shell-uart = &usart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
leds: leds {
compatible = "gpio-leds";
green_led_3: led_3 {
gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
label = "User LD3";
};
};
pwmleds {
compatible = "pwm-leds";
green_pwm_led: green_pwm_led {
pwms = <&pwm1 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
};
gpio_keys {
compatible = "gpio-keys";
reset_button: button {
label = "reset button";
gpios = <&gpiof 2 GPIO_ACTIVE_LOW>;
status = "okay";
};
};
aliases {
led0 = &green_led_3;
pwm-led0 = &green_pwm_led;
sw0 = &reset_button;
watchdog0 = &iwdg;
die-temp0 = &die_temp;
volt-sensor0 = &vref;
};
};
&clk_hsi {
status = "okay";
};
&rcc {
clocks = <&clk_hsi>;
clock-frequency = <DT_FREQ_M(48)>;
ahb-prescaler = <1>;
apb1-prescaler = <1>;
};
&usart1 {
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
};
&usart2 {
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
};
&rtc {
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>,
<&rcc STM32_SRC_LSE RTC_SEL(1)>;
status = "okay";
};
&iwdg {
status = "okay";
};
&timers1 {
st,prescaler = <10000>;
status = "okay";
pwm1: pwm {
pinctrl-0 = <&tim1_ch3_pb6>;
pinctrl-names = "default";
status = "okay";
};
};
&adc1 {
pinctrl-0 = <&adc1_in8_pa8>;
pinctrl-names = "default";
st,adc-clock-source = <SYNC>;
st,adc-prescaler = <4>;
status = "okay";
};
&die_temp {
status = "okay";
};
&vref {
status = "okay";
};
&dma1 {
status = "okay";
};
&dmamux1 {
status = "okay";
};

View file

@ -0,0 +1,19 @@
# Copyright (c) 2024 Kickmaker
# SPDX-License-Identifier: Apache-2.0
identifier: stm32c0116_dk
name: STM32C0116 DK
type: mcu
arch: arm
toolchain:
- zephyr
supported:
- gpio
- counter
- watchdog
- pwm
- adc
- dma
ram: 6
flash: 32
vendor: st

View file

@ -0,0 +1,19 @@
# Copyright (c) 2024 Kickmaker
# SPDX-License-Identifier: Apache-2.0
# Serial Drivers
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# GPIO Controller
CONFIG_GPIO=y
# Enable Clocks
CONFIG_CLOCK_CONTROL=y
# enable pin controller
CONFIG_PINCTRL=y