1.. zephyr:board:: weact_stm32g431_core 2 3The WeAct STM32G431 Core Board is a low-cost bare-bones STM32G431-based development 4board. See the `STM32G431CB website`_ for more information about the MCU. More information 5about the board, including schematics, is available from the `WeAct GitHub`_. 6 7Modifications USB-C Power Delivery 8********************************** 9 10The board does not support USB-C PD in its standard configuration. To enable USB-C PD, CC1 11and CC2 need to be disconnected from their pull-down resistors and be connected to PB6 and 12PB4 respectively. Dead battery support requires PA9 and PA10 to be routed to CC1 and 13CC2. VBUS also needs to be connected to the MCU through a voltage divider. 14 15The pull-downs are disconnected by removing the zero-Ohm resistors on SB8 and SB9 next to 16the USB-C connector. SB3, SB5, SB6, and SB7 then need to be closed to connect the CCx 17lines to the MCU. The voltage divider is connected to PB2 by closing SB4. 18 19After these modifications have been made, PA9, PA10, PB2, PB4, and PB6 should be 20considered reserved for USB-C and not available for other applications. 21 22.. warning:: 23 The internal USB DFU boot loader may not work correctly with machines that respect USB 24 PD signaling unless dead battery support has been enabled. A USB-C to USB-A adapter or 25 programming using the SWD port can be used as a workaround. 26 27 28Supported Features 29================== 30 31The Zephyr weact_stm32g431_core board configuration supports the following hardware 32features: 33 34+------------+------------+-------------------------------------+ 35| Interface | Controller | Driver/Component | 36+============+============+=====================================+ 37| NVIC | on-chip | nested vector interrupt controller | 38+------------+------------+-------------------------------------+ 39| UART | on-chip | serial port | 40+------------+------------+-------------------------------------+ 41| GPIO | on-chip | gpio | 42+------------+------------+-------------------------------------+ 43| ADC | on-chip | ADC Controller | 44+------------+------------+-------------------------------------+ 45| USB | on-chip | USB device | 46+------------+------------+-------------------------------------+ 47| UCPD | on-chip | ucpd | 48+------------+------------+-------------------------------------+ 49 50The default configuration can be found in the defconfig file: 51 52:zephyr_file:`boards/weact/stm32g431_core/weact_stm32g431_core_defconfig` 53 54Pin Mapping 55=========== 56 57Default Zephyr Peripheral Mapping: 58---------------------------------- 59 60- UART_2 TX/RX : PA2/PA3 61- UCPD1 CCx : PB6/PB4 (not connected by default) 62- UCPD1 DBCCx : PA9/PA10 (not connected by default) 63- BUTTON (User) : PC13 64- BUTTON (BOOT0) : PB8 65- LED0 : PC6 66- ADC (VBUS) : PB2 67 68The ADC is disabled by default since the VBUS voltage divider is not connected in the 69board's standard configuration. 70 71 72Hardware Configuration 73---------------------- 74+---------------+---------+-----------------------------------------------+ 75| Solder bridge | Default | Description | 76+===============+=========+===============================================+ 77| SB1/SB2 | Open | Route PC14/PC15 (LSE) to header | 78+---------------+---------+-----------------------------------------------+ 79| SB6/SB7 | Open | Connect PB4/PB6 (UCPD1_CCx) to USB-C CCx pins | 80+---------------+---------+-----------------------------------------------+ 81| SB3/SB5 | Open | Connect PA9/PA10 (UCPD1_DBCCx) to PB6/PB4 | 82+---------------+---------+-----------------------------------------------+ 83| SB4 | Open | Connect PB2 to VBUS voltage divider | 84+---------------+---------+-----------------------------------------------+ 85| SB8/SB9 | Closed | Connect USB-CCx to pull-down resistors | 86+---------------+---------+-----------------------------------------------+ 87| SB10 | Open | VBUS protection diode bypass | 88+---------------+---------+-----------------------------------------------+ 89 90 91Clock Sources 92------------- 93 94The board has two external oscillators. The frequency of the slow clock (LSE) is 32.768 95kHz. The frequency of the main clock (HSE) is 8 MHz. 96 97The default configuration sources the system clock from the PLL, which is derived from 98HSE, and is set at 144 MHz. The 48 MHz clock used by the USB interface is derived from the 99PLL instead of the internal 48 MHz oscillator. 100 101Programming and Debugging 102************************* 103 104The MCU is normally programmed using the ROM bootloader or the exposed SWD port. 105 106Please note that some laptops may not detect the ROM bootloader correctly if the CCx 107pull-downs have been disconnected by opening SB8 and SB9 unless dead battery support has 108been enabled by closing SB3 and SB5. A USB-C to USB-A adapter can be used as a workaround 109if this is a problem. 110 111Flashing an Application 112======================= 113 114Connect a USB-C cable and the board should power ON. Force the board into DFU mode by 115keeping the BOOT0 switch pressed while pressing and releasing the NRST switch. 116 117The dfu-util runner is supported on this board and so a sample can be built and tested 118easily. 119 120.. zephyr-app-commands:: 121 :zephyr-app: samples/basic/blinky 122 :board: weact_stm32g431_core 123 :goals: build flash 124 125Debugging 126========= 127 128The board can be debugged by installing the included 100 mil (0.1 inch) header, and 129attaching an SWD debugger to the 3V3 (3.3V), GND, SCK, and DIO pins on that header. 130 131 132References 133********** 134 135.. target-notes:: 136 137.. _WeAct GitHub: 138 https://github.com/WeActStudio/WeActStudio.STM32G431CoreBoard 139 140.. _STM32G431CB website: 141 https://www.st.com/en/microcontrollers-microprocessors/stm32g431cb.html 142 143.. _STM32F401x reference manual: 144 https://www.st.com/resource/en/reference_manual/rm0440-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf 145