(1) Erase and update bootloader.
-
Execute the control program from Command Prompt Window.
You need to be able to be execute the command of "ST-LINK Utility". For standard installation, PATH should include following path:
"\Program Files\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility"
Then, invoke following command line:
> ST-LINK_CLI -c SWD UR LPM -ME -P Desktop\hacker-emblem.hex 0x80000000 -V after_programming -HardRst
which does:
- specify SWD UR LPM (SWD, Under Reset, Low Power Mode)
- Erase flash memory (-ME option)
- Program flash memory (-P option with filename)
- Verify flash memory (-V option)
- Assert hardware reset signal of target board
Note that -ME option is not required for the initial programming of the MCU.
And you can download several bin files at one time.
(2)Download application code and RF driver code using UART 1.
Use python library Pyserial to download the code to board following yModem protocol. I finished it . Great!
bv
The code will be pasted here.
追加: 实际上我在这里做了个用串口终端下载程序到3165的东西,代码是用Python实现的,协议用了yModem。因为3165的sdk就是这么做的。效果不错。20170530
本文介绍如何使用ST-LINK工具擦除STM32设备的闪存并更新引导加载程序,并通过UART1使用Python和yModem协议下载应用程序代码及射频驱动。涉及ST-LINK命令行工具的具体操作及串口编程实现。
3839

被折叠的 条评论
为什么被折叠?



