这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » STM32 » [MicroPython]NUCLEO-F412ZG体验

共6条 1/1 1 跳转至

[MicroPython]NUCLEO-F412ZG体验

工程师
2025-09-19 22:17:26     打赏

自从去年测评板卡结束,这块板子就闲置起来了。在浏览MicroPython官网的时候,发现官方已经适配好了固件。赶紧来烧录体验一下。

官网也介绍了几种不同的烧录方式:

Installation instructionsSTM32 via ST-Link

Nucleo and Discovery boards typically include a built-in ST-Link programmer.

A .bin or .hex file can be flashed using st-flash.

# Optional erase to clear existing filesystem.
st-flash erase

# Flash .bin
st-flash write firmware.bin 0x08000000
# or, flash .hex
st-flash --format ihex write firmware.hex

A .hex file can be flashed using STM32 Cube Programmer.

STM32_Programmer.sh -c port=SWD -d firmware.hex -hardRst

STM32 via DFU

Boards with USB support can also be programmed via the ST DFU bootloader, using e.g. dfu-util or pydfu.py.

To enter the bootloader the BOOT0 pin can be connected to VCC during reset, or you can use machine.bootloader() from the MicroPython REPL.

dfu-util --alt 0 -D firmware.dfu


这里选择的最新的HEX固件:

image.png

打开STM32 CubeProgrammer,右侧ST-LINK区域,点击Connect:

 image.png

选择Micropython固件,点击Start Programming.等待烧录完成。


 image.png

打开Thonny,右下角选择端口与板子:


 image.png

在输出窗口可以看到已经显示出了F412ZG的固件信息。

image.png


编写简单的脚本测试一下:

import pyb
import time

led_g = pyb.LED(1)
led_b = pyb.LED(2)
led_r = pyb.LED(3)


i = 0
while True:
    i = i + 1
    led_g.toggle()
    led_b.toggle()
    led_r.toggle()
    time.sleep(1)
    print("Blinking Times: ", i)


板子三个LED闪烁:

感觉起来跟CubeIDE或者Keil开发体验差异很大,可能是刚接触micropython的原因。后续有时间继续熟悉、体验。



院士
2025-09-20 13:25:07     打赏
2楼

我还是觉得MicroPython进入嵌入式有点费劲


高工
2025-09-20 21:56:55     打赏
3楼

移植了MicroPython之后,是不是部署算法就方便的多的多了


高工
2025-09-21 10:17:09     打赏
4楼

嗯嗯 期待楼主的大作


院士
2025-09-21 10:18:49     打赏
5楼

楼主 别谦虚~~



高工
2025-09-22 09:40:40     打赏
6楼

这款居然支持mic的编程方式


共6条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]