Stm32f411 Blackpill 标志

Stm32f411 Blackpill

社区
alexex1993
stm32f411-blackpill

Firmware development for the WeAct Studio "Black Pill" (STM32F411CEU6) and its clones such as the DFRobot DFR0864 — the 25 MHz HSE and 32.768 kHz LSE crystals, PC13 LED, K1 button, USB-C wired straight to USB_OTG_FS, ROM DFU flashing, the SPI-flash footprint, and the STM32Cube HAL + PlatformIO setup around them. Use when working on this board or any STM32F411CE/F401CC Black Pill: project setup, platformio.ini, clock and PLL configuration for 96 MHz plus 48 MHz USB, pin mapping on the 48-pin package, USB CDC console, RTC on the LSE crystal, the internal temperature sensor, ADC accuracy, DFU flashing and recovery, or debugging why something on the board does not work.

Add to TypingMind

概览

发布者alexex1993
代码仓库mcu-skills
技能名称stm32f411-blackpill
星标数
27
复刻数
3
附带文件
27
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 27 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 alexex1993 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Stm32f411 Blackpill AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/alexex1993/mcu-skills/tree/main/skills/stm32/stm32f411-blackpill
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/alexex1993/mcu-skills.git /tmp/mcu-skills
mkdir -p .claude/skills
cp -r /tmp/mcu-skills/skills/stm32/stm32f411-blackpill .claude/skills/stm32f411-blackpill
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Stm32f411 Blackpill,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Stm32f411 Blackpill。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Stm32f411 Blackpill 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

WeAct "Black Pill" — STM32F411CEU6

Board-specific firmware knowledge. The two reference files hold the detail — read the one you need rather than guessing, because most of the failure modes below are silent (the board runs, just wrongly).

  • reference/board-hardware.md — complete hardware reference: pin map for the 48-pin package with every alternate function, power tree, memory map, boot modes, plus a full development guide (Part II: §12 PlatformIO, §13 bring-up order, §14 peripheral cookbook, §15 F4/M4 gotchas, §16 flashing and recovery, §17 pitfall table).
  • reference/recipes.md — copy-paste-ready code: platformio.ini, board.h, the clock tree, RTC on the LSE crystal, the calibrated temperature sensor, the complete USB CDC stack.
  • template/ — a complete working project that builds and flashes, plus a scaffolding script. It is where every recipe was extracted from; see template/README.md.

Orientation

MCUSTM32F411CEU6, Cortex-M4F, 512 KB flash, 128 KB SRAM, UFQFPN48, 100 MHz max
CrystalsHSE 25 MHz on PH0/PH1, LSE 32.768 kHz on PC14/PC15 — both fitted from the factory
Working clock treePLL M25/N192/P2/Q4 → SYSCLK 96 MHz, HCLK 96, PCLK1 48, PCLK2 96, USB 48
LED / buttonPC13 lit = LOW (anode on 3V3) / K1 on PA0 pressed = LOW, needs a pull-up
USBUSB-C straight to USB_OTG_FS on PA11/PA12. No USB-serial chip on the board
FlashingROM DFU over that same USB-C (0483:DF11), entered by hand with BOOT0 + NRST
DebugSWD on the 4-pin header: 3V3, PA13 (SWDIO), PA14 (SWCLK), GND
ADCADC1 only, 10 external channels (PA0–PA7, PB0, PB1). No DAC. VDDA = VREF+ = the 3V3 LDO
Storageunpopulated SOIC-8 pad underneath for an SPI flash on SPI1 (PA4–PA7)

Rules that prevent the expensive mistakes

Check these before writing code — each one produces a failure that looks like something else.

  1. Define SysTick_Handler() yourself. framework-stm32cube ships no stm32f4xx_it.c, and the startup file's weak handler is an infinite loop. Without void SysTick_Handler(void) { HAL_IncTick(); } the board boots and then hangs in the first HAL_Delay() — which reads like a clock problem and is not. This is the single most common way a first project on this board fails.
  2. 96 MHz, not 100. USB_OTG_FS needs exactly 48 MHz off PLLQ, which divides the same VCO as PLLP. No integer pair gives 100 MHz and 48 MHz together. PLLM 25 / PLLN 192 / PLLP 2 / PLLQ 4. Set SYSCLK to 100 and USB silently never enumerates.
  3. FLASH_LATENCY_3 at 96 MHz, and PWR_REGULATOR_VOLTAGE_SCALE1 (after __HAL_RCC_PWR_CLK_ENABLE()) because Scale 2 caps at 84 MHz. Too few wait states → hard fault on the first fetch past the clock switch.
  4. -DHSE_VALUE=25000000 in build_flags. CubeF4's default template happens to be 25 MHz already, so it works by luck — until someone drops in a CubeMX-generated stm32f4xx_hal_conf.h written for an 8 MHz board and every baud rate and timer period shifts by 3.125× with no error.
  5. PC13 is lit by a LOW level and sits behind the backup-domain power switch: 3 mA maximum, GPIO_SPEED_FREQ_LOW, and never as a current source. Same limit applies to PC14/PC15, which are the LSE crystal here anyway.
  6. K1 on PA0 needs GPIO_PULLUP — not every revision fits an external one, and PA0 is one of only two pins on this package that are not 5 V tolerant (the other is PB5).
  7. Backup domain before RTC: __HAL_RCC_PWR_CLK_ENABLE() then HAL_PWR_EnableBkUpAccess(), or the LSE configuration reports success and the clock never starts. Expect the LSE itself to take ~2 s to stabilise on a cold start — that pause is normal, not a hang.
  8. HAL_RTC_GetTime() before HAL_RTC_GetDate(), always. The F4's calendar sits in shadow registers that unlock only after both are read. Reversed, the date freezes — a bug that first shows up at midnight.
  9. The temperature sensor is ADC channel 18 on the F411, not 16, and it shares that channel with the VBAT divider. Use ADC_CHANNEL_TEMPSENSOR and never call HAL_ADCEx_EnableVBAT(). F401 examples — which is most Black Pill material online — use channel 16 and return a plausible wrong number.
  10. Any internal ADC channel needs ADC_SAMPLETIME_480CYCLES (≥ 10 µs per the datasheet). The 3-cycle default reads noise. And use the factory calibration at 0x1FFF7A2A/2C/2E rather than the datasheet's typical 2.5 mV/°C — VDDA here is just an LDO output, not a reference.
  11. The USB device library is not in the framework. framework-stm32cubef4 has no STM32_USB_Device_Library; vendor usbd_core/ctlreq/ioreq/cdc into lib/. And point USBD_malloc at a static buffer — ST's default is malloc() against a 0x200-byte heap, which fails silently and the device never appears.

When the task is "how do I print something"

This board has no USB-serial chip. That surprises people coming from an Arduino Nano or an ESP32 devkit, and it shapes every debugging session. Options, cheapest first:

RouteCostNotes
USB CDC~14 KB flash, PA11/PA12, the USB peripheralsame cable as power and flashing; what template/ does
USART1 on PA9/PA10two pins + an external USB-UART donglealso the ROM bootloader's UART, so it doubles as recovery
SWO on PB3one pin + a trace-capable SWD probeno extra cable
Semihostingnonevery slow, halts on every write, needs the debugger attached

USB CDC is the default answer, and it is why rule 2 exists.

Starting a new project

Do not hand-assemble one — the USB stack alone is five files that have to be written, not installed. template/ is a verified-working project; scaffold from it:

Run from the directory containing this SKILL.md; use an absolute path for the new project.

sh
./template/variants/new-project.sh <target-dir> [--full|--minimal]
cd <target-dir> && pio run
  • --full (default) — LSE-backed RTC, USB CDC console with echo, calibrated temperature sensor, LED and K1. 19808 B of 512 KB flash, 4840 B of 128 KB RAM.
  • --minimal — LED + K1 only, same clock tree and startup order. 3476 B flash, 44 B RAM. Flash this first on a new board to prove toolchain, crystal and the DFU route before adding anything.

Both build clean with -Wall (verified). Nothing is generated and no paths are embedded, so copying the tree by hand works equally well. template/README.md maps files to subsystems, so a --full scaffold can be stripped back cleanly.

When the user already has a project, prefer bringing it in line with the template's platformio.ini and board.h over rewriting their code.

Flashing

DFU over the USB-C cable, no probe: hold BOOT0, tap NRST, release → the board enumerates as 0483:DF11 → pio run -t upload. PlatformIO passes :leave to dfu-util so the board restarts into the new firmware by itself; only entering DFU is manual, every time. SWD on the 4-pin header when you need breakpoints (debug_tool = stlink — the board definition defaults to blackmagic).

Nothing you flash can brick this board: the ROM bootloader runs before user code, so BOOT0 + NRST always gets you back, including after firmware that reconfigures PA13/PA14 and locks out SWD. If no DFU device appears at all, suspect BOOT1/PB2 being held high by attached hardware — that selects an SRAM boot instead. reference/board-hardware.md §16.3 has the full recovery ladder.

Confirm the board first

WeAct sells the same PCB with an STM32F401CCU6 (256 KB flash, 64 KB RAM, 84 MHz max, temperature sensor on ADC channel 16). The silkscreen next to the MCU says which. Most Black Pill tutorials online are written for the F401, so code lifted from them compiles on an F411 and misreads the temperature sensor. Everything in this skill is F411-specific unless it says otherwise; the clock tree in rule 2 works unchanged on an F401.

Reporting

State honestly what was verified on hardware versus derived from the datasheet. In this skill: the clock tree, LSE-backed RTC, USB CDC, DFU flashing and PC13 polarity were confirmed on a WeAct V3.x board; the temperature-sensor module is build-verified only; and K1 on PA0, the SPI-flash footprint pins and the header order come from the published WeAct pinout rather than from a schematic. Say so rather than presenting all of it as equally certain.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Stm32f411 Blackpill AI 技能有什么作用?

Firmware development for the WeAct Studio "Black Pill" (STM32F411CEU6) and its clones such as the DFRobot DFR0864 — the 25 MHz HSE and 32.768 kHz LSE crystals, PC13 LED, K1 button, USB-C wired straight to USB_OTG_FS, ROM DFU flashing, the SPI-flash footprint, and the STM32Cube HAL + PlatformIO setup around them. Use when working on this board or any STM32F411CE/F401CC Black Pill: project setup, platformio.ini, clock and PLL configuration for 96 MHz plus 48 MHz USB, pin mapping on the 48-pin package, USB CDC console, RTC on the LSE crystal, the internal temperature sensor, ADC accuracy, DFU...

为什么在 TypingMind 中使用 Stm32f411 Blackpill?

因为您只需安装一次,就能搭配任何模型使用。Stm32f411 Blackpill 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Stm32f411 Blackpill?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/alexex1993/mcu-skills/tree/main/skills/stm32/stm32f411-blackpill。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Stm32f411 Blackpill?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Stm32f411 Blackpill 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Stm32f411 Blackpill 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Stm32f411 Blackpill AI 技能免费吗?

是的。alexex1993 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇