STM32F103C8T6使用aduino环境编程


网上资料很多
例如


http://www.cirmall.com/bbs/thread-106076-1-1.html
https://blog.csdn.net/wcx1293296315/article/details/80357737
https://blog.csdn.net/argon_ghost/article/details/88297262


本文概括一下,希望对新同学有帮助
简述四步走
第一
aduino的开发环境安装完成之后,首先要增加对stm32开发板的支持
启动aduinoide 在 工具>开发板>开发板管理器的界面中搜索 Arduino SAM Boards
选择 Arduino SAM Boards(32-bits ARM Cortex-M3)开发板的项目安装之

第二
打开
https://github.com/rogerclarkmelbourne/Arduino_STM32

下载库包并解压到ARDUINO IDE安装目录的hardware文件夹下


第三
重启ide
工具>开发板 按照自己板子芯片型号选择开发板系列,本文是Generic STM32F103C series
工具>Upload method :"Serial"     上传方式选择串口
工具>端口 选择好自己对应的串口号

连接硬件
需要一个串口设备(一般是usb转ttl串口)V和G不必多说,注意usbttl的rx和tx分别接到开发板的PA9(Tx1) PA10(Rx1)

板上黄色的条线冒需要注意
boot0接3.3
boot1接gnd

如图

STM32F103C8T6使用aduino环境编程_第1张图片
最后做个实验


示例>A_STM32_Examples>Digital>Blink

注意板子上的led灯接在PC13上,程序如下

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin PB1 as an output.
  pinMode(PC13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(PC13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(250);              // wait for a second
  digitalWrite(PC13, LOW);    // turn the LED off by making the voltage LOW
  delay(250);              // wait for a second
}


编译上传(下载烧写)的信息


项目使用了 12648 字节,占用了 (19%) 程序存储空间。最大为 65536 字节。
全局变量使用了2456字节,(11%)的动态内存,余留18024字节局部变量。最大为20480字节。

stm32flash 0.4

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_w32: 115200 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

Wrote address 0x08000100 (2.02%) 
Wrote address 0x08000200 (4.05%) 
Wrote address 0x08000300 (6.07%) 
Wrote address 0x08000400 (8.10%) 
Wrote address 0x08000500 (10.12%) 
Wrote address 0x08000600 (12.14%) 
Wrote address 0x08000700 (14.17%) 
Wrote address 0x08000800 (16.19%) 
Wrote address 0x08000900 (18.22%) 
Wrote address 0x08000a00 (20.24%) 
Wrote address 0x08000b00 (22.26%) 
Wrote address 0x08000c00 (24.29%) 
Wrote address 0x08000d00 (26.31%) 
Wrote address 0x08000e00 (28.34%) 
Wrote address 0x08000f00 (30.36%) 
Wrote address 0x08001000 (32.38%) 
Wrote address 0x08001100 (34.41%) 
Wrote address 0x08001200 (36.43%) 
Wrote address 0x08001300 (38.46%) 
Wrote address 0x08001400 (40.48%) 
Wrote address 0x08001500 (42.50%) 
Wrote address 0x08001600 (44.53%) 
Wrote address 0x08001700 (46.55%) 
Wrote address 0x08001800 (48.58%) 
Wrote address 0x08001900 (50.60%) 
Wrote address 0x08001a00 (52.62%) 
Wrote address 0x08001b00 (54.65%) 
Wrote address 0x08001c00 (56.67%) 
Wrote address 0x08001d00 (58.70%) 
Wrote address 0x08001e00 (60.72%) 
Wrote address 0x08001f00 (62.75%) 
Wrote address 0x08002000 (64.77%) 
Wrote address 0x08002100 (66.79%) 
Wrote address 0x08002200 (68.82%) 
Wrote address 0x08002300 (70.84%) 
Wrote address 0x08002400 (72.87%) 
Wrote address 0x08002500 (74.89%) 
Wrote address 0x08002600 (76.91%) 
Wrote address 0x08002700 (78.94%) 
Wrote address 0x08002800 (80.96%) 
Wrote address 0x08002900 (82.99%) 
Wrote address 0x08002a00 (85.01%) 
Wrote address 0x08002b00 (87.03%) 
Wrote address 0x08002c00 (89.06%) 
Wrote address 0x08002d00 (91.08%) 
Wrote address 0x08002e00 (93.11%) 
Wrote address 0x08002f00 (95.13%) 
Wrote address 0x08003000 (97.15%) 
Wrote address 0x08003100 (99.18%) 
Wrote address 0x08003168 (100.00%) Done.

Starting execution at address 0x08000000... done.


ok,相信你能看到板子上的灯在闪烁了。
 

你可能感兴趣的:(单片机,arduino,环境安装,stm32,arduino)