-
Notifications
You must be signed in to change notification settings - Fork 1.5k
boards/arm/ht32f491x3: Add support for the HT32F49163 Starter Kit board #18573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
xiaoxiang781216
merged 3 commits into
apache:master
from
FelipeMdeO:feature/ht32f49xx_port
Mar 30, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+206 KB
Documentation/platforms/arm/ht32f491x3/boards/esk32/ht32f491x3-starter-kit.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
177 changes: 177 additions & 0 deletions
177
Documentation/platforms/arm/ht32f491x3/boards/esk32/index.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| ================== | ||
| ESK32 (HT32F49163) | ||
| ================== | ||
|
|
||
| .. tags:: arch:arm, chip:ht32f491x3, chip:ht32f49163, vendor:holtek | ||
|
|
||
| The ESK32 is a development board based on the Holtek HT32F49163 MCU. | ||
| The current NuttX port targets the HT32F49163 device used on the | ||
| HT32F49163 development kit and focuses on a working serial-console NSH | ||
| configuration with basic board bring-up. | ||
|
|
||
| For additional hardware details, refer to Holtek's | ||
| `HT32F491x3 Starter Kit User Guide <https://www.holtek.com/webapi/106680/HT32F491x3_StarterKitUserManualv100.pdf>`_. | ||
|
|
||
| .. figure:: ht32f491x3-starter-kit.jpg | ||
| :align: center | ||
| :alt: HT32F491x3 Starter Kit | ||
|
|
||
| HT32F491x3 Starter Kit board photo | ||
|
|
||
| Features | ||
| ======== | ||
|
|
||
| The current port provides: | ||
|
|
||
| * Holtek HT32F49163 MCU from the HT32F491x3 family | ||
| * ARM Cortex-M4 core with FPU support | ||
| * Boot and clock initialization for the ESK32 8 MHz external crystal | ||
| * System clock configured to 150 MHz | ||
| * USART1 serial console at 115200 8N1 | ||
| * ``/bin`` mounted through ``binfs`` | ||
| * ``/proc`` mounted through ``procfs`` | ||
| * User LED registration through ``/dev/userleds`` | ||
| * Basic internal GPIO helpers used by the console and LED support | ||
|
|
||
| The default ``esk32:nsh`` configuration also enables these built-in | ||
| applications: | ||
|
|
||
| * ``hello`` | ||
| * ``ostest`` | ||
| * ``dumpstack`` | ||
| * ``leds`` | ||
|
|
||
| Buttons and LEDs | ||
| ================ | ||
|
|
||
| Board LEDs | ||
| ---------- | ||
|
|
||
| Three user LEDs from the development kit are currently mapped by the board | ||
| port. They are active-low and are exposed through the standard NuttX | ||
| ``USERLED`` interface and the ``/dev/userleds`` device. | ||
|
|
||
| ===== =========== ========== | ||
| LED Port/Pin Notes | ||
| ===== =========== ========== | ||
| LED2 PD13 Active-low | ||
| LED3 PD14 Active-low | ||
| LED4 PD15 Active-low | ||
| ===== =========== ========== | ||
|
|
||
| The generic ``leds`` example from ``nuttx-apps`` can be used to validate the | ||
| LED interface. | ||
|
|
||
| Board Buttons | ||
| ------------- | ||
|
|
||
| No button is currently exposed by the board port. | ||
|
|
||
| Pin Mapping | ||
| =========== | ||
|
|
||
| The current port uses the following MCU pins: | ||
|
|
||
| ===== ========== ========== | ||
| Pin Signal Notes | ||
| ===== ========== ========== | ||
| PA9 USART1_TX Default serial console TX | ||
| PA10 USART1_RX Default serial console RX | ||
| PD13 LED2 User LED, active-low | ||
| PD14 LED3 User LED, active-low | ||
| PD15 LED4 User LED, active-low | ||
| ===== ========== ========== | ||
|
|
||
| Flashing | ||
| ======== | ||
|
|
||
| The board directory includes a helper script for flashing through Holtek's | ||
| Windows OpenOCD package from a WSL-based development environment: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| $ ./boards/arm/ht32f491x3/esk32/tools/flash.sh | ||
|
|
||
| The script expects: | ||
|
|
||
| * ``nuttx.bin`` already generated in the ``nuttx`` directory | ||
| * Holtek xPack OpenOCD installed under | ||
| ``C:\Program Files (x86)\Holtek HT32 Series\HT32-IDE\xPack\xpack-openocd-0.11.0-4`` | ||
| * an HT32-Link compatible debug connection | ||
| * Holtek xPack OpenOCD can be installed together with the HT32 IDE, available | ||
| from Holtek's website: `Holtek Downloads <https://www.holtek.com/page/index>`_ | ||
|
|
||
| Useful options: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| $ ./boards/arm/ht32f491x3/esk32/tools/flash.sh --dry-run | ||
| $ ./boards/arm/ht32f491x3/esk32/tools/flash.sh --device HT32F49163_100LQFP | ||
| $ ./boards/arm/ht32f491x3/esk32/tools/flash.sh --openocd-root /mnt/c/path/to/openocd | ||
|
|
||
| Testing Notes | ||
| ============= | ||
|
|
||
| The following commands are useful for validating the current port: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| nsh> hello | ||
| nsh> ostest | ||
| nsh> dumpstack | ||
| nsh> leds | ||
|
|
||
| When ``leds`` is executed, the example opens ``/dev/userleds`` and cycles | ||
| through the LED bitmasks supported by the board. | ||
|
|
||
| Current Limitations | ||
| =================== | ||
|
|
||
| The current port is still intentionally small. In particular: | ||
|
|
||
| * only the ``nsh`` board configuration is maintained | ||
| * only USART1 routing is described by the board port | ||
| * LEDs are supported, but board buttons are not yet implemented | ||
| * internal GPIO helpers exist, but there is not yet a board-level ``/dev/gpio`` | ||
| test interface in this port | ||
|
|
||
| Configurations | ||
| ============== | ||
|
|
||
| nsh | ||
| --- | ||
|
|
||
| This is the currently maintained configuration for the board. It provides a | ||
| serial console with the NuttShell and mounts ``/bin`` and ``/proc`` during | ||
| board bring-up. | ||
|
|
||
| Configure and build it from the ``nuttx`` directory: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| $ ./tools/configure.sh -l esk32:nsh | ||
| $ make -j | ||
|
|
||
| After boot, a typical prompt looks like: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| NuttShell (NSH) NuttX-12.x.x | ||
| nsh> ls / | ||
| /: | ||
| bin/ | ||
| dev/ | ||
| proc/ | ||
|
|
||
| And the built-in applications can be listed with: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| nsh> ls /bin | ||
| dd | ||
| dumpstack | ||
| hello | ||
| leds | ||
| nsh | ||
| ostest | ||
| sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| =============== | ||
| Holtek HT32F491 | ||
| =============== | ||
|
|
||
| The HT32F491x3 family is based on the ARM Cortex-M4 core. | ||
|
|
||
| Supported Boards | ||
| ================ | ||
|
|
||
| .. toctree:: | ||
| :glob: | ||
| :maxdepth: 1 | ||
|
|
||
| boards/*/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /**************************************************************************** | ||
| * arch/arm/include/ht32f491x3/chip.h | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. The | ||
| * ASF licenses this file to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance with the | ||
| * License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations | ||
| * under the License. | ||
| * | ||
| ****************************************************************************/ | ||
|
|
||
| #ifndef __ARCH_ARM_INCLUDE_HT32F491X3_CHIP_H | ||
| #define __ARCH_ARM_INCLUDE_HT32F491X3_CHIP_H | ||
|
|
||
| /**************************************************************************** | ||
| * Included Files | ||
| ****************************************************************************/ | ||
|
|
||
| #include <nuttx/config.h> | ||
|
|
||
| /**************************************************************************** | ||
| * Pre-processor Definitions | ||
| ****************************************************************************/ | ||
|
|
||
| #define HT32M4_SYSH_PRIORITY_MIN 0xe0 | ||
| #define HT32M4_SYSH_PRIORITY_DEFAULT 0x80 | ||
| #define HT32M4_SYSH_PRIORITY_MAX 0x00 | ||
| #define HT32M4_SYSH_PRIORITY_STEP 0x20 | ||
|
|
||
| #define NVIC_SYSH_PRIORITY_MIN HT32M4_SYSH_PRIORITY_MIN | ||
| #define NVIC_SYSH_PRIORITY_DEFAULT HT32M4_SYSH_PRIORITY_DEFAULT | ||
| #define NVIC_SYSH_PRIORITY_MAX HT32M4_SYSH_PRIORITY_MAX | ||
| #define NVIC_SYSH_PRIORITY_STEP HT32M4_SYSH_PRIORITY_STEP | ||
|
|
||
| #if defined(CONFIG_ARCH_CHIP_HT32F49153) | ||
| # define HT32_FLASH_KB 128 | ||
| #elif defined(CONFIG_ARCH_CHIP_HT32F49163) | ||
| # define HT32_FLASH_KB 256 | ||
| #else | ||
| # error "Unsupported HT32F491x3 device" | ||
| #endif | ||
|
|
||
| #define HT32_SRAM_KB 48 | ||
| #define HT32_NUSART 8 | ||
| #define HT32_NGPIO 6 | ||
|
|
||
| #define HT32_HICK_FREQUENCY 8000000 | ||
| #define HT32_HICK48_FREQUENCY 48000000 | ||
| #define HT32_HEXT_MIN_FREQUENCY 4000000 | ||
| #define HT32_HEXT_MAX_FREQUENCY 25000000 | ||
| #define HT32_PLL_MAX_FREQUENCY 150000000 | ||
|
|
||
| #define HT32_SYSCLK_FREQUENCY CONFIG_HT32F491X3_SYSCLK_FREQUENCY | ||
| #define HT32_HCLK_FREQUENCY HT32_SYSCLK_FREQUENCY | ||
| #define HT32_PCLK1_FREQUENCY CONFIG_HT32F491X3_PCLK1_FREQUENCY | ||
| #define HT32_PCLK2_FREQUENCY CONFIG_HT32F491X3_PCLK2_FREQUENCY | ||
|
|
||
| #endif /* __ARCH_ARM_INCLUDE_HT32F491X3_CHIP_H */ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.