RobotHardware-UESTC/Hardware/Pibot驱动底盘/1.代码编译和烧写.md

49 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 固件使用说明
> zhanli : 更新 2023-12-26 :小车驱动经过验证更新
## 一、注意事项以及环境安装
### 1.1 代码使用注意事项
在目录`STM32`中,`params.mk`指定了部分的宏定义配置。目前实验室购买的两台小车的电机驱动是不同的一台小车的电机驱动是TB6612FNG另外一台小车的电机驱动是DRV8870。所以在编译的时候注意对小车的电机驱动芯片进行区分。一般来说简单的区分方式是单芯片的是TB6612双芯片的是DRV8870。
```makefile
# params.mk
# 定义宏定义
-DMOTOR_DRIVER_TB6612=1
-DMOTOR_DRIVER_DRV8870=2
# 这里指定的是TB6612如果是8870则-DMOTOR_DRIVER=MOTOR_DRIVER_DRV8870
-DMOTOR_DRIVER=MOTOR_DRIVER_TB6612
```
### 1.2 Keil的环境安装
`PIBOT\软件工具\软件工具集\MDK520\`目录提供了Keil5的安装包`MDK520.EXE`,安装过程不再赘述。
> [百度云链接](https://pan.baidu.com/s/15Q2ioZ0Vt-2zKLFBYAf-Yg ) 提取码:`owla`
>
> 完成安装后需要继续安装`Keil.STM32F1xx_DFP.2.2.0.pack`
## 二、编译与烧写
### 2.1 编译
到`PIBOT`源码包中双击打开`pibot.uvprojx`工程,编译
![](https://upload-images.jianshu.io/upload_images/3678585-b70d1e2dfbb71dfa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
### 2.2 烧写程序
**这里我们使用`JLink`烧写程序,连接`JLink`至开发板开发板上电这里的JLink只需要连接GND SWDIO SWCLK三根线**
打开工程选项切换至Debug标签选择`JLink`
![](https://upload-images.jianshu.io/upload_images/3678585-f4faa6fb614f85e3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击`Settings`按钮,`Port`选择`SW`
![](https://upload-images.jianshu.io/upload_images/3678585-d00e943421112f2d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
切换至Flash Download标签,如下图设置
![](https://upload-images.jianshu.io/upload_images/3678585-ffda6263dd4478be.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
保存后即可烧写程序
![](https://upload-images.jianshu.io/upload_images/3678585-6e35f6af95e93451.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
同时可以看到程序运行指示灯在闪烁表示程序在正常运行了。