diff --git a/boards/st/nucleo_c092rc/Kconfig.nucleo_c092rc b/boards/st/nucleo_c092rc/Kconfig.nucleo_c092rc new file mode 100644 index 00000000000..08155f315a4 --- /dev/null +++ b/boards/st/nucleo_c092rc/Kconfig.nucleo_c092rc @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Thomas Stranger +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NUCLEO_C092RC + select SOC_STM32C092XX diff --git a/boards/st/nucleo_c092rc/arduino_r3_connector.dtsi b/boards/st/nucleo_c092rc/arduino_r3_connector.dtsi new file mode 100644 index 00000000000..434823b1fe2 --- /dev/null +++ b/boards/st/nucleo_c092rc/arduino_r3_connector.dtsi @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 STMicroelectronics + * Copyright (c) 2025 Thomas Stranger + * + * 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 4 0>, /* A4 */ + <5 0 &gpioc 5 0>, /* A5 */ + <6 0 &gpiob 7 0>, /* D0 */ + <7 0 &gpiob 6 0>, /* D1 */ + <8 0 &gpioa 10 0>, /* D2 */ + <9 0 &gpioc 7 0>, /* D3 */ + <10 0 &gpiob 5 0>, /* D4 */ + <11 0 &gpiob 4 0>, /* D5 */ + <12 0 &gpioc 8 0>, /* D6 */ + <13 0 &gpioa 8 0>, /* D7 */ + <14 0 &gpioa 9 0>, /* D8 */ + <15 0 &gpiob 3 0>, /* D9 */ + <16 0 &gpioa 15 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_spi: &spi1 {}; +arduino_serial: &usart1 {}; diff --git a/boards/st/nucleo_c092rc/board.cmake b/boards/st/nucleo_c092rc/board.cmake new file mode 100644 index 00000000000..6c121eff82f --- /dev/null +++ b/boards/st/nucleo_c092rc/board.cmake @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +# keep first +board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw") + +board_runner_args(jlink "--device=STM32C092RC" "--speed=4000") + +# keep first +include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/st/nucleo_c092rc/board.yml b/boards/st/nucleo_c092rc/board.yml new file mode 100644 index 00000000000..4667317a041 --- /dev/null +++ b/boards/st/nucleo_c092rc/board.yml @@ -0,0 +1,6 @@ +board: + name: nucleo_c092rc + full_name: Nucleo C092RC + vendor: st + socs: + - name: stm32c092xx diff --git a/boards/st/nucleo_c092rc/doc/img/st_nucleo_c092rc.webp b/boards/st/nucleo_c092rc/doc/img/st_nucleo_c092rc.webp new file mode 100644 index 00000000000..3addcf00ee2 Binary files /dev/null and b/boards/st/nucleo_c092rc/doc/img/st_nucleo_c092rc.webp differ diff --git a/boards/st/nucleo_c092rc/doc/index.rst b/boards/st/nucleo_c092rc/doc/index.rst new file mode 100644 index 00000000000..3547334d43f --- /dev/null +++ b/boards/st/nucleo_c092rc/doc/index.rst @@ -0,0 +1,125 @@ +.. zephyr:board:: nucleo_c092rc + +Overview +******** +The STM32 Nucleo-64 development board, featuring the STM32C092RC MCU, +supports both Arduino and ST morpho connectivity, +and includes a CAN FD interface with an onboard transceiver. + +.. image:: img/st_nucleo_c092rc.webp + :align: center + :alt: Nucleo C092RC development board + +More information about the board can be found at the `Nucleo C092RC website`_. + +Hardware +******** +Nucleo C092RC provides the following hardware components: + +- STM32 microcontroller in 64-pin package featuring 256 Kbytes of Flash memory + and 30 Kbytes of SRAM. + +- Flexible board power supply: + + - USB VBUS or external source (3.3V, 5V, 7 - 12V) + - Current consumption measurement (IDD) + +- Five LEDs: + + - Two user LEDs (LD1, LD2), one power LED (LD3), + one STLINK LED (LD4), and one USB power fault LED (LD5) + +- Three push-buttons: USER, RESET, BOOT + +- On-board ST-LINK/V2-1 debugger/programmer with SWD connector + +- Board connectors: + + - Arduino* Uno V3 expansion connector + - ST morpho extension pin header + - CAN FD interface with on-board transceiver + +More information about STM32C092RC can be found here: +`STM32C0x1 reference manual`_ + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +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. + +Default Zephyr Peripheral Mapping: +---------------------------------- + +- CAN RX/TX/STBY: PD0/PD1/PD2 +- I2C1 SCL/SDA : PB8/PB9 (Arduino I2C) +- LD1 : PA5 +- LD2 : PC9 +- SPI1 NSS/SCK/MISO/MOSI : PA15/PA5/PA6/PA7 (Arduino SPI) +- UART_1 TX/RX : PB6/PB7 (Arduino Serial) +- UART_2 TX/RX : PA2/PA3 (ST-Link Virtual COM Port) +- USER_PB : PC13 + + +For more details please refer to `STM32 Nucleo-64 board User Manual`_. + +Programming and Debugging +************************* + +.. zephyr:board-supported-runners:: + +Nucleo C092RC board includes an ST-LINK/V2-1 embedded debug tool interface. + +Applications for the ``nucleo_c092rc`` board can be built and +flashed in the usual way (see :ref:`build_an_application` and +:ref:`application_run` for more details). + +Flashing +======== + +The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, +so its :ref:`installation ` is required. + +Alternatively, an external JLink (Software and Documentation Package Version >= v8.12e) +can also be used to flash the board using the ``--runner`` option: + +.. code-block:: console + + $ west flash --runner jlink + + +Flashing an application to Nucleo C092RC +---------------------------------------- + +Here is an example for the :zephyr:code-sample:`blinky` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: nucleo_c092rc + :goals: build flash + +You will see the LED blinking every second. + +References +********** + +.. target-notes:: + +.. _Nucleo C092RC website: + https://www.st.com/en/evaluation-tools/nucleo-c092rc.html + +.. _STM32C0x1 reference manual: + https://www.st.com/resource/en/reference_manual/rm0490-stm32c0-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf + +.. _STM32 Nucleo-64 board User Manual: + https://www.st.com/resource/en/user_manual/um3353-stm32-nucleo64-board-mb2046-stmicroelectronics.pdf + +.. _STM32CubeProgrammer: + https://www.st.com/en/development-tools/stm32cubeprog.html diff --git a/boards/st/nucleo_c092rc/nucleo_c092rc.dts b/boards/st/nucleo_c092rc/nucleo_c092rc.dts new file mode 100644 index 00000000000..35e73a04151 --- /dev/null +++ b/boards/st/nucleo_c092rc/nucleo_c092rc.dts @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2024 STMicroelectronics + * Copyright (c) 2025 Thomas Stranger + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include "arduino_r3_connector.dtsi" +#include + +/ { + model = "STMicroelectronics STM32C092RC-NUCLEO board"; + compatible = "st,stm32c092rc-nucleo"; + + chosen { + zephyr,console = &usart2; + zephyr,shell-uart = &usart2; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,canbus = &fdcan1; + }; + + leds: leds { + compatible = "gpio-leds"; + + green_led_1: led_1 { + gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>; + label = "User LD1"; + }; + + blue_led: led_2 { + gpios = <&gpioc 9 GPIO_ACTIVE_LOW>; + label = "User LD2"; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + + green_pwm_led: green_pwm_led { + pwms = <&pwm1 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + + user_button: button { + label = "user button"; + gpios = <&gpioc 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + status = "okay"; + zephyr,code = ; + }; + }; + + transceiver0: can-phy0 { + compatible = "microchip,mcp2562fd", "can-transceiver-gpio"; + standby-gpios = <&gpiod 2 GPIO_ACTIVE_HIGH>; + max-bitrate = <5000000>; + #phy-cells = <0>; + }; + + aliases { + led0 = &green_led_1; + led1 = &blue_led; + pwm-led0 = &green_pwm_led; + sw0 = &user_button; + watchdog0 = &iwdg; + die-temp0 = &die_temp; + volt-sensor0 = &vref; + }; +}; + +&pwr { + wkup-pin@2 { + reg = <0x2>; + wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_PIN_NOT_MUXED>; + }; + wkup-pin@5 { + reg = <0x5>; + wkup-gpios = <&gpioc 5 STM32_PWR_WKUP_PIN_NOT_MUXED>; + }; + wkup-pin@6 { + reg = <0x6>; + wkup-gpios = <&gpiob 5 STM32_PWR_WKUP_PIN_NOT_MUXED>; + }; +}; + +&clk_lse { + status = "okay"; +}; + +&clk_hse { + clock-frequency = ; + status = "okay"; +}; + +&clk_hsi { + status = "okay"; +}; + +&rcc { + clocks = <&clk_hse>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <1>; +}; + +&usart1 { + pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>; + 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(APB1, 10)>, + <&rcc STM32_SRC_LSE RTC_SEL(1)>; + status = "okay"; +}; + +&iwdg { + status = "okay"; +}; + +&timers1 { + st,prescaler = <10000>; + status = "okay"; + + pwm1: pwm { + pinctrl-0 = <&tim1_ch1_pa5>; + pinctrl-names = "default"; + status = "okay"; + }; +}; + +&i2c1 { + pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>; + pinctrl-names = "default"; + status = "okay"; + clock-frequency = ; +}; + +&spi1 { + /* Note: PA5 is shared with green led0 */ + pinctrl-0 = <&spi1_nss_pa15 &spi1_sck_pa5 + &spi1_miso_pa6 &spi1_mosi_pa7>; + pinctrl-names = "default"; + status = "okay"; +}; + +&adc1 { + pinctrl-0 = <&adc1_in0_pa0 &adc1_in1_pa1 &adc1_in4_pa4>; + pinctrl-names = "default"; + st,adc-clock-source = "ASYNC"; + clocks = <&rcc STM32_CLOCK(APB1_2, 20)>, + <&rcc STM32_SRC_HSI ADC_SEL(2)>; + st,adc-prescaler = <4>; + status = "okay"; + vref-mv = <3300>; +}; + +&die_temp { + status = "okay"; +}; + +&vref { + status = "okay"; +}; + +&dma1 { + status = "okay"; +}; + +&dmamux1 { + status = "okay"; +}; + +/* Make sure SB11, SB12, and SB13 are closed (default configuration). + * Close JP9 to enable 120 Ohm termination on the board. + */ +&fdcan1 { + clocks = <&rcc STM32_CLOCK(APB1, 12)>, + <&rcc STM32_SRC_HSE FDCAN_SEL(2)>; + pinctrl-0 = <&fdcan1_rx_pd0 &fdcan1_tx_pd1>; + pinctrl-names = "default"; + phys = <&transceiver0>; + status = "okay"; +}; diff --git a/boards/st/nucleo_c092rc/nucleo_c092rc.yaml b/boards/st/nucleo_c092rc/nucleo_c092rc.yaml new file mode 100644 index 00000000000..2c85dda6f59 --- /dev/null +++ b/boards/st/nucleo_c092rc/nucleo_c092rc.yaml @@ -0,0 +1,24 @@ +identifier: nucleo_c092rc +name: ST Nucleo C092RC +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb +supported: + - adc + - arduino_gpio + - arduino_i2c + - arduino_spi + - can + - counter + - dma + - gpio + - i2c + - pwm + - rtc + - spi + - watchdog +ram: 30 +flash: 256 +vendor: st diff --git a/boards/st/nucleo_c092rc/nucleo_c092rc_defconfig b/boards/st/nucleo_c092rc/nucleo_c092rc_defconfig new file mode 100644 index 00000000000..54e1485b78d --- /dev/null +++ b/boards/st/nucleo_c092rc/nucleo_c092rc_defconfig @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Enable serial +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y