stm32f103c8t6图
步骤:
1.上传bootloader
ttl线接法
(图片来自网络)
generic_boot20_pc13.bin
http://pan.baidu.com/s/1eRWcK6Y
TTL线转usb 连接电脑,记下串口号 下面以COM3
cd 到generic_boot20_pc13.bin目录
windows系统在Arduino_STM32-master\tools\win下面可以找到stm32flash.exe
解除写保护 stm32flash.exe -k COM3
stm32flash 0.4
http://stm32flash.googlecode.com/
Interface serial_posix: 57600 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0410 (Medium-density)
- RAM : 20KiB (512b reserved by bootloader)
- Flash : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Read-UnProtecting flash
Done.
刷入 stm32flash.exe -w generic_boot20_pc13.bin -v -g 0x0 COM3
如果提示,这就是因为没有解除写保护,重新执行stm32flash的两步的操作
http://stm32flash.googlecode.com/
Using Parser : Raw BINARY
Interface serial_w32: 57600 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0410 (Medium-density)
- RAM : 20KiB (512b reserved by bootloader)
- Flash : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Got NACK from device on command 0x43
Can't initiate chip erase!
Failed to erase memory
2. 下载文件
https://github.com/rogerclarkmelbourne/Arduino_STM32
放到arduino 安装目录的hardware目录下
3. 下载arduino arm支持
软件设置
闪烁程序
#define pinLED PC13
void setup() {
Serial.begin(9600);
pinMode(pinLED, OUTPUT);
Serial.println("START");
}
void loop() {
digitalWrite(pinLED, HIGH);
delay(2000);
digitalWrite(pinLED, LOW);
delay(2000);
Serial.println("Hello World");
}
点击上传
如果出现了下面提示,需要按一下核心板上的rest复位键
stm32flash 0.4
Failed to init device.
http://stm32flash.googlecode.com/
Using Parser : Raw BINARY
Interface serial_w32: 230400 8E1
在串口输出中可以看到运行结果
资料下载
http://pan.baidu.com/s/1eRWcK6Y