1.. zephyr:board:: nucleo_f042k6 2 3Overview 4******** 5The STM32 Nucleo-32 development board with STM32F042K6 MCU, supports Arduino nano connectivity. 6 7The STM32 Nucleo board provides an affordable, and flexible way for users to try out new concepts, 8and build prototypes with the STM32 microcontroller, choosing from the various 9combinations of performance, power consumption and features. 10 11The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. 12 13The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together 14with various packaged software examples. 15 16More information about the board can be found at the `Nucleo F042K6 website`_. 17 18Hardware 19******** 20Nucleo F042K6 provides the following hardware components: 21 22- STM32 microcontroller in LQFP32 package 23 24- On-board ST-LINK/V2-1 debugger/programmer with SWD connector: 25 26- Flexible board power supply: 27 28 - USB VBUS or external source (3.3V, 5V, 7 - 12V) 29 30- Three LEDs: 31 32 - USB communication (LD1), user LED (LD2), power LED (LD3) 33 34- reset push button 35 36More information about STM32F042K6 can be found here: 37 38- `STM32F042 reference manual`_ 39- `STM32F042 data sheet`_ 40 41Supported Features 42================== 43 44The Zephyr nucleo_f042k6 board configuration supports the following hardware features: 45 46+-----------+------------+-------------------------------------+ 47| Interface | Controller | Driver/Component | 48+===========+============+=====================================+ 49| NVIC | on-chip | nested vector interrupt controller | 50+-----------+------------+-------------------------------------+ 51| UART | on-chip | serial port-polling; | 52| | | serial port-interrupt | 53+-----------+------------+-------------------------------------+ 54| PINMUX | on-chip | pinmux | 55+-----------+------------+-------------------------------------+ 56| GPIO | on-chip | gpio | 57+-----------+------------+-------------------------------------+ 58| CLOCK | on-chip | reset and clock control | 59+-----------+------------+-------------------------------------+ 60| FLASH | on-chip | flash memory | 61+-----------+------------+-------------------------------------+ 62| I2C | on-chip | i2c controller | 63+-----------+------------+-------------------------------------+ 64| SPI | on-chip | spi controller | 65+-----------+------------+-------------------------------------+ 66 67Other hardware features are not yet supported in this Zephyr port. 68 69The default configuration can be found in 70:zephyr_file:`boards/st/nucleo_f042k6/nucleo_f042k6_defconfig` 71 72Connections and IOs 73=================== 74 75Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as 76input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the 77GPIO pins are shared with digital or analog alternate functions. 78 79Board connectors: 80----------------- 81.. image:: img/nucleo_f042k6_connectors.jpg 82 :align: center 83 :alt: Nucleo F042K6 connectors 84 85Default Zephyr Peripheral Mapping: 86---------------------------------- 87 88- UART_1 TX/RX : PA2/PA15 (ST-Link Virtual COM Port) 89- I2C1 SCL/SDA : PB6/PB7 (Arduino I2C) 90- SPI1 NSS/SCK/MISO/MOSI : PA4/PA5/PA6/PA7 (Arduino SPI) 91- LD2 : PB3 92 93 94For more details please refer to `STM32 Nucleo-32 board User Manual`_. 95 96Programming and Debugging 97************************* 98 99Nucleo F042K6 board includes an ST-LINK/V2-1 embedded debug tool interface. 100 101Applications for the ``nucleo_f042k6`` board configuration can be built and 102flashed in the usual way (see :ref:`build_an_application` and 103:ref:`application_run` for more details). 104 105Flashing 106======== 107 108The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, 109so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required. 110 111Alternatively, OpenOCD or JLink can also be used to flash the board using 112the ``--runner`` (or ``-r``) option: 113 114.. code-block:: console 115 116 $ west flash --runner openocd 117 $ west flash --runner jlink 118 119Flashing an application to Nucleo F042K6 120---------------------------------------- 121 122Here is an example for the :zephyr:code-sample:`blinky` application. 123 124.. zephyr-app-commands:: 125 :zephyr-app: samples/basic/blinky 126 :board: nucleo_f042k6 127 :goals: build flash 128 129You will see the LED blinking every second. 130 131Debugging 132========= 133 134You can debug an application in the usual way. Here is an example for the 135:zephyr:code-sample:`blinky` application. 136 137.. zephyr-app-commands:: 138 :zephyr-app: samples/basic/blinky 139 :board: nucleo_f042k6 140 :maybe-skip-config: 141 :goals: debug 142 143References 144********** 145 146.. target-notes:: 147 148.. _Nucleo F042K6 website: 149 https://www.st.com/en/evaluation-tools/nucleo-f042k6.html 150 151.. _STM32F042 reference manual: 152 https://www.st.com/resource/en/reference_manual/dm00031936-stm32f0x1stm32f0x2stm32f0x8-advanced-armbased-32bit-mcus-stmicroelectronics.pdf 153 154.. _STM32F042 data sheet: 155 https://www.st.com/resource/en/datasheet/stm32f042k6.pdf 156 157.. _STM32 Nucleo-32 board User Manual: 158 https://www.st.com/resource/en/user_manual/dm00231744-stm32-nucleo32-boards-mb1180-stmicroelectronics.pdf 159 160.. _STM32CubeProgrammer: 161 https://www.st.com/en/development-tools/stm32cubeprog.html 162