add intro/kernel/hwsupport/sensor

This commit is contained in:
Yan_yan 2020-10-22 17:49:30 +08:00
parent 94fadb43cf
commit 71374d3000
76 changed files with 6806 additions and 10 deletions

View File

@ -1,6 +1,8 @@
const { description } = require('../../package')
const { name } = require('../../package')
const { getSidebarByCategory } = require('./sidebar')
module.exports = {
/**
* Refhttps://v1.vuepress.vuejs.org/config/#title
@ -88,15 +90,24 @@ module.exports = {
sidebar: {
'/doc/': [
{
title: '文档',
collapsable: false,
children: [
'',
'intro',
'kernel',
'appdev',
'api',
]
title: '简介',
children: getSidebarByCategory('intro','en')
},
{
title: '内核',
children: getSidebarByCategory('kernel','en')
},
{
title: '硬件支持',
children: getSidebarByCategory('framework','en')
},
{
title: '通信协议',
children: getSidebarByCategory('communication','en')
},
{
title: '传感器',
children: getSidebarByCategory('sensor','en')
}
],
}

View File

@ -3,6 +3,8 @@
*
* https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements
*/
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
export default ({
Vue, // the version of Vue being used in the VuePress app
@ -11,4 +13,5 @@ export default ({
siteData // site metadata
}) => {
// ...apply enhancements for the site.
Vue.use(Element)
}

61
docs/.vuepress/sidebar.js Executable file
View File

@ -0,0 +1,61 @@
const sidebar = {
'intro': [
'/doc/intro',
'/doc/constructenv/bianyi',
'/doc/constructenv/debug',
'/doc/constructenv/goujian'
],
'kernel': [
'/doc/kernel/mm',
'/doc/kernel/task',
'/doc/kernel/synchron',
'/doc/kernel/threadcommunication'
],
'framework': [
'/doc/hwsupport/aiit-arm32',
'/doc/hwsupport/stm32f407-st-discovery',
'/doc/hwsupport/stm32f407zgt6',
'/doc/hwsupport/hifive1-rev',
'/doc/hwsupport/maxgo',
'/doc/hwsupport/kd233'
],
'communication': [
'/doc/communication/4G',
'/doc/communication/5G',
'/doc/communication/at',
'/doc/communication/Bluetooth',
'/doc/communication/CAN',
'/doc/communication/ethernet',
'/doc/communication/LORA',
'/doc/communication/mymqtt',
'/doc/communication/NB-IOT',
'/doc/communication/rs485',
'/doc/communication/WiFi',
'/doc/communication/Zigbee'
],
'sensor': [
'/doc/sensor/force_sensor',
'/doc/sensor/gas_sensor',
'/doc/sensor/heat_sensor',
'/doc/sensor/humidity_sensor',
'/doc/sensor/magneto_sensor',
'/doc/sensor/photoelec_sensor',
'/doc/sensor/pressure_sensor',
'/doc/sensor/voice_sensor'
]
}
function getSidebarByCategory(category, lang = 'en') {
const links = JSON.parse(JSON.stringify(sidebar[category])) // Deep clone
return links.map(link => {
if (lang != 'en' && link.startsWith('/')) {
return `/${lang}${link}`
}
return link
})
}
module.exports = {
getSidebarByCategory
}

View File

@ -0,0 +1,258 @@
# 4G
## 模块介绍
<el-divider></el-divider>
### EC20 模块
<div class = "wrapper">
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" >
<tr>
<td style="width: 50%;">
<!--左侧内容-->
<img src = "./imagesrc/ec20.png" alt="EC20" width =100% max-width= 100% >
</td>
<td style="width: 50%;">
<!--右侧内容-->
EC20 Mini PCIe采用标准的Mini PCIe封装</br></br>
支持LTEUMTS和GSM/GPRS网络</br></br>
最大上行速率为50Mbps最大下行速率为100Mbps</br></br>
在缺乏3G和4G网络的偏远地区也能正常工作</br></br>
</td>
</tr>
</table>
</div>
<br/>
产品描述EC20 Mini PCIe内嵌丰富的网络协议集成多个工业标准接口并支持多种软件功能(Windows XP, Windows Vista, Windows 7/8/8.1/10, Windows CE, Linux 和 Android 系统下的USB驱动,eCall*等)极大地拓展了其在M2M 领域的应用范围如CPE、路由器、数据卡、平板电脑、车载、安防以及工业级PDA等</br></br>
EC20 Mini PCIe是采用 PCI Express® Mini Card标准接口的LTE模块采用LTE 3GPP Rel.9技术支持最大下行速率100Mbps和最大上行速率50Mbps。EC20 Mini PCIe系列模块包含EC20-E Mini PCIe、EC20-A Mini PCIe和EC20-C Mini PCIe三个版本使其能够向后兼容现存的EDGE和GSM/GPRS网络以确保在缺乏3G和4G网络的偏远地区也能正常工作。</br>
</br>
<div class = "wrapper" >
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 520 >
<tr>
<td width = 150>
LTE 版本
</td>
<td width = 500>
3GPP E-UTRA Release 9
</td>
</tr>
<tr>
<td>
频带宽度
</td>
<td>
1.4/3/5/10/15/20MHz
</td>
</tr>
<tr>
<td>
天线 DL
</td>
<td>
MIMO 2×2, supports Rx-diversity
</td>
</tr>
<tr>
<td>
供电电压
</td>
<td>
3.3V~ 3.6V, 典型值3.3V
</td>
</tr>
<tr>
<td>
工作温度
</td>
<td>
-40 °C ~ +80 °C
</td>
</tr>
<tr>
<td>
模块尺寸
</td>
<td>
51.0 x 30.0 x 4.9mm
</td>
</tr>
</table>
</div>
</br>
### Air720 模块
<div class = "wrapper">
<table style="margin-left: auto; margin-right: auto; table-layout: fixed; " >
<tr>
<td style="width: 50%;">
<!--左侧内容-->
<img src = "./imagesrc/Air720.png" alt="Air720" width =100% max-width= 100% >
</td>
<td style="width: 50%;">
<!--右侧内容-->
产品名称:</br></br>
Air720H 4G LTE 模块</br></br>
产品型号Air720H Module</br></br>
四模全网通4G模块</br></br>
移动+电信+联通</br></br>
统统支持</br></br>
</td>
</tr>
</table>
</div>
<br/>
Air720模块是一款带分集接收功能的4G多模无线通信模块Air720H支持GSM/WCDMA/FDD/TDD几乎能够满足所有的M2M的需求
包括汽车及个人追踪服务、无线POS机、智能计量、工业级PDA以及其它物联网应用需求。</br>
</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 520 >
<tr>
<td width = 150>
LTE 版本
</td>
<td width = 500>
3GPP E-UTRA Release 9
</td>
</tr>
<tr>
<td>
带宽
</td>
<td>
1.4/3/5/10/15/20MHz
</td>
</tr>
<tr>
<td>
温度范围
</td>
<td>
-40℃ +85℃
</td>
</tr>
<tr>
<td>
模块尺寸
</td>
<td>
32.0 x 29.0 x 2.4mm
</td>
</tr>
<tr>
<td>
封装方式
</td>
<td>
LCC封装
</td>
</tr>
<tr>
<td>
供电电压
</td>
<td>
3.3V ~ 4.3V,典型值 3.8V
</td>
</tr>
</table>
</div>
### EC200T 模块
<div class = "wrapper">
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" >
<tr>
<td style="width: 50%;">
<!--左侧内容-->
<img src = "./imagesrc/ec200t.png" alt="EC20t" width =100% max-width= 100% >
</td>
<td style="width: 50%;">
<!--右侧内容-->
专为 M2M 和 IoT 应用而设计的LTE Cat 4 无线模块</br></br>
多网络制式覆盖</br></br>
支持FOTA远程升级功能</br></br>
MIMO技术可满足无线通信系统对数据速率和连接可靠性的要求</br></br>
</td>
</tr>
</table>
</div>
</br>
EC200T 内置丰富的网络协议,集成多个工业标准接口,并支持多种驱动和软件功能(适用于 Windows 7/8/10LinuxAndroid 等操作系统下的USB驱动极大地扩展了其在M2M领域的应用范围如OTTCPE路由器数据卡平板电脑安防以及工业级PDA等。
</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 520 >
<tr>
<td width = 150>
LTE
</td>
<td width = 800>
LTE FDD最大 150MbpsDL/最大50MbpsUL</br>
LTE TDD最大 130MbpsDL/最大30MbpsUL
</td>
</tr>
<tr>
<td>
带宽
</td>
<td>
1.4/3/5/10/15/20MHz
</td>
</tr>
<tr>
<td>
温度范围
</td>
<td>
-40℃ +85℃
</td>
</tr>
<tr>
<td>
模块尺寸
</td>
<td>
29.0 x 32.0 x 2.4mm
</td>
</tr>
<tr>
<td>
封装方式
</td>
<td>
LCC封装
</td>
</tr>
<tr>
<td>
供电电压
</td>
<td>
3.4V ~ 4.5V,典型值 3.8V
</td>
</tr>
</table>
</div>
## 模块配置和代码树
<el-divider></el-divider>
对于4G 模块默认配置就可以测试可能需要修改的是UART设备的名字</br>
[\*] Enable 4G ---></br>
&ensp;&ensp;&ensp;&ensp;--- Enable 4G</br>
&ensp;&ensp;&ensp;&ensp;[ ] luat Air720 ---></br>
&ensp;&ensp;&ensp;&ensp;[\*] Quectel EC20 </br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[ ] Enable initialize by thread</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[\*] Enable sample ---> (是否编译测试例程)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(-1) Power pin ---> (电源引脚配置,与电路板相关,模块测试无需修改)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(-1) Power status pin ---> (电源状态引脚配置,与电路板相关,模块测试无需修改)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(uart3) AT client device name ---> 模块连接的UART名字取决于模块和主板的连接方式</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(1024) The maximum length of receive line buffer ---> 缓存大小建议在1K以上</br>
<div>
<img src = "./imagesrc/ec20_CodeTree.png" alt="ec20_CodeTree" width =300 >
</div>

View File

@ -0,0 +1,11 @@
# 5G
## 模块介绍
<el-divider></el-divider>
## 模块配置和代码树
<el-divider></el-divider>
## 测试程序
<el-divider></el-divider>

View File

@ -0,0 +1,70 @@
# bluetooth
## 模块介绍
<el-divider></el-divider>
### HC-08蓝牙模块
<div style="display: flex;justify-content: center;align-items: center;">
<img src = "./imagesrc/hc08.png" alt="hc08" width =50% max-width= 50% >
</br>
</div>
HC-08 蓝牙串口通信模块是新一代的基于Bluetooth Specification V4.0 BLE 蓝牙协议的数传模块。无线工作频段为2.4 GHz ISM调制方式是GFSK。模块最大发射功率为4dBm接受灵敏度-93dBm空旷环境下和手机可以实现80米超远距离通信。</br></br>
模块大小 26.9mm×13mm×2.2mm,集成了邮票封装孔和排针焊接孔,既可以贴片封装,也又可以焊接排针,很方便嵌入应用系统之内。自带 LED 状态指示灯,可直观判断蓝牙的连接状态。</br></br>
模块采用 TI 的 CC2540F256 芯片,配置 256K 字节空间,支持 AT 指令,用户可根据需要更改角色(主、从模式)以及串口波特率、设备名称等参数,使用灵活。</br></br>
<div style="display: flex;justify-content: center;align-items: center;">
<img src = "./imagesrc/hc08_pin.png" alt="hc08_pin" width =50% max-width= 50% >
</br>
</div>
HC-08 蓝牙模块第27/28/29/30引脚含义
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 600>
<tr>
<td width = 100>序号</td>
<td width = 250>HC-08模块</td>
<td width = 250>备注</td>
</tr>
<tr>
<td>1</td>
<td>VCC第27引脚</td>
<td>模块3.3V 供电正</td>
</tr>
<tr>
<td>2</td>
<td>GND第28引脚</td>
<td>模块公共地</td>
</tr>
<tr>
<td>3</td>
<td>RXD第29引脚</td>
<td>UART输入口3.3V TTL电平</td>
</tr>
<tr>
<td>4</td>
<td>TXD第30引脚</td>
<td>UART输出口3.3V TTL电平</td>
</tr>
</table>
</div>
## 模块配置和代码树
<el-divider></el-divider>
对于Bluetooth 模块默认配置就可以测试可能需要修改的是UART设备的名字</br>
[\*] Enable Bluetooth ---></br>
&ensp;&ensp;&ensp;&ensp;--- Enable Bluetooth</br>
&ensp;&ensp;&ensp;&ensp;[\*] Quectel HC08---></br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[ ] Enable initialize by thread</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[\*] Enable sample ---> (是否编译测试例程)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(-1) Power pin ---> (电源引脚配置,与电路板相关,模块测试无需修改)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(-1) Power status pin ---> (电源状态引脚配置,与电路板相关,模块测试无需修改)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(uart3) AT client device name ---> 模块连接的UART名字取决于模块和主板的连接方式</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(1024) The maximum length of receive line buffer ---> 缓存大小建议在1K以上</br>
<div>
<img src = "./imagesrc/hc08_CodeTree.png" alt="hc08_CodeTree" width =300 >
</div>

View File

@ -0,0 +1 @@
# CAN

View File

@ -0,0 +1 @@
# LORA

View File

@ -0,0 +1,590 @@
# NB-IOT
<!--不放在这里会导致标题不等高-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="ProgId" content="Excel.Sheet">
<meta name="Generator" content="Aspose.Cell 18.4">
<link rel="File-List" href="092117352726_files/filelist.xml">
<link rel="Edit-Time-Data" href="092117352726_files/editdata.mso">
<link rel="OLE-Object-Data" href="092117352726_files/oledata.mso">
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
</o:DocumentProperties>
</xml><![endif]-->
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{
mso-header-data:"";
mso-footer-data:"";
margin:0.75in 0.7in 0.75in 0.7in;
mso-header-margin:0.3in;
mso-footer-margin:0.3in;
mso-page-orientation:Portrait;
}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
ruby
{ruby-align:left;}
.style0
{
mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
border:none;
mso-protection:locked visible;
mso-style-name:Normal;
mso-style-id:0;}
.font0
{
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif"; }
.font1
{
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif"; }
.font2
{
color:#000000;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"等线","monospace"; }
.font3
{
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace"; }
td
{mso-style-parent:style0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
border:none;
mso-protection:locked visible;
mso-ignore:padding;}
.style0
{
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
mso-protection:locked visible;
mso-style-name:"Normal";
}
.style1
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style2
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style3
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style4
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style5
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style6
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style7
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style8
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style9
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style10
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style11
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style12
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style13
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style14
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.x15
{
mso-style-parent:style0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
mso-protection:locked visible;
}
.style16
{
mso-number-format:"0%";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Percent";
}
.style17
{
mso-number-format:"_ \0022¥\0022* \#\,\#\#0\.00_ \;_ \0022¥\0022* -\#\,\#\#0\.00_ \;_ \0022¥\0022* \0022-\0022??_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Currency";
}
.style18
{
mso-number-format:"_ \0022¥\0022* \#\,\#\#0_ \;_ \0022¥\0022* -\#\,\#\#0_ \;_ \0022¥\0022* \0022-\0022_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Currency [0]";
}
.style19
{
mso-number-format:"_ * \#\,\#\#0\.00_ \;_ * -\#\,\#\#0\.00_ \;_ * \0022-\0022??_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Comma";
}
.style20
{
mso-number-format:"_ * \#\,\#\#0_ \;_ * -\#\,\#\#0_ \;_ * \0022-\0022_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Comma [0]";
}
.x21
{
mso-style-parent:style0;
mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace";
mso-protection:locked visible;
}
.x22
{
mso-style-parent:style0;
mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace";
mso-protection:locked visible;
}
.x23
{
mso-style-parent:style0;
mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace";
mso-protection:locked visible;
}
.x24
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
mso-protection:locked visible;
}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sheet1</x:Name>
<x:WorksheetOptions>
<x:StandardWidth>2304</x:StandardWidth>
<x:Print>
<x:ValidPrinterInfo/>
<x:PaperSizeIndex>9</x:PaperSizeIndex>
<x:HorizontalResolution>600</x:HorizontalResolution>
<x:VerticalResolution>600</x:VerticalResolution>
</x:Print>
<x:Selected/>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>12576</x:WindowHeight>
<x:WindowWidth>23256</x:WindowWidth>
<x:WindowTopX>-108</x:WindowTopX>
<x:WindowTopY>-108</x:WindowTopY>
<x:RefModeR1C1/>
<x:TabRatio>600</x:TabRatio>
<x:ActiveSheet>0</x:ActiveSheet>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
## 模块介绍
<el-divider></el-divider>
### Quectel BC28
<div style="display: flex;justify-content: center;align-items: center;">
<img src = "./imagesrc/bc26.png" alt="bc26" width =50% max-width= 50% >
</br>
</div>
BC28 是一款超紧凑、高性能、低功耗的多频段 NB-IoT 无线通信模块,支持 B1/B3/B8/B5/B20/B28 频段。其尺寸仅为17.7 mm × 15.8 mm × 2.0 mm能最大限度地满足终端设备对小尺寸模块产品的需求同时有效地帮助客户减小产品尺寸并优化产品成本。BC28 在设计上兼容移远通信 GSM/GPRS 系列的 M26 模块和 NB-IoT 系列的 BC26 模块,方便客
户快速、灵活的进行产品设计和升级。</br></br>
BC28 采用更易于焊接的 LCC 封装,可通过标准 SMT 设备实现模块的快速生产为客户提供可靠的连接方式特别适合自动化、大规模、低成本的现代化生产方式。SMT 贴片技术也使 BC28 具有高可靠性,以满足复杂环境下的应用需求。</br></br>
凭借紧凑的尺寸、超低功耗和超宽工作温度范围BC28 成为 IoT 应用领域的理想选择,常被用于无线抄表、共享单车、智能停车、智慧城市、安防、资产追踪、智能家电、农业和环境监测以及其它诸多行业,以提供完善的短信和数据传输服务。</br></br>
#### Quectel BC28 特性
+ 尺寸紧凑的多频段 NB-IoT 无线通信模块
+ 超低功耗、超高灵敏度
+ LCC 封装,适合批量生产
+ 封装设计兼容移远通信 GSM/GPRS M26 模块和 NB-IoT 系列的 BC26
+ 模块,易于产品升级
+ 内嵌网络服务协议栈
+ 通过提供参考设计、评估板和及时的技术支持可满足客户产品快速上市的要求
#### 基本参数
<body link='blue' vlink='purple' >
<table border='0' cellpadding='0' cellspacing='0' width='632' style='border-collapse:
collapse;table-layout:fixed;width:474pt'>
<col width='188' style='mso-width-source:userset;width:141pt'>
<col width='444' style='mso-width-source:userset;width:333pt'>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r0'>
<td height='16' class='x25' width='188' style='mso-ignore:style;height:12.3pt;width:141pt;font-size:11pt;color:#2E75B6;font-weight:700;text-decoration:none;text-line-through:none;font-family:"等线";background:auto;mso-pattern:auto;border-top:.5pt solid #5B9BD5;border-right:none;border-bottom:.5pt solid #5B9BD5;border-left:none;'>参数</td>
<td class='x25' width='444' style='mso-ignore:style;width:333pt;font-size:11pt;color:#2E75B6;font-weight:700;text-decoration:none;text-line-through:none;font-family:"等线";background:auto;mso-pattern:auto;border-top:.5pt solid #5B9BD5;border-right:none;border-bottom:.5pt solid #5B9BD5;border-left:none;'>数值</td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r1'>
<td height='18' class='x26' style='mso-ignore:style;height:13.65pt;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:#DEEBF7;mso-pattern:auto none;border-top:.5pt solid #5B9BD5;border-right:none;border-bottom:none;border-left:none;'>供电电压</td>
<td class='x26' style='mso-ignore:style;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:#DEEBF7;mso-pattern:auto none;border-top:.5pt solid #5B9BD5;border-right:none;border-bottom:none;border-left:none;'>&nbsp;2.1~3.63 V典型值 3.3 V GPIO 电压域: 1.8 V</td>
</tr>
<tr height='38' style='mso-height-source:userset;height:28.8pt' id='r2'>
<td height='38' class='x27' style='mso-ignore:style;height:28.8pt;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:auto;mso-pattern:auto;'>温度范围</td>
<td class='x28' style='mso-ignore:style;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:auto;mso-pattern:auto;'>正常工作温度:-35 °C ~ +75 °C<br>扩展工作温度:-40 °C ~ +85 °C </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r3'>
<td height='19' class='x29' style='mso-ignore:style;height:14.4pt;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:#DEEBF7;mso-pattern:auto none;'>外形尺寸</td>
<td class='x29' style='mso-ignore:style;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:#DEEBF7;mso-pattern:auto none;'>17.7 mm × 15.8 mm × 2.0 mm </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r4'>
<td height='19' class='x27' style='mso-ignore:style;height:14.4pt;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:auto;mso-pattern:auto;'>输出功率</td>
<td class='x27' style='mso-ignore:style;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:auto;mso-pattern:auto;'>23 dBm ±2 dB </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r5'>
<td height='19' class='x29' style='mso-ignore:style;height:14.4pt;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:#DEEBF7;mso-pattern:auto none;'>重传灵敏度</td>
<td class='x30' style='mso-ignore:style;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:#DEEBF7;mso-pattern:auto none;'>-129dBm</td>
</tr>
<tr height='76' style='mso-height-source:userset;height:57.6pt' id='r6'>
<td height='76' class='x27' style='mso-ignore:style;height:57.6pt;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:auto;mso-pattern:auto;'>Cat NB1 功耗(典型值)</td>
<td class='x28' style='mso-ignore:style;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:auto;mso-pattern:auto;'>3.5 μA @ PSM<br>0.24 mA @ 空闲模式eDRX = 81.92 s<br>0.35 mA @ 空闲模式DRX = 2.56 s<br>110 mA @ LTE Cat NB1, 23 dBm</td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r7'>
<td height='18' class='x31' style='mso-ignore:style;height:13.65pt;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:#DEEBF7;mso-pattern:auto none;border-top:none;border-right:none;border-bottom:.5pt solid #5B9BD5;border-left:none;'>Cat NB2 功耗(典型值)</td>
<td class='x31' style='mso-ignore:style;font-size:11pt;color:#2E75B6;font-weight:400;text-decoration:none;text-line-through:none;font-family:"宋体";background:#DEEBF7;mso-pattern:auto none;border-top:none;border-right:none;border-bottom:.5pt solid #5B9BD5;border-left:none;'>待定</td>
</tr>
<![if supportMisalignedColumns]>
<tr height='0' style='display:none'>
<td width='188' style='width:141pt'></td>
<td width='444' style='width:333pt'></td>
</tr>
<![endif]>
</table>
</body>
## 模块配置和代码树
<el-divider></el-divider>
对于NB-IOT 模块默认配置就可以测试可能需要修改的是UART设备的名字</br>
[\*] Enable NB-IOT ---></br>
&ensp;&ensp;&ensp;&ensp;--- Enable NB-IOT</br>
&ensp;&ensp;&ensp;&ensp;[\*] Quectel BC26 ---></br>
&ensp;&ensp;&ensp;&ensp;[ ] Gosuncn ME3616</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[ ] Enable initialize by thread</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[\*] Enable sample ---> (是否编译测试例程)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(-1) Power pin ---> (电源引脚配置,与电路板相关,模块测试无需修改)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(-1) Power status pin ---> (电源状态引脚配置,与电路板相关,模块测试无需修改)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(uart3) AT client device name ---> 模块连接的UART名字取决于模块和主板的连接方式</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(1024) The maximum length of receive line buffer ---> 缓存大小建议在1K以上</br>
<div>
<img src = "./imagesrc/bc26_CodeTree.png" alt="bc26_CodeTree" width =300 >
</div>

View File

@ -0,0 +1,71 @@
# WiFi
## 模块介绍
<el-divider></el-divider>
### ESP8266
<div style="display: flex;justify-content: center;align-items: center;">
<img src = "./imagesrc/esp8266.jpg" alt="esp8266" width =50% max-width= 50% >
</br>
</div>
ESP8266芯片是一款串口转无线模芯片内部自带固件用户操作简单无需编写时序信号等。</br>
#### ESP8266 特性:
* 802.11 b/g/n
* 内置低功耗32位CPU:可以兼作应用处理器
* 内置10 bit高精度ADC
* 内置TCP/IP协议栈
* 内置TR开关、balun、LNA、功率放大器和匹配网络
* 内置PLL、稳压器和电源管理组件
* 支持天线分集
* STBC、1x1 MIMO、2x1 MIMO
* A-MPDU、A-MSDU的聚合和0.4 s的保护间隔
* WiFi @ 2.4 GHz,支持 WPA/WPA2 安全模式
* 支持STA/AP/STA+AP工作模式
* 支持Smart Config功能包括Android和iOS设备
* SDIO 2.0、H) SPI、UART、I2C、I2S、IR Remote Control、PWM、GPIO
* 深度睡眠保持电流为10 uA,关断电流小于5 uA
* 2 ms之内唤醒、连接并传递数据包
* 802.11b模式下+20 dBm的输出功率
* 待机状态消耗功率小于1.0 mW (DTIM3)
* 工作温度范围:-40°C - 125°C
* 通过 FCC, CE, TELEC, WiFi Alliance 及 SRRC 认证
## 软件结构
<div style="display: flex;justify-content: center;align-items: center;">
<img src = "./imagesrc/esp8266_swstruct.png" alt="esp8266 software structure" width =40% max-width= 40% >
</br>
</div>
软件结构如上图故测试WiFi的时候需要添加 **AT protocol** 和**Mqtt**
## 模块配置和代码树
[\*] Enable Wifi ---></br>
&ensp;&ensp;&ensp;&ensp;--- Enable Wifi</br>
&ensp;&ensp;&ensp;&ensp;[\*] Espressif ESP8266 ---> (里面的默认设置就可以使用,无需修改)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;--- Espressif ESP8266</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[ ] Enable initialize by thread</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[\*] **Enable sample模块注册测试程序 选定后会再启动时自动加载模块)**</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(xiaoshanos) WIFI ssid </br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(12345678) WIFI password</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(uart2) AT client device name </br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(512) The maximum length of receive line buffer</br></br>
[\*] Enable AT protocol ---> (里面的默认设置就可以使用,无需修改)</br>
&ensp;&ensp;&ensp;&ensp;--- Enable AT protocol</br>
&ensp;&ensp;&ensp;&ensp;Socket abstraction layer --->(里面的默认设置就可用,无需修改)</br>
&ensp;&ensp;&ensp;&ensp;Network interface device --->(里面的默认设置就可用,无需修改)</br>
&ensp;&ensp;&ensp;&ensp;AT commands ---> (里面的默认设置就可用,无需修改,但可添加调试信息)</br></br>
[\*] Enable AT commands</br>
&ensp;&ensp;&ensp;&ensp;**[ ]Enable debug log output(simple)** </br>
&ensp;&ensp;&ensp;&ensp;[\*]Enable AT commands client</br>
&ensp;&ensp;&ensp;&ensp;(2) The maximum number of supported clients</br>
&ensp;&ensp;&ensp;&ensp;[\*]Enable BSD Socket support</br>
&ensp;&ensp;&ensp;&ensp; **[ ]Enable print RAW format communication data(complex)**</br>
&ensp;&ensp;&ensp;&ensp;(128)The maximum length of AT Commands buffer</br></br>
[\*] Enable Mqtt --->当需要测试mqtt时可以打开里面的默认设置就可以使用无需修改</br>
<div>
<img src = "./imagesrc/esp8266_CodeTree.png" alt="esp8266_CodeTree" width =300 >
</div>

View File

@ -0,0 +1 @@
# Zigbee

View File

@ -0,0 +1,711 @@
# AT
<!--不放在这里会导致标题不等高-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="ProgId" content="Excel.Sheet">
<meta name="Generator" content="Aspose.Cell 18.4">
<link rel="File-List" href="092215383253_files/filelist.xml">
<link rel="Edit-Time-Data" href="092215383253_files/editdata.mso">
<link rel="OLE-Object-Data" href="092215383253_files/oledata.mso">
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
</o:DocumentProperties>
</xml><![endif]-->
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{
mso-header-data:"";
mso-footer-data:"";
margin:0.75in 0.7in 0.75in 0.7in;
mso-header-margin:0.3in;
mso-footer-margin:0.3in;
mso-page-orientation:Portrait;
}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
ruby
{ruby-align:left;}
.style0
{
mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
border:none;
mso-protection:locked visible;
mso-style-name:Normal;
mso-style-id:0;}
.font0
{
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif"; }
.font1
{
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif"; }
.font2
{
color:#333333;
font-size:9pt;
font-weight:700;
font-style:normal;
font-family:"Microsoft JhengHei UI","sans-serif"; }
.font3
{
color:#333333;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"宋体","sans-serif"; }
.font4
{
color:#333333;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"Arial","serif"; }
.font5
{
color:#000000;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"等线","monospace"; }
.font6
{
color:#333333;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"微软雅黑","sans-serif"; }
.font7
{
color:#333333;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace"; }
td
{mso-style-parent:style0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
border:none;
mso-protection:locked visible;
mso-ignore:padding;}
.style0
{
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
mso-protection:locked visible;
mso-style-name:"Normal";
}
.style1
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style2
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style3
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style4
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style5
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style6
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style7
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style8
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style9
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style10
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style11
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style12
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style13
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style14
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.x15
{
mso-style-parent:style0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
mso-protection:locked visible;
}
.style16
{
mso-number-format:"0%";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Percent";
}
.style17
{
mso-number-format:"_ \0022¥\0022* \#\,\#\#0\.00_ \;_ \0022¥\0022* -\#\,\#\#0\.00_ \;_ \0022¥\0022* \0022-\0022??_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Currency";
}
.style18
{
mso-number-format:"_ \0022¥\0022* \#\,\#\#0_ \;_ \0022¥\0022* -\#\,\#\#0_ \;_ \0022¥\0022* \0022-\0022_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Currency [0]";
}
.style19
{
mso-number-format:"_ * \#\,\#\#0\.00_ \;_ * -\#\,\#\#0\.00_ \;_ * \0022-\0022??_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Comma";
}
.style20
{
mso-number-format:"_ * \#\,\#\#0_ \;_ * -\#\,\#\#0_ \;_ * \0022-\0022_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Comma [0]";
}
.x21
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#9DC3E6;
mso-pattern:auto none;
color:#333333;
font-size:9pt;
font-weight:700;
font-style:normal;
font-family:"Microsoft JhengHei UI","sans-serif";
border-top:1px solid windowtext;
border-right:1px solid windowtext;
border-bottom:1px solid windowtext;
border-left:1px solid windowtext;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x22
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#9DC3E6;
mso-pattern:auto none;
color:#333333;
font-size:9pt;
font-weight:700;
font-style:normal;
font-family:"Microsoft JhengHei UI","sans-serif";
border-top:1px solid windowtext;
border-right:1px solid windowtext;
border-bottom:1px solid windowtext;
border-left:1px solid windowtext;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x23
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#FFFFFF;
mso-pattern:auto none;
color:#333333;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"宋体","sans-serif";
border-top:1px solid windowtext;
border-right:1px solid windowtext;
border-bottom:1px solid windowtext;
border-left:1px solid windowtext;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x24
{
mso-style-parent:style0;
mso-number-format:General;
text-align:left;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#FFFFFF;
mso-pattern:auto none;
color:#333333;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"宋体","serif";
border-top:1px solid windowtext;
border-right:1px solid windowtext;
border-bottom:1px solid windowtext;
border-left:1px solid windowtext;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x25
{
mso-style-parent:style0;
mso-number-format:General;
text-align:left;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#FFFFFF;
mso-pattern:auto none;
color:#333333;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"宋体","sans-serif";
border-top:1px solid windowtext;
border-right:1px solid windowtext;
border-bottom:1px solid windowtext;
border-left:1px solid windowtext;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x26
{
mso-style-parent:style0;
mso-number-format:General;
text-align:left;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#FFFFFF;
mso-pattern:auto none;
color:#333333;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"Arial","serif";
border-top:1px solid windowtext;
border-right:1px solid windowtext;
border-bottom:1px solid windowtext;
border-left:1px solid windowtext;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sheet1</x:Name>
<x:WorksheetOptions>
<x:StandardWidth>2304</x:StandardWidth>
<x:Print>
<x:ValidPrinterInfo/>
<x:PaperSizeIndex>9</x:PaperSizeIndex>
<x:HorizontalResolution>600</x:HorizontalResolution>
<x:VerticalResolution>600</x:VerticalResolution>
</x:Print>
<x:Selected/>
<x:TopRowVisible>15</x:TopRowVisible>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>12576</x:WindowHeight>
<x:WindowWidth>23256</x:WindowWidth>
<x:WindowTopX>-108</x:WindowTopX>
<x:WindowTopY>-108</x:WindowTopY>
<x:RefModeR1C1/>
<x:TabRatio>600</x:TabRatio>
<x:ActiveSheet>0</x:ActiveSheet>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
## AT 指令简介
<el-divider></el-divider>
AT指令是应用于终端设备与PC应用之间的连接与通信的指令。AT 即Attention。每个AT命令行中只能包含一条AT指令对于AT指令的发送除AT两个字符外最多可以接收1056个字符的长度包括最后的空字符</br></br>
AT指令集是从终端设备Terminal EquipmentTE)或数据终端设备Data Terminal EquipmentDTE)向终端适配器(Terminal AdapterTA)或数据电路终端设备(Data Circuit Terminal EquipmentDCE)发送的。</br></br>
其对所传输的数据包大小有定义即对于AT指令的发送除AT两个字符外最多可以接收1056个字符的长度包括最后的空字符</br></br>
每个AT命令行中只能包含一条AT指令对于由终端设备主动向PC端报告的URC指示或者response响应也要求一行最多有一个不允许上报的一行中有多条指示或者响应。AT指令以回车作为结尾响应或上报以回车换行为结尾。</br>
## ESP8266 中AT指令的使用
<el-divider></el-divider>
下面以ESP8266为例来说明AT指令的使用。
<body link='blue' vlink='purple' >
<table border='0' cellpadding='0' cellspacing='0' width='661' style='border-collapse:
collapse;table-layout:fixed;width:495pt'>
<col width='307' style='mso-width-source:userset;width:230.25pt'>
<col width='282' style='mso-width-source:userset;width:211.5pt'>
<col width='72' style='width:54pt'>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r0'>
<td height='24' class='x21' width='307' style='height:18.45pt;width:230.25pt;'>指令</td>
<td colspan='2' class='x22' width='354' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'>描述</td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r1'>
<td height='24' class='x23' style='height:18.45pt;'>AT</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">测试 </font><font class="font4">AT </font><font class="font3">启动</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r2'>
<td height='24' class='x23' style='height:18.45pt;'>AT+RST</td>
<td colspan='2' class='x25' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'>重启模块</td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r3'>
<td height='24' class='x23' style='height:18.45pt;'>AT+GMR</td>
<td colspan='2' class='x25' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'>查看版本信息</td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r4'>
<td height='24' class='x23' style='height:18.45pt;'>AT+GSLP</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3"></font><font class="font6"></font><font class="font7"></font><font class="font4">Deep-sleep </font><font class="font3">模式</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r5'>
<td height='24' class='x23' style='height:18.45pt;'>ATE</td>
<td colspan='2' class='x25' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'>开关回显功能</td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r6'>
<td height='24' class='x23' style='height:18.45pt;'>AT+RESTORE</td>
<td colspan='2' class='x25' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">恢复出</font><font class="font6"></font><font class="font7">厂设置</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r7'>
<td height='24' class='x23' style='height:18.45pt;'>AT+UART_CUR</td>
<td colspan='2' class='x26' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font4">UART </font><font class="font3">当前临时配置</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r8'>
<td height='24' class='x23' style='height:18.45pt;'>AT+UART_DEF</td>
<td colspan='2' class='x26' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font4">UART </font><font class="font3">默认配置,保存到 </font><font class="font4">Flash</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r9'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SLEEP</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">设置 </font><font class="font4">sleep </font><font class="font3">模式</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r10'>
<td height='24' class='x23' style='height:18.45pt;'>AT+WAKEUPGPIO</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">设置 </font><font class="font4">GPIO </font><font class="font3">唤醒 </font><font class="font4">Light-sleep </font><font class="font3">模式</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r11'>
<td height='24' class='x23' style='height:18.45pt;'>AT+RFPOWER</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">设置 </font><font class="font4">RF TX Power </font><font class="font3">上限</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r12'>
<td height='24' class='x23' style='height:18.45pt;'>AT+RFVDD</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">根据 </font><font class="font4">VDD33 </font><font class="font3">设置 </font><font class="font4">RF TX Power</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r13'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SYSRAM</td>
<td colspan='2' class='x25' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'>查询系统当前剩余内存</td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r14'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SYSADC</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">查询 </font><font class="font4">ADC </font><font class="font3"></font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r15'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SYSIOSETCFG</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">设置 </font><font class="font4">IO </font><font class="font3">⼯工作模式</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r16'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SYSIOGETCFG</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">查询 </font><font class="font4">IO </font><font class="font3">⼯工作模式</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r17'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SYSGPIODIR</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">设置 </font><font class="font4">GPIO </font><font class="font3">⼯工作为输⼊入或输出</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r18'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SYSGPIOWRITE</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">设置 </font><font class="font4">GPIO </font><font class="font3">的输出电平</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r19'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SYSGPIOREAD</td>
<td colspan='2' class='x24' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'><font class="font3">读取 </font><font class="font4">GPIO </font><font class="font3">的电平状态</font></td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r20'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SYSMSG_CUR</td>
<td colspan='2' class='x25' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'>设置当前系统消息</td>
</tr>
<tr height='26' style='mso-height-source:userset;height:19.95pt' id='r21'>
<td height='24' class='x23' style='height:18.45pt;'>AT+SYSMSG_DEF</td>
<td colspan='2' class='x25' style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;'>设置默认系统消息</td>
</tr>
</table>
</body>

View File

@ -0,0 +1,948 @@
# ethernet
<!--不放在这里会导致标题不等高-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="ProgId" content="Excel.Sheet">
<meta name="Generator" content="Aspose.Cell 18.4">
<link rel="File-List" href="092116125162_files/filelist.xml">
<link rel="Edit-Time-Data" href="092116125162_files/editdata.mso">
<link rel="OLE-Object-Data" href="092116125162_files/oledata.mso">
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{
mso-header-data:"";
mso-footer-data:"";
margin:0.75in 0.7in 0.75in 0.7in;
mso-header-margin:0.3in;
mso-footer-margin:0.3in;
mso-page-orientation:Portrait;
}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
ruby
{ruby-align:left;}
.style0
{
mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
border:none;
mso-protection:locked visible;
mso-style-name:Normal;
mso-style-id:0;}
.font0
{
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif"; }
.font1
{
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif"; }
.font2
{
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","sans-serif"; }
.font3
{
color:#000000;
font-size:9pt;
font-weight:400;
font-style:normal;
font-family:"等线","monospace"; }
.font4
{
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace"; }
td
{mso-style-parent:style0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
border:none;
mso-protection:locked visible;
mso-ignore:padding;}
.style0
{
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
mso-protection:locked visible;
mso-style-name:"Normal";
}
.style1
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style2
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style3
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style4
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style5
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style6
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style7
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style8
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style9
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style10
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style11
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style12
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style13
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.style14
{
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
}
.x15
{
mso-style-parent:style0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"等线","sans-serif";
mso-protection:locked visible;
}
.style16
{
mso-number-format:"0%";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Percent";
}
.style17
{
mso-number-format:"_ \0022¥\0022* \#\,\#\#0\.00_ \;_ \0022¥\0022* -\#\,\#\#0\.00_ \;_ \0022¥\0022* \0022-\0022??_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Currency";
}
.style18
{
mso-number-format:"_ \0022¥\0022* \#\,\#\#0_ \;_ \0022¥\0022* -\#\,\#\#0_ \;_ \0022¥\0022* \0022-\0022_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Currency [0]";
}
.style19
{
mso-number-format:"_ * \#\,\#\#0\.00_ \;_ * -\#\,\#\#0\.00_ \;_ * \0022-\0022??_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Comma";
}
.style20
{
mso-number-format:"_ * \#\,\#\#0_ \;_ * -\#\,\#\#0_ \;_ * \0022-\0022_ \;_ \@_ ";
text-align:general;
vertical-align:middle;
white-space:nowrap;
background:white;
mso-pattern:auto;
color:#000000;
font-size:10pt;
font-weight:400;
font-style:normal;
font-family:"Arial","sans-serif";
mso-protection:locked visible;
mso-style-name:"Comma [0]";
}
.x21
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#8DB3E1;
mso-pattern:auto none;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","sans-serif";
border-top:1px solid #4F81BC;
border-right:none;
border-bottom:none;
border-left:1px solid #4F81BC;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x22
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#8DB3E1;
mso-pattern:auto none;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","monospace";
border-top:1px solid #4F81BC;
border-right:none;
border-bottom:none;
border-left:none;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x23
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#8DB3E1;
mso-pattern:auto none;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","monospace";
border-top:1px solid #4F81BC;
border-right:none;
border-bottom:none;
border-left:none;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x24
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:#8DB3E1;
mso-pattern:auto none;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","monospace";
border-top:1px solid #4F81BC;
border-right:1px solid #4F81BC;
border-bottom:none;
border-left:none;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x25
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","monospace";
border-top:none;
border-right:none;
border-bottom:none;
border-left:1px solid #4F81BC;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x26
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","monospace";
border-top:none;
border-right:1px solid #4F81BC;
border-bottom:none;
border-left:none;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x27
{
mso-style-parent:style0;
mso-number-format:General;
text-align:left;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace";
border-top:none;
border-right:1px solid #4F81BC;
border-bottom:1px solid #4F81BC;
border-left:1px solid #4F81BC;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x28
{
mso-style-parent:style0;
mso-number-format:General;
text-align:left;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace";
border-top:1px solid #4F81BC;
border-right:1px solid #4F81BC;
border-bottom:1px solid #4F81BC;
border-left:1px solid #4F81BC;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x29
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","monospace";
border-top:none;
border-right:none;
border-bottom:1px solid #4F81BC;
border-left:1px solid #4F81BC;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x30
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","monospace";
border-top:none;
border-right:1px solid #4F81BC;
border-bottom:1px solid #4F81BC;
border-left:none;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x31
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","monospace";
border-top:1px solid #4F81BC;
border-right:none;
border-bottom:none;
border-left:1px solid #4F81BC;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x32
{
mso-style-parent:style0;
mso-number-format:General;
text-align:center;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:700;
font-style:normal;
font-family:"宋体","monospace";
border-top:1px solid #4F81BC;
border-right:1px solid #4F81BC;
border-bottom:none;
border-left:none;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x33
{
mso-style-parent:style0;
mso-number-format:General;
text-align:left;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace";
border-top:1px solid #4F81BC;
border-right:1px solid #4F81BC;
border-bottom:none;
border-left:1px solid #4F81BC;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
.x34
{
mso-style-parent:style0;
mso-number-format:General;
text-align:left;
vertical-align:middle;
white-space:normal;word-wrap:break-word;
background:white;
mso-pattern:auto;
color:#000000;
font-size:11pt;
font-weight:400;
font-style:normal;
font-family:"宋体","monospace";
border-top:none;
border-right:1px solid #4F81BC;
border-bottom:1px solid #4F81BC;
border-left:1px solid #4F81BC;
mso-diagonal-down:none;
mso-diagonal-up:none;
mso-protection:locked visible;
}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sheet1</x:Name>
<x:WorksheetOptions>
<x:StandardWidth>2304</x:StandardWidth>
<x:Print>
<x:ValidPrinterInfo/>
<x:PaperSizeIndex>9</x:PaperSizeIndex>
<x:HorizontalResolution>600</x:HorizontalResolution>
<x:VerticalResolution>600</x:VerticalResolution>
</x:Print>
<x:Selected/>
<x:TopRowVisible>6</x:TopRowVisible>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>12576</x:WindowHeight>
<x:WindowWidth>23256</x:WindowWidth>
<x:WindowTopX>-108</x:WindowTopX>
<x:WindowTopY>-108</x:WindowTopY>
<x:RefModeR1C1/>
<x:TabRatio>600</x:TabRatio>
<x:ActiveSheet>0</x:ActiveSheet>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
## 模块介绍
<el-divider></el-divider>
### USRK7
<div style="display: flex;justify-content: center;align-items: center;">
<img src = "./imagesrc/usr-k7.png" alt="usr-k7" width =50% max-width= 50% >
</br>
</div>
</br>
USR-K7 模块用于实现串口到以太网口的数据的双向透明传输,用户无需关心具体细节,模块内部完成协
议转换。串口侧是串口电平数据,以太网口侧是网络数据包,通过简单设置即可指定工作细节。参数可以通过
内置网页也可以通过设置软件进行设置,一次设置永久保存。</br>
#### 功能特点
+ ARM 内核,工业级温度范围,精心优化的 TCP/IP 协议栈,稳定可靠
+ 10/100Mbps 网口,支持 Auto-MDI/MDIX支持交叉直连网线自适应
+ 支持 TCP Server、TCP Client、UDP Client、UDP Server、Httpd Client 多种工作模式
+ 内置网页,可通过网页进行参数设置,也可为用户定制网页;并且内置网页端口可设置(默认 80
+ 支持 485 收发使能,串口可以作为 485 使用。
+ 支持 RTS/CTS 硬件流控功能,支持 Xon/Xoff 软件流控
+ 支持虚拟串口软件USR-VCOM
+ 串口波特率支持 600bps~1Mbps支持 None、Odd、Even、Mark、Space 五种校验方式
+ 支持 Modbus 网关功能,工业现场使用更加方便
+ 支持 Reload 按键,即硬件恢复出厂设置
+ RJ45 带 Link/Data 指示灯网口内置隔离变压器1.5KV 电磁隔离
+ 全球唯一 MAC 地址,也允许用户自定义临时 MAC 地址
+ 支持通过网络升级固件;支持域名服务器;支持 DHCP 自动获取 IP
+ 支持 keepalive 机制,可快速探查死连接等异常并快速重连
+ 支持账户跟密码,可用于网页登录以及网络设置,更安全
+ 支持一路 Websocket 功能,实现网页与串口的数据双向传输
#### 基本参数
<body link='blue' vlink='purple' >
<table border='0' cellpadding='0' cellspacing='0' width='815' style='border-collapse:
collapse;table-layout:fixed;width:611pt'>
<col width='72' style='width:54pt'>
<col width='201' style='mso-width-source:userset;width:150.75pt'>
<col width='244' style='mso-width-source:userset;width:183pt'>
<col width='298' style='mso-width-source:userset;width:223.5pt'>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r0'>
<td colspan='2' height='18' class='x21' width='273' style='height:13.65pt;'>分类 </td>
<td class='x23' width='244' style='width:183pt;'>参数 </td>
<td class='x24' width='298' style='width:223.5pt;'>数值 </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r1'>
<td colspan='2' rowspan='5' height='96' class='x25' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:72pt;'>硬件参数 </td>
<td class='x27'>工作电压 </td>
<td class='x27'>DC 3.03.6 V3.3V 最佳) </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r2'>
<td class='x28'>工作电流 </td>
<td class='x28'>130mA@3.3V </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r3'>
<td class='x28'>网口规格 </td>
<td class='x28'>RJ45、10/100Mbps、交叉直连自适应 </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r4'>
<td class='x28'>封装形式 </td>
<td class='x28'>插针式封装 </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r5'>
<td class='x28'>串口波特率 </td>
<td class='x28'>6001Mbps </td>
</tr>
<tr height='38' style='mso-height-source:userset;height:28.8pt' id='r6'>
<td colspan='2' rowspan='24' height='488' class='x31' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:366.45pt;'>软件参数<span style='mso-spacerun:yes;white-space:nowrap;'>&nbsp; </span></td>
<td class='x28'>网络协议 </td>
<td class='x28'>IP、TCP、UDP、DHCP、DNS、HTTP、ARP、ICMP、Web socket </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r7'>
<td class='x28'>IP 获取方式 </td>
<td class='x28'>静态 IP、DHCP </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r8'>
<td class='x28'>域名解析 </td>
<td class='x28'>支持 </td>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r9'>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>用户配置 </td>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>软件配置,网页配置,AT 指令配置 </td>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r10'>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r11'>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>简单透传方式 </td>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>TCP Server/TCP Client/UDP Server/UDP Client </td>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r12'>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r13'>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>Modbus </td>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>支持 Modbus 网关 </td>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r14'>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r15'>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>网页转串口 </td>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>支持 WebSocket 通信方式的网页转串口 </td>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r16'>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r17'>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>Httpd Client </td>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>支持 </td>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r18'>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r19'>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>类 RFC2217 </td>
<td rowspan='2' height='35' class='x33' style='border-right:1px solid #4F81BC;border-bottom:1px solid #4F81BC;height:26.85pt;'>支持 </td>
</tr>
<tr height='18' style='mso-height-source:userset;height:13.8pt' id='r20'>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r21'>
<td class='x28'>自定义网页 </td>
<td class='x28'>支持 </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r22'>
<td class='x28'>网络缓存 </td>
<td class='x28'>发送16Kbyte接收16Kbyte </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r23'>
<td class='x28'>串口缓存 </td>
<td class='x28'>发送2Kbyte接收2Kbyte </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r24'>
<td class='x28'>平均传输延时 </td>
<td class='x28'>局域网内&lt;10ms </td>
</tr>
<tr height='38' style='mso-height-source:userset;height:28.8pt' id='r25'>
<td class='x28'>配套软件 </td>
<td class='x28'>虚拟串口软件、透传云测试软件、参数设置软件 </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r26'>
<td class='x28'>认证 </td>
<td class='x28'>CE、FCC、ROHS </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r27'>
<td class='x28'>可靠等级 </td>
<td class='x28'>1.5KV 电磁隔离 </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r28'>
<td class='x28'>尺寸 </td>
<td class='x28'>35.0x19.39x18.25 mm(L*W*H) </td>
</tr>
<tr height='19' style='mso-height-source:userset;height:14.4pt' id='r29'>
<td class='x28'>工作温度 </td>
<td class='x28'>-4085℃ </td>
</tr>
<![if supportMisalignedColumns]>
<tr height='0' style='display:none'>
<td width='72' style='width:54pt'></td>
<td width='201' style='width:150.75pt'></td>
<td width='244' style='width:183pt'></td>
<td width='298' style='width:223.5pt'></td>
</tr>
<![endif]>
</table>
<script language = 'javascript' type='text/javascript'>
function ChangeRowspanHiddenData()
{
var node;
var params=["r1","r6","r9","r11","r13","r15","r17","r19"];
for (var i = 0;i < params.length; i++)
{
node = document.getElementById(params[i]);
if (node != null)
{
node.style.display = "";
}
}
}
ChangeRowspanHiddenData();
</script>
</body>
## 模块配置和代码树
<el-divider></el-divider>
对于ethernet 模块默认配置就可以测试可能需要修改的是UART设备的名字</br>
[\*] Enable Ethernet ---></br>
&ensp;&ensp;&ensp;&ensp;--- Enable Ethernet</br>
&ensp;&ensp;&ensp;&ensp;[\*] USR IOT USRK7</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[ ] Enable initialize by thread</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;[\*] Enable sample ---> (是否编译测试例程)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(-1) Power pin ---> (电源引脚配置,与电路板相关,模块测试无需修改)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(-1) Power status pin ---> (电源状态引脚配置,与电路板相关,模块测试无需修改)</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(uart3) AT client device name ---> 模块连接的UART名字取决于模块和主板的连接方式</br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;(1024) The maximum length of receive line buffer ---> 缓存大小建议在1K以上</br>
<div>
<img src = "./imagesrc/usr-k7_CodeTree.png" alt="usr-k7_CodeTree" width =300 >
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -0,0 +1,31 @@
# mymqtt
## Mqtt简介
<el-divider></el-divider>
MQTTMessage Queuing Telemetry Transport消息队列遥测传输协议是一种基于发布/订阅publish/subscribe模式的"轻量级"通讯协议该协议构建于TCP/IP协议上由IBM在1999年发布。MQTT最大优点在于可以以极少的代码和有限的带宽为连接远程设备提供实时可靠的消息服务。作为一种低开销、低带宽占用的即时通讯协议使其在物联网、小型设备、移动应用等方面有较广泛的应用。</br></br>
MQTT是一个基于客户端-服务器的消息发布/订阅传输协议。MQTT协议是轻量、简单、开放和易于实现的这些特点使它适用范围非常广泛。在很多情况下包括受限的环境中机器与机器M2M通信和物联网IoT。其在通过卫星链路通信传感器、偶尔拨号的医疗设备、智能家居、及一些小型化设备中已广泛使用。</br></br>
## 主要特性
<el-divider></el-divider>
MQTT协议工作在低带宽、不可靠的网络的远程传感器和控制设备通讯而设计的协议它具有以下主要的几项特性
+ 1使用发布/订阅消息模式,提供一对多的消息发布,解除应用程序耦合。</br>
这一点很类似于XMPP但是MQTT的信息冗余远小于XMPP,因为XMPP使用XML格式文本来传递数据。
+ 2对负载内容屏蔽的消息传输。
+ 3使用TCP/IP提供网络连接。</br>
主流的MQTT是基于TCP连接进行数据推送的但是同样有基于UDP的版本叫做MQTT-SN。这两种版本由于基于不同的连接方式优缺点自然也就各有不同了。
+ 4有三种消息发布服务质量</br>
"至多一次"消息发布完全依赖底层TCP/IP网络。会发生消息丢失或重复。这一级别可用于如下情况环境传感器数据丢失一次读记录无所谓因为不久后还会有第二次发送。这一种方式主要普通APP的推送倘若你的智能设备在消息推送时未联网推送过去没收到再次联网也就收不到了。</br>
"至少一次",确保消息到达,但消息重复可能会发生。</br>
"只有一次"确保消息到达一次。在一些要求比较严格的计费系统中可以使用此级别。在计费系统中消息重复或丢失会导致不正确的结果。这种最高质量的消息发布服务还可以用于即时通讯类的APP的推送确保用户收到且只会收到一次。
+ 5小型传输开销很小固定长度的头部是2字节协议交换最小化以降低网络流量。</br>
这就是为什么在介绍里说它非常适合"在物联网领域,传感器与服务器的通信,信息的收集",要知道嵌入式设备的运算能力和带宽都相对薄弱,使用这种协议来传递消息再适合不过了。
+ 6使用Last Will和Testament特性通知有关各方客户端异常中断的机制。</br>
Last Will即遗言机制用于通知同一主题下的其他设备发送遗言的设备已经断开了连接。
Testament遗嘱机制功能类似于Last Will。

View File

@ -0,0 +1 @@
# rs485

110
docs/doc/constructenv/bianyi.md Executable file
View File

@ -0,0 +1,110 @@
# 编译环境
## 前言
<el-divider></el-divider>
<p style="text-indent:2em">本文档将介绍如何在个人pc设备上构建编译环境来编译 <B>XiUOS</B>
操作系统, 需要注意的是, 目前 <B>XiUOS</B> 暂时只支持在Linux系统上编译。</p>
## 硬件安装
<el-divider></el-divider>
> * 硬件要求
>> 64位系统磁盘空间大于40G。
> * linux内核下载
>> 因为<B>XiUOS</B>是在Ubuntu 16.04上开发与测试的(Ubuntu 18.04、20.04版本也支持因此我们推荐您使用Ubuntu 16.04版本的系统执行编译环境搭建。
> * Ubuntu下载网址
>> [here](https://ubuntu.com/download/desktop)
## 依赖包安装
<el-divider></el-divider>
$ sudo apt-get install gcc
$ sudo apt-get install make
$ sudo apt-get install libncurses5-dev
$ sudo apt-get install openssl
$ sudo apt-get install libssl-dev
$ sudo apt-get install build-essential
$ sudo apt-get install pkg-config
$ sudo apt-get install libc6-dev
$ sudo apt-get install bison
$ sudo apt-get install flex
$ sudo apt-get install libelf-dev
$ sudo apt-get install autoconf
$ sudo apt-get install libtool
$ sudo apt-get install gpref
## 源码下载
<el-divider></el-divider>
> * 简要介绍
>> <B>XiUOS</B>的源码和相关文档介绍使用git进行集成管理建议开发者使用git工具进行版本控制和分支管理
> * git配置
$ git config --global user.name "your name"
$ git config --global user.email "your email"
> * [XiUOS源码网址](https://ubuntu.com/download/desktop)
## 工具链
<el-divider></el-divider>
> * ARM下编译需要安装<B>arm-none-eabi</B>编译工具, 安装到Ubuntu的默认路径/usr/bin/arm-none-eabi-
>> 1. 命令行下载
>>> $ sudo apt-get install gcc-arm-none-eabi
>> 2. 源码下载
>>> [ARM官网下载](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
> * RISC-V下编译需要安装<B>riscv-none-embed-</B>编译工具, 安装到Ubuntu的默认路径/opt/
>> [下载网址](https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/), 根据需求选择不同的版本
>> 操作方法以xpack-riscv-none-embed-gcc-linux-x64.tar.gz为例
>>> $ tar -zxvf xpack-riscv-none-embed-gcc-linux-x64.tar.gz -C /opt/
## 烧写工具
> * ARM下烧写软件ST-LINK
>> 下载源码
git clone https://github.com/texane/stlink.git
> * RISC-V下烧写软件KFLASH
$ sudo pip3 install kflash
// 如果在安装工具失败,则执行一下命令
$ sudo python -m pip install kflash
$ sudo python3 -m pip install kflash
$ sudo pip install kflash
$ sudo pip2 install kflash
## FAQ
<el-collapse v-model="activeName" accordion>
<el-collapse-item title="Question 1: XiUOS源码下载起来特别慢怎么办" name="1">
> 尝试借助gitee下载源码
</el-collapse-item>
<el-collapse-item title="Question 2: 编程过程是xxx错误" name="2">
> * Operation feedback: enable the users to clearly perceive their operations by style updates and interactive effects;
> * Visual feedback: reflect current state by updating or rearranging elements of the page.
</el-collapse-item>
<el-collapse-item title="Question 3" name="3">
> * Simplify the process: keep operating process simple and intuitive;
> * Definite and clear: enunciate your intentions clearly so that the users can quickly understand and make decisions;
> * Easy to identify: the interface should be straightforward, which helps the users to identify and frees them from memorizing and recalling.
</el-collapse-item>
<el-collapse-item title="Question 4" name="4">
> * Decision making: giving advices about operations is acceptable, but do not make decisions for the users;
> * Controlled consequences: users should be granted the freedom to operate, including canceling, aborting or terminating current operation.
</el-collapse-item>
</el-collapse>
<script>
export default {
data() {
return {
activeName: '1'
};
}
}
</script>

115
docs/doc/constructenv/debug.md Executable file
View File

@ -0,0 +1,115 @@
# 编译步骤
## 前言
本文档将介绍<B>XiUOS</B>使用jlink软件的配置、调试过程。
## 软件安装
+ jlink包安装
第一步进入jlink官网[下载网址](https://www.segger.com/downloads/jlink)
<div class="imgbox">
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/jlink_package_1.png" />
</div>
第二步选择版本并下载安装包此处下载的安装包版本为V6.72e即JLink_Linux_V672e_x86_64.deb。
<div class="imgbox">
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/jlink_package_2.png" />
</div>
第三步安装JLink_Linux_V672e_x86_64.deb
$ dpkg -i JLink_Linux_V672e_x86_64.deb
+ openocd安装
第一步,进入[下载网址](https://github.com/kendryte/openocd-kendryte/releases)
下载Unbuntu版本的openocd。<B>XiUOS</B>中下载的kendryte-openocd-0.2.3-ubuntu64.tar.gz
第二步安装openocd
$ sudo mv kendryte-openocd-0.2.2-ubuntu64.tar.gz /opt
$ cd /opt
$ sudo tar -zxvf kendryte-openocd-0.2.2-ubuntu64.tar.gz
<template>
<el-alert
title="注安装openocd之前需要先安装如下依赖包"
type="info"
show-icon>
</el-alert>
</template>
$ sudo apt install libusb-dev libftdi-dev libhidapi-dev
第三步openocd文件配置
打开配置文件,修改第三行 jlink serial 504503073的504503073为具体JLINK设备的标签。
$ cd /opt/kendryte-openocd
$ vim ctl/openocd.cfg
<div class="openocd_cfg">
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/openocd_cfg.png" height="500" width="1200"/>
</div>
第四步打开openocd软件
$ cd /opt/kendryte-openocd
$ ./bin/openocd -f ./ctl/openocd.cfg
成功运行则显示如下的界面。
<div>
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/open_openocd.png"/>
</div>
## 调试程序
$ riscv-none-embed-gdb XiaoShan_kd233.elf --eval-command="target remote 127.0.0.1:3333"
运行上述命令,其中,
+ XiaoShan_kd233.elf是编译过程生成的elf文件
+ 127.0.0.1表示本地IP地址也可以制定远程地址
+ 3333是openocd监听的端口号
成功连接openocd之后界面如下所示之后就可以使用load\break\continue等gdb命令进行调试了。
<div>
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/openocd_gdb.png"/>
</div>
## FAQ
<el-collapse v-model="activeName" accordion>
<el-collapse-item title="Question 1: openocd打开提示 No J-Link device found错误。" name="1">
> 重新连接JLINK设备。
</el-collapse-item>
<el-collapse-item title="Question 2: 编程过程是xxx错误" name="2">
> * Operation feedback: enable the users to clearly perceive their operations by style updates and interactive effects;
> * Visual feedback: reflect current state by updating or rearranging elements of the page.
</el-collapse-item>
</el-collapse>
<script>
export default {
data() {
return {
activeName: '1'
};
}
}
</script>
<style>
.openocd_cfg{
width: 1500px;
height: 400px;
vertical-align: middle;
display: table-cell;
text-align: center;
}
</style>

View File

@ -0,0 +1,94 @@
# 编译步骤
## 前言
<el-divider></el-divider>
<p style="text-indent:2em">本文档将介绍<B>XiUOS</B>分别在基于ARM和RISC-V架构的开发板上的编译、烧录和运行的过程。包括开发板选择及配置初始化、编译命令等信息。
</p>
## 开发板的选择及配置初始化
<el-divider></el-divider>
<p style="text-indent:2em">在执行编译之前,我们需要先确定<B>XiUOS</B>系统要运行在哪个开发板上,然后针对具体的开发板设置相关的配置信息。</p>
+ 开发板的选择
为了查看<B>XiUOS</B>支持的开发板种类,可以执行以下命令,也可以[查看支持的开发板](/hardwaresupport/arm32/stm32f407-st-discovery.html)。
$ make BOARD=list
+ 配置初始化
+ 以stm32f407-st-discovery为例进行开始系统参数。
$ make BOARD=stm32f407-st-discovery menuconfig
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/stm32_menuconfig.png" />
对应的配置信息将存放在board/stm32f407-st-discovery/xsconfig.h头文件中文件中的选项均以<B>XS_</B>为前缀开头。
+ 以kd233为例进行开始系统参数。
$ make BOARD=KD233 menuconfig
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/kd233_menuconfig.png" />
对应的配置信息将存放在board/kd233/xsconfig.h头文件中文件中的选项均以<B>XS_</B>为前缀开头。
## 编译命令
通用编译命令, 默认为BOARD=KD233
$ make [BOARD=<所选开发板>]
+ 当 make 命令被执行时它会扫描当前目录下Makefile或makefile文件找到目标以及其依赖。如果这些依赖自身也是目标继续为这些依赖扫描Makefile 建立其依赖关系,然后编译它们。
+ 创建build目录目录下包含了各种目标文件、.bin、.elf等文件
+ 目标文件,以.o结尾的文件
+ .bin 二进制文件
+ .elf 可执行文件
## 烧录命令
+ 基于ARM开发板的烧录命令
$ sudo st-flash write <生成的.elf文件> 0x8000000
+ 基于RISC-V开发板的烧录命令
$ sudo kflash <生成的.elf文件> -t
## 运行界面
+ <B>XiUOS</B>运行在ARM开发板
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/stm32_run_gui.png" />
+ <B>XiUOS</B>运行在RISC-V开发板
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/riscv_run_gui.png" />
## FAQ
<el-collapse v-model="activeName" accordion>
<el-collapse-item title="Question 1: XiUOS源码下载起来特别慢怎么办" name="1">
> 尝试借助gitee下载源码
</el-collapse-item>
<el-collapse-item title="Question 2: 编程过程是xxx错误" name="2">
> * Operation feedback: enable the users to clearly perceive their operations by style updates and interactive effects;
> * Visual feedback: reflect current state by updating or rearranging elements of the page.
</el-collapse-item>
<el-collapse-item title="Question 3" name="3">
> * Simplify the process: keep operating process simple and intuitive;
> * Definite and clear: enunciate your intentions clearly so that the users can quickly understand and make decisions;
> * Easy to identify: the interface should be straightforward, which helps the users to identify and frees them from memorizing and recalling.
</el-collapse-item>
<el-collapse-item title="Question 4" name="4">
> * Decision making: giving advices about operations is acceptable, but do not make decisions for the users;
> * Controlled consequences: users should be granted the freedom to operate, including canceling, aborting or terminating current operation.
</el-collapse-item>
</el-collapse>
<script>
export default {
data() {
return {
activeName: '1'
};
}
}
</script>

View File

@ -0,0 +1,8 @@
# aiit-arm32
## 综述
<div class ="tablebox_aiit_arm32">
<img src="" alt="aiit-arm32"/>
<p>AIIT-ARM32</p>
<el-divider></el-divider>
<span>XiUOS最新分支支持aiit-arm32开发板该开发板作为一种标准的板子支持各种上层组件和应用程序。</span>
</div>

View File

@ -0,0 +1,59 @@
# aiit-arm64
## 综述
<div class ="tablebox_aiit-arm64">
<div class="imgbox">
<img src="" alt="aiit-arm64"/>
</div>
<p>AIIT-ARM64</p>
<el-divider></el-divider>
<span>XiUOS最新分支支持stm32f407-st-discovery开发板该开发板作为一种标准的板子支持各种上层组件和应用程序。</span>
</div>
## 硬件特点
+ Core: Arm® 32-bit Cortex®-M4 CPU with FPU, Adaptive real-time accelerator (ART Accelerator) allowing 0-wait state execution from Flash memory, frequency up to 168 MHz, memory protection unit, 210 DMIPS/1.25 DMIPS/MHz (Dhrystone 2.1), and DSP instructions
+ Memories
<p style="text-indent:2em">1. Up to 1 Mbyte of Flash memory</p>
<p style="text-indent:2em">2. Up to 192+4 Kbytes of SRAM including 64-Kbyte of CCM (core coupled memory) data RAM </p>
<p style="text-indent:2em">3. Up to 192+4 Kbytes of SRAM including 64-Kbyte of CCM (core coupled memory) data RAM</p>
<p style="text-indent:2em">4. 512 bytes of OTP memory</p>
<p style="text-indent:2em">5. Flexible static memory controller supporting Compact Flash, SRAM, PSRAM, NOR and NAND memories</p>
+ LCD parallel interface, 8080/6800 modes
+ Clock, reset and supply management
<p style="text-indent:2em">1. 1.8 V to 3.6 V application supply and I/Os</p>
<p style="text-indent:2em">2. POR, PDR, PVD and BOR</p>
<p style="text-indent:2em">3. 4-to-26 MHz crystal oscillator </p>
<p style="text-indent:2em">4. Internal 16 MHz factory-trimmed RC (1% accuracy)</p>
<p style="text-indent:2em">5. 32 kHz oscillator for RTC with calibration</p>
<p style="text-indent:2em">6. Internal 32 kHz RC with calibration </p>
+ Low-power operation
<p style="text-indent:2em">1. Sleep, Stop and Standby modes </p>
<p style="text-indent:2em">2. V<sub>BAT</sub> supply for RTC, 20×32 bit backup registers + optional 4 KB backup SRAM </p>
+ 3×12-bit, 2.4 MSPS A/D converters: up to 24 channels and 7.2 MSPS in triple interleaved mode
+ 2×12-bit D/A converters
+ General-purpose DMA: 16-stream DMA controller with FIFOs and burst support
+ Up to 17 timers: up to twelve 16-bit and two 32-bit timers up to 168 MHz, each with up to 4 IC/OC/PWM or pulse counter and quadrature (incremental) encoder input
+ Debug mode
<p style="text-indent:2em">1. Serial wire debug (SWD) & JTAG interfaces </p>
<p style="text-indent:2em">2. Cortex-M4 Embedded Trace Macrocell™ </p>
+ Up to 140 I/O ports with interrupt capability
<p style="text-indent:2em">1. Up to 136 fast I/Os up to 84 MHz </p>
<p style="text-indent:2em">2. Up to 138 5 V-tolerant I/Os </p>
+ Up to 15 communication interfaces
<p style="text-indent:2em">1. Up to 3 × I<sup>2</sup>C interfaces (SMBus/PMBus) </p>
<p style="text-indent:2em">2. Up to 4 USARTs/2 UARTs (10.5 Mbit/s, ISO 7816 interface, LIN, IrDA, modem control) </p>
<p style="text-indent:2em">3. Up to 3 SPIs (42 Mbits/s), 2 with muxed full-duplex I2S to achieve audio class accuracy via internal audio PLL or external clock </p>
<p style="text-indent:2em">4. 2 × CAN interfaces (2.0B Active) </p>
<p style="text-indent:2em">5. SDIO interface </p>
+ Advanced connectivity
<p style="text-indent:2em">1. USB 2.0 full-speed device/host/OTG controller with on-chip PHY </p>
<p style="text-indent:2em">2. USB 2.0 high-speed/full-speed device/host/OTG controller with dedicated DMA, on-chip full-speed PHY and ULPI</p>
<p style="text-indent:2em">3. 10/100 Ethernet MAC with dedicated DMA: supports IEEE 1588v2 hardware, MII/RMII </p>
+ 8- to 14-bit parallel camera interface up to 54 Mbytes/s
+ True random number generator
+ CRC calculation unit
+ 96-bit unique ID
+ RTC: subsecond accuracy, hardware calendar
## 支持的功能

View File

@ -0,0 +1,46 @@
# RISC-V HIFIVE1-REV-B
## 综述
<div class ="tablebox_hifive">
<div class="hifive1-rev-b-box">
<img src="https://images.prismic.io/sifive/ddef5160-1769-4d8a-9332-99729088aff6_hifive-rev-b-home-page-new.jpg" alt="hifive1-rev-b"/>
</div>
<center>HIFIVE1-REV-B</center>
<el-divider></el-divider>
<span>XiUOS最新分支支持IFIVE1-REV-B开发板该开发板作为一种标准的板子支持各种上层组件和应用程序。</span>
</div>
## 硬件特点
+ Microcontroller: FE310-G002
+ Operating Voltage: 3.3 V and 1.8 V
+ Input Voltage: 5 V USB or 7-12 VDC Jack
+ IO Voltage: 3.3 V
+ Digital I/O Pins: 19
+ PWM Pins: 9
+ SPI Controllers/HW CS Pins: 1/3
+ UART: 2
+ I<sup>2</sup>C: 1
+ Networking: WiFi/BT (off-chip)
+ External Interrupt Pins: 19
+ External Wakeup Pins: 1
+ Flash Memory: 32 Mbit Off-Chip (ISSI SPI Flash)
+ Host Interface (microUSB): Program, Debug, and Serial Communication
+ Debug: Segger J-Link, drag/drop code download
+ Weight: 22 g
### 更多信息[查看网址](https://www.sifive.com/boards/hifive1-rev-b)
## 支持的功能
## 编程与调试
针对<u>**HIFIVE1-REV-B**</u>开发板的配置和刷新信息,详见[开发环境构建](/environment/debug.html)
<style>
.hifive1-rev-b-box{
width: 1500px;
height: 400px;
vertical-align: middle;
display: table-cell;
text-align: center;
}
</style>

View File

@ -0,0 +1,55 @@
# RISC-V KD233
## 综述
<div class ="tablebox">
<div class="imgbox">
<img src="" alt="kd233"/>
</div>
<p>KD233</p>
<el-divider></el-divider>
<span>XiUOS最新分支支持KD233开发板该开发板作为一种标准的板子支持各种上层组件和应用程序。</span>
</div>
## 硬件特点
+ 性能
+ 中央处理器RISC-V Dual Core 64bit, with FPU
+ 图像识别QVGA@60fps/VG@30fps
+ 语音识别:麦克风阵列(8 mics)
+ 安全
+ 高级加密硬件加速器(AES)
+ 一次性只读存储器(OTP)SHA256
+ 功耗
+ 典型应用场景功耗 < 1W
+ 芯片功耗 < 300mW
+ 扩展性
+ 操作系统FreeRTOS
+ 网络模型TinyYOLOv2(after pruned)
+ 深度学习框架TensorFlow/Keras/Darknet
+ 外设FPIOA、UART、GPIO、SPI、I<sup>2</sup>C、I<sup>2</sup>S、WDT、TIMER、RTC等等
### 更多信息
+ [KD233](https://canaan-creative.com/product/kendryteai)
## 支持的功能
| 名称 | 控制器 | 驱动描述 |
| ---- | ---- | ---- |
| <center>AUDIO</center> | on-chip | audio音频控制 |
| <center>CAMERA</center> | on-chip | camera驱动控制 |
| <center>DMA</center> | on-chip | dma驱动控制 |
| <center>FFT</center> | on-chip | 快速傅里叶变换 |
| <center>GPIO</center> | on-chip | gpio 输入输出控制 |
| <center>I<sup>2</sup>C</center> | on-chip | i<sup>2</sup>c总线 |
| <center>I<sup>2</sup>S</center> | on-chip | i<sup>2</sup>s总线 |
| <center>KPU</center> | on-chip | kpu计算架构 |
| <center>LCD</center> | on-chip | lcd 液晶显示器控制 |
| <center>PLIC</center> | on-chip | 中断控制 |
| <center>PWM</center> | on-chip | pwm驱动控制 |
| <center>RTC</center> | on-chip | rtc实时时钟驱动控制 |
| <center>SECURITY</center> | on-chip | 安全 |
| <center>SPI</center> | on-chip | spi总线驱动控制 |
| <center>SYS_CLOCK</center> | on-chip | 系统时钟控制 |
| <center>TIMER</center> | on-chip | timer重置和计时控制 |
| <center>UART</center> | on-chip | uart串口驱动控制 |
| <center>VIDEO</center> | on-chip | video视频控制器驱动 |
| <center>WATCHDOG</center> | on-chip | watchdog看门狗控制 |
## 编程与调试
针对<u>**KD233**</u>开发板的配置和刷新信息,详见[开发环境构建](/environment/bianyi.html)

View File

@ -0,0 +1,46 @@
# RISC-V MAXGO
## 综述
<div class ="tablebox_maxgo">
<div class="imgbox">
<img src="" alt="maxgo"/>
</div>
<p>MAXGO</p>
<el-divider></el-divider>
<span>XiUOS最新分支支持MAXGO开发板该开发板作为一种标准的板子支持各种上层组件和应用程序。</span>
</div>
## 硬件特点
+ 性能
+ 中央处理器RISC-V Dual Core 64bit, with FPU
+ 图像识别QVGA@60fps/VG@30fps
+ 语音识别:麦克风阵列(8 mics)
+ 安全
+ 高级加密硬件加速器(AES)
+ 一次性只读存储器(OTP)SHA256
+ 功耗
+ 典型应用场景功耗 < 1W
+ 芯片功耗 < 300mW
+ 扩展性
+ 操作系统FreeRTOS
+ 网络模型TinyYOLOv2(after pruned)
+ 深度学习框架TensorFlow/Keras/Darknet
+ 外设FPIOA、UART、GPIO、SPI、I<sup>2</sup>C、I<sup>2</sup>S、WDT、TIMER、RTC等等
### 更多信息
+ [KD233](https://canaan-creative.com/product/kendryteai)
## 支持的功能
| 名称 | 控制器 | 驱动描述 |
| ---- | ---- | ---- |
| <center>CAMERA</center> | on-chip | camera驱动控制 |
| <center>DMA</center> | on-chip | dma驱动控制 |
| <center>GPIO</center> | on-chip | gpio 输入输出控制 |
| <center>I<sup>2</sup>C</center> | on-chip | i<sup>2</sup>c总线 |
| <center>I<sup>2</sup>S</center> | on-chip | i<sup>2</sup>s总线 |
| <center>LCD</center> | on-chip | lcd 液晶显示器控制 |
| <center>PLIC</center> | on-chip | 中断控制 |
| <center>SPI</center> | on-chip | spi总线驱动控制 |
| <center>SYS_CLOCK</center> | on-chip | 系统时钟控制 |
| <center>UART</center> | on-chip | uart串口驱动控制 |
## 编程与调试
针对<u>**MAXGO**</u>开发板的配置和刷新信息,详见[开发环境构建](/environment/bianyi.html)

View File

@ -0,0 +1,63 @@
# stm32f407-st-discovery
## 综述
<div class ="tablebox">
<div class="imgbox">
<img src="https://www.st.com/bin/ecommerce/api/image.PF252419.en.feature-description-include-personalized-no-cpn-large.jpg" />
</div>
<p>STM32F4DISCOVERY</p>
<el-divider></el-divider>
<span>XiUOS最新分支支持stm32f407-st-discovery开发板该开发板作为一种标准的板子支持各种上层组件和应用程序。</span>
</div>
## 硬件特点
+ STM32F407VGT6 microcontroller featuring 32-bit ARM®Cortex®-M4 with FPU core, 1-Mbyte Flash memory, 192-Kbyte RAM in an LQFP100 package
+ On-board ST-LINK/V2 on STM32F4DISCOVERY (old reference) or ST-LINK/V2-A on STM32F407G-DISC1 (new order code)
+ USB ST-LINK with re-enumeration capability and three different interfaces:
<p style="text-indent:2em">1. Debug port</p>
<p style="text-indent:2em">2. Virtual Com port (with new order code only) </p>
<p style="text-indent:2em">3. Mass storage (with new order code only) </p>
+ Board power supply: through USB bus or from an external 5 V supply voltage
+ External application power supply: 3 V and 5 V
+ LIS302DL or LIS3DSH ST MEMS 3-axis accelerometer
+ MP45DT02 ST-MEMS audio sensor omni-directional digital microcontroller
+ CS43L22 audio DAC with integrated class D speaker driver
+ Eight LEDs:
<p style="text-indent:2em">1. LD1 (red/green) for USB communication</p>
<p style="text-indent:2em">2. LD2 (red) for 3.3 V power on </p>
<p style="text-indent:2em">3. Four user LEDs, LD3 (orange), LD4 (green), LD5 (red) and LD6 (blue) </p>
<p style="text-indent:2em">4. USB OTG LEDs LD7 (green) VBUS and LD8 (red) over-current </p>
+ Two push-buttons (user and reset)
+ USB OTG FS with micro-AB connector
+ Extension header for all LQFP100 I/Os for quick connection to prototyping board and easy probing
+ Comprehensive free software including a variety of examples, part of STM32CubeF4 package or STSW-STM32068 to use legacy standard libraries.
### 更多信息
+ [STM32F4DISCOVERY](https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-discovery-kits/stm32f4discovery.html#)
## 支持的功能
| 名称 | 控制器 | 驱动描述 |
| ---- | ---- | ---- |
| <center>DMA</center> | on-chip | DMA驱动控制 |
| <center>GPIO</center> | on-chip | gpio 输入输出控制 |
| <center>I2C</center> | on-chip | i2c 控制 |
| <center>LCD</center> | on-chip | lcd 液晶显示器控制 |
| <center>RTC</center> | on-chip | rtc 实时始终控制 |
| <center>SPI</center> | on-chip | spi 总线系统控制 |
| <center>TIMER</center> | on-chip | timer重置和计时控制 |
| <center>UART</center> | on-chip | uart串口驱动控制 |
| <center>USB</center> | on-chip | usb驱动控制 |
| <center>WATCHDOG</center> | on-chip | watchdog看门口控制 |
## 编程与调试
针对<u>**stm32f407-st-discovery**</u>开发板的配置和刷新信息,详见[开发环境构建](/environment/bianyi.html)
<style>
.tablebox{
width: 1500px;
height: 400px;
vertical-align: middle;
display: table-cell;
text-align: center;
}
</style>

View File

@ -0,0 +1,85 @@
# stm32f407zgt6
## 综述
<div class ="tablebox1">
<img src="https://raw.githubusercontent.com/yanyannew/images/branch/stm32f407zgt6.png"/>
<p>STM32F407ZET6</p>
<el-divider></el-divider>
<span>XiUOS最新分支支持stm32f407zgt6开发板该开发板作为一种标准的板子支持各种上层组件和应用程序。</span>
</div>
## 硬件特点
+ Core: Arm® 32-bit Cortex®-M4 CPU with FPU, Adaptive real-time accelerator (ART Accelerator) allowing 0-wait state execution from Flash memory, frequency up to 168 MHz, memory protection unit, 210 DMIPS/1.25 DMIPS/MHz (Dhrystone 2.1), and DSP instructions
+ Memories
<p style="text-indent:2em">1. Up to 1 Mbyte of Flash memory</p>
<p style="text-indent:2em">2. Up to 192+4 Kbytes of SRAM including 64-Kbyte of CCM (core coupled memory) data RAM </p>
<p style="text-indent:2em">3. Up to 192+4 Kbytes of SRAM including 64-Kbyte of CCM (core coupled memory) data RAM</p>
<p style="text-indent:2em">4. 512 bytes of OTP memory</p>
<p style="text-indent:2em">5. Flexible static memory controller supporting Compact Flash, SRAM, PSRAM, NOR and NAND memories</p>
+ LCD parallel interface, 8080/6800 modes
+ Clock, reset and supply management
<p style="text-indent:2em">1. 1.8 V to 3.6 V application supply and I/Os</p>
<p style="text-indent:2em">2. POR, PDR, PVD and BOR</p>
<p style="text-indent:2em">3. 4-to-26 MHz crystal oscillator </p>
<p style="text-indent:2em">4. Internal 16 MHz factory-trimmed RC (1% accuracy)</p>
<p style="text-indent:2em">5. 32 kHz oscillator for RTC with calibration</p>
<p style="text-indent:2em">6. Internal 32 kHz RC with calibration </p>
+ Low-power operation
<p style="text-indent:2em">1. Sleep, Stop and Standby modes </p>
<p style="text-indent:2em">2. V<sub>BAT</sub> supply for RTC, 20×32 bit backup registers + optional 4 KB backup SRAM </p>
+ 3×12-bit, 2.4 MSPS A/D converters: up to 24 channels and 7.2 MSPS in triple interleaved mode
+ 2×12-bit D/A converters
+ General-purpose DMA: 16-stream DMA controller with FIFOs and burst support
+ Up to 17 timers: up to twelve 16-bit and two 32-bit timers up to 168 MHz, each with up to 4 IC/OC/PWM or pulse counter and quadrature (incremental) encoder input
+ Debug mode
<p style="text-indent:2em">1. Serial wire debug (SWD) & JTAG interfaces </p>
<p style="text-indent:2em">2. Cortex-M4 Embedded Trace Macrocell™ </p>
+ Up to 140 I/O ports with interrupt capability
<p style="text-indent:2em">1. Up to 136 fast I/Os up to 84 MHz </p>
<p style="text-indent:2em">2. Up to 138 5 V-tolerant I/Os </p>
+ Up to 15 communication interfaces
<p style="text-indent:2em">1. Up to 3 × I<sup>2</sup>C interfaces (SMBus/PMBus) </p>
<p style="text-indent:2em">2. Up to 4 USARTs/2 UARTs (10.5 Mbit/s, ISO 7816 interface, LIN, IrDA, modem control) </p>
<p style="text-indent:2em">3. Up to 3 SPIs (42 Mbits/s), 2 with muxed full-duplex I2S to achieve audio class accuracy via internal audio PLL or external clock </p>
<p style="text-indent:2em">4. 2 × CAN interfaces (2.0B Active) </p>
<p style="text-indent:2em">5. SDIO interface </p>
+ Advanced connectivity
<p style="text-indent:2em">1. USB 2.0 full-speed device/host/OTG controller with on-chip PHY </p>
<p style="text-indent:2em">2. USB 2.0 high-speed/full-speed device/host/OTG controller with dedicated DMA, on-chip full-speed PHY and ULPI</p>
<p style="text-indent:2em">3. 10/100 Ethernet MAC with dedicated DMA: supports IEEE 1588v2 hardware, MII/RMII </p>
+ 8- to 14-bit parallel camera interface up to 54 Mbytes/s
+ True random number generator
+ CRC calculation unit
+ 96-bit unique ID
+ RTC: subsecond accuracy, hardware calendar
### 更多信息
+ [STM32F407ZET6](https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-high-performance-mcus/stm32f4-series/stm32f407-417/stm32f407ze.html)
## 支持的功能
| 名称 | 控制器 | 驱动描述 |
| ---- | ---- | ---- |
| <center>DMA</center> | on-chip | DMA驱动控制 |
| <center>GPIO</center> | on-chip | gpio 输入输出控制 |
| <center>I2C</center> | on-chip | i2c 控制 |
| <center>LCD</center> | on-chip | lcd 液晶显示器控制 |
| <center>RTC</center> | on-chip | rtc 实时始终控制 |
| <center>SPI</center> | on-chip | spi 总线系统控制 |
| <center>TIMER</center> | on-chip | timer重置和计时控制 |
| <center>UART</center> | on-chip | uart串口驱动控制 |
| <center>USB</center> | on-chip | usb驱动控制 |
| <center>WATCHDOG</center> | on-chip | watchdog看门口控制 |
## 编程与调试
针对<u>**stm32f407zet6**</u>开发板的配置和刷新信息,详见[开发环境构建](/environment/bianyi.html)
<style>
.tablebox1{
width: 1000px;
height: 300px;
vertical-align: middle;
display: table-cell;
text-align: center;
}
</style>

View File

@ -1 +0,0 @@
# 内核

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

379
docs/doc/kernel/mm.md Normal file
View File

@ -0,0 +1,379 @@
# 内存管理
## 前言
计算机系统中,变量、中间数据一般存放在 RAM 中,只有在实际使用时才将它们从 RAM 调入到 CPU 中进行运算。一些数据需要的内存大小需要在程序运行过程中根据实际情况确定,这就要求系统具有对内存空间进行动态管理的能力,在用户需要一段内存空间时,向系统申请,系统选择一段合适的内存空间分配给用户,用户使用完毕后,再释放回系统,以便系统将该段内存空间回收再利用。</br>
由于实时系统中对时间的要求非常严格,内存管理往往要比通用操作系统要求苛刻得多:
</br></br>
1分配内存的时间必须是确定的。一般内存管理算法是根据需要存储的数据的长度在内存中去寻找一个与这段数据相适应的空闲内存块然后将数据存储在里面。而寻找这样一个空闲内存块所耗费的时间是不确定的因此对于实时系统来说这就是不可接受的实时系统必须要保证内存块的分配过程在可预测的确定时间内完成否则实时任务对外部事件的响应也将变得不可确定。
</br></br>
2随着内存不断被分配和释放整个内存区域会产生越来越多的碎片系统中还有足够的空闲内存但因为它们地址并非连续不能组成一块连续的完整内存块会使得程序不能申请到大的内存。对于通用系统而言这种不恰当的内存分配算法可以通过重新启动系统来解决但是对于那些需要常年不间断地工作于野外的嵌入式系统来说频繁的重启是无法接受的。
</br></br>
3嵌入式系统的资源环境也是不尽相同不同的系统内存大小不同如何为这些不同的系统选择适合它们的高效率的内存分配算法也是一个复杂的问题。
</br></br>
XiUOS操作系统提供了独特的内存管理分配算法进行内存管理通过静态内存管理和动态内存管理相结合保证分配和释放内存的实时性提高内存的使用率有效地规避了内存碎片问题同时增加了内存检索的速度。
</br></br>
## 内存堆
### 静态内存管理
#### 静态内存划分
静态内存包含2个链表。其中每个链表都具有block_size静态内存块大小、total_count静态内存块的总个数、free_count空闲内存块的总个数和free_list空闲链表这四个属性。
其中block_size属性记录了当前链表中每个静态内存块的大小
total_count属性记录了系统初始化之后分配给该链表中静态内存块的总个数
free_count属性记录了该链表中还可以分配给用户静态内存块的个数
free_list属性则真正指向各个空闲静态内存块。
</br></br>
下图为静态内存链表的具体情况。图中包括两个静态链表1和2。静态链表头1指向的内存池中存放的静态内存块的大小都是32字节静态链表头2所指向的内存池中存放的静态内存块的大小都是64字节。此外系统分别配置了静态链表头1和静态链表头2中静态内存块的total_count个数为256和128。因此静态链表头1最多可以响应用户256次的小于32字节的内存请求静态链表头2最多可以响应用户128次的介于33-64字节之间的内存请求一旦对应的静态内存块分配完了系统会向动态内存区域寻求内存空间分配。
<div style="display: flex;justify-content: center;align-items: center;">
<img src="./imagesrc/fig1.png" width =100%/>
</div>
#### 静态内存分配
在用户发起内存分配请求时,若用户请求分配的内存空间大小小于等于预设的静态内存阈值,且所述静态内存区域有相应空闲的内存块,则从静态内存区域分配相应大小的内存空间。
</br></br>
在用户发起内存释放请求时,所述分配释放请求解析根据用户提供的内存地址决定后续的操作:
</br>
如果所述内存地址是不合法的,则直接返回结果给用户。
</br>
如果所述内存地址是合法地址,分配释放请求解析模块解析所述内存地址所属内存区域,所述内存地址在静态内存区域,则内存分配任务由静态内存管理模块负责;所述内存地址在动态内存区域,则内存分配任务由动态内存管理模块负责。
</br></br>
从静态内存区域分配静态内存块的过程,包括三种情况。</br>
+ 当用户请求分配内存大小小于等于32字节那么分配释放请求解析模块解析该内存大小由静态内存管理模块负责。系统获取静态链表头1从静态链表头1中获取一个静态内存块返回给用户</br>
+ 当用户请求分配内存大小为3364字节那么分配释放请求解析模块解析该内存大小由静态内存管理模块负责。系统获取静态链表头2从静态链表头2中获取一个静态内存块返回给用户</br>
+ 若所获得的静态链表头是一个空的链表,即没有空闲的静态内存块可用,那么通知分配释放请求解析模块在静态内存区域中内存分配失败。
#### 静态内存释放
当用户请求释放内存所述内存用ptr表示释放操作包括三种情况。</br>
+ 所述ptr内存地址是不合法的则直接返回释放操作。</br>
+ 所述ptr指向的静态内存块属于静态链表头1管理则将所述ptr指向的静态内存块放置到链表头1的头部</br>
+ 若所述ptr指向的静态内存块属于链表头2管理则将所述ptr指向的静态内存块放置到链表头2的头部。
### 动态内存管理
#### 动态内存划分
静态内存划分后剩下的内存区域作为动态内存分配给动态内存区域。动态内存区域管理用到了三种重要的数据结构分别是已分配动态内存段、空闲动态内存段和动态内存管理数据结构。下图显示了已分配动态内存段和空闲动态内存段这两种数据结构。其中已分配动态内存包括元数据信息和用户的数据段用户数据元数据信息中的size属性记录了该动态内存段的内存大小prev_size属性则记录了该动态内存段前一个相邻动态内存段的内存大小从而可以获取前一个相邻动态内存段。用户数据则是分配给用户使用的内存空间。空闲动态内存段的元数据信息具有size、prev_size、prev和next这四个属性其中size和prev_size属性与已分配动态内存段的对应属性表示的意义相同prev属性记录了前一个空闲动态内存段最后一个next属性则记录了下一个空闲动态内存段。
</br></br>
<div style="display: flex;justify-content: center;align-items: center;">
<img src="./imagesrc/fig2.png" width =90%/>
</div>
</br></br>
下图展示了动态内存区域初始化之后的状态,系统将动态内存区域划分为三个动态内存段,分别是起始地址处已分配动态内存段和结尾已分配动态内存段,中间区域的内存用一个空闲动态内存段记录。
</br></br>
<div style="display: flex;justify-content: center;align-items: center;">
<img src="./imagesrc/fig3.png" width =80%/>
</div>
</br></br>
动态内存管理数据结构是动态内存区域管理中的核心数据结构用于组织所有的空闲动态内存段。所述动态内存管理数据结构具有total_size、dynamic_start、dynamic_end和freeLists这四个属性其中total_size属性用于记录动态内存区域的大小dynamic_start属性用于记录起始地址处已分配动态内存段dynamic_end属性用于记录结尾处已分配动态内存段freeLists属性是一个多级链表每一级链表记录了内存大小在指定范围的空闲动态内存段。根据空闲内存段的大小系统判断空闲内存段所属动态链表然后将空闲内存段插入不同的空闲链表中。</br></br>
系统配置空闲链表的个数为10。当动态内存段大小在1-31字节之间则插入到空闲链表freeList1中当动态内存段大小在32-63字节之间时则插入到空闲链表freeList2中需要特别说明的是当动态内存段大小大于或者等于8192字节时都插入到空闲链表freeList10中。如下表所示
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 500 >
<tr>
<td width = 240>
申请的内存范围
</td>
<td width = 260>
分配动态链表头
</td>
</tr>
<tr>
<td>
1 ~ 31字节
</td>
<td>
freeList1
</td>
</tr>
<tr>
<td>
32 ~ 63字节
</td>
<td>
freeList2
</td>
</tr>
<tr>
<td>
64 ~127字节
</td>
<td>
freeList3
</td>
</tr>
<tr>
<td>
……
</td>
<td>
……
</td>
</tr>
<tr>
<td>
8192 ~MAX(MAX由系统配置)
</td>
<td>
freeList10
</td>
</tr>
</table>
</div>
#### 动态内存分配
系统根据要分配或者要释放的内存段大小计算要操作的内存段链表头当内存段大小为1 ~ 31字节那么内存计算单元计算之后将获取空闲动态链表头freeList1当内存段大小为32 ~63字节那么内存计算单元计算之后将获取动态链表头freeList2。以此类推。</br></br>
当用户请求从动态内存段申请内存时,动态内存管理模块只能有以下几种分配情况:</br>
+ 用户请求分配30个字节freeList1链表中有一个32字节内存大小可以满足用户的需求之后进行内存块的分割操作32可以分配为30字节 + 2字节但是2字节小于系统要求的8字节对齐大小因此将32字节内存返回给用户</br>
+ 用户请求分配45个字节并且系统已经知道静态内存区域无法分配。内存计算单元计算45字节对应的空闲动态链表获取freeList2freeList2链表中有一个56字节内存大小可以满足用户的需求之后进行内存块的分割操作56可以分配为45字节 + 11字节11字节小于系统要求的8字节对齐大小因此除了返回45字节动态内存给用户还要执行11字节的内存释放操作</br>
+ 用户请求分配8000个字节。内存计算单元计算8000字节对应的空闲动态链表获取freeList9freeList9链表中没有空闲动态内存段没有找到可分配的动态内存段并且freeList9不是最后一级链表更新链表头到freeList10freeList10链表中动态内存段可以满足用户的需求之后进行内存块的分割操作9000可以分配为8192字节 + 808字节808字节大于系统要求的8字节对齐大小因此除了返回8192动态内存给用户还要执行808字节的释放操作</br>
+ 用户请求分配6000000个字节。内存计算单元计算6000000字节对应的空闲动态链表获取freeList10freeList10链表中没有空闲动态内存段没有找到可分配的动态内存段并且freeList10是最后一级链表内存分配操作失败结束内存分配操作。</br>
#### 动态内存释放
当用户请求释放内存所述内存用ptr表示。分配释放请求解析模块解析判断ptr所述区域为动态内存区域则将释放ptr所指向的内存区域到动态内存段中。
<div style="display: flex;justify-content: center;align-items: center;">
<img src="./imagesrc/fig9.png" width =95%/>
</div>
释放一块动态内存段上图提供了动态内存段释放和合并的三种情况其中每一个动态内存段都包含了两个指针分别指向前一个相邻内存段和后一个相邻内存段下面介绍图9展示的三种释放并合并的三种情况
+ 如图中a所示四块动态内存段其中ABD三段为已分配动态内存段C为空闲动态内存段。当前系统要释放内存段B动态内存管理模块检测到B内存段的后一个相邻C也是空闲内存段则系统会合并内存段BC然后释放BC合并之后的内存段。
+ 如图中b所示ABCD四块已分配内存段。系统要释放内存段B动态内存管理模块检测到B的相邻内存段都是已分配内存段那么直接释放内存段B。
+ 如图中c所示四块动态内存段其中AC是空闲内存段BD是已分配内存段。系统要释放内存段B动态内存管理模块检测到B的前一个相邻内存段A和后一个相邻内存段B都是空闲内存段那么先合并ABC三个内存段形成一个大的空闲内存段ABC然后释放合并形成的ABC空闲内存段。
## 内存池
内存堆管理器可以分配任意大小的内存块非常灵活和方便。但其也存在明显的缺点一是分配效率不高在每次分配时都要空闲内存块查找二是容易产生内存碎片。为了提高内存分配的效率并且避免内存碎片XiUOS提供了另外一种内存管理方法内存池。
</br></br>
内存池在创建时先向系统预先申请分配一定数量、大小相等(一般情况下)的内存块留作备用。当有新的内存需求时,就从内存池中分出一部分内存块,若内存块不够再继续申请新的内存。
## 函数接口
### 内存堆管理
#### 内存初始化
```C
void xs_SystemHeapInit(void *start_phy_address, void *end_phy_address)
```
这个函数用来初始化静态和动态内存。
| 参数 | 描述 |
| :------ | :------ |
| start_phy_address | 内存开始的物理地址 |
| end_phy_address | 内存结束的物理地址 |
</br>
#### 分配和释放内存
```C
void *xs_malloc(xs_size_t size)
```
这个函数用来分配一块合适大小的内存如果分配成功则返回分配内存的首地址如果分配失败则返回NULL。
| 参数 | 描述 |
| :------ | :------ |
| size | 需要被分配的内存大小 |
</br>
```C
void *xs_realloc(void *pointer, xs_size_t size)
```
这个函数用来重新分配一块内存将原内存块中的数据保存到新的内存中去并将原内存块释放。如果分配成功则返回分配内存的首地址如果分配失败则返回NULL。
| 参数 | 描述 |
| :------ | :------ |
| pointer | 原内存块的指针 |
| size | 需要被分配的内存大小 |
</br>
```C
void *xs_calloc(xs_size_t count, xs_size_t size)
```
这个函数会分配多个内存块并将内存块中的数据初始化为0。
| 参数 | 描述 |
| :------ | :------ |
| count | 需要分配的内存块数量 |
| size | 单个内存块的大小 |
</br>
```C
void xs_free(void *pointer)
```
这个函数用来释放一个内存块
| 参数 | 描述 |
| :------ | :------ |
| pointer | 指向需要被释放的内存块的指针 |
</br>
#### 内存钩子函数
```C
void xs_MallocSetHook(void (*MallocHook)(void *pointer, xs_size_t size))
```
这个函数设置了一个 MallocHook 函数MallocHook 函数会在动态内存分配之前调用。
| 参数 | 描述 |
| :------ | :------ |
| MallocHook | MallocHook 函数指针 |
</br>
```C
void xs_FreeSetHook(void (*FreeHook)(void *pointer))
```
这个函数设置了一个FreeHook 函数, FreeHook 函数会在内存块被释放回动态内存区时调用。
| 参数 | 描述 |
| :------ | :------ |
| FreeHook | FreeHook 函数指针 |
</br>
#### 其他函数
```C
void xs_MemoryInfo(xs_uint32 *total_memory, xs_uint32 *used_memory, xs_uint32 *max_used_memory)
```
这个函数用于获取内存的统计信息。
| 参数 | 描述 |
| :------ | :------ |
| total_memory | 内存总量 |
| used_memory | 已使用的内存 |
| max_used_memory | 最大分配内存 |
</br>
```C
void list_mem(void)
```
打印内存信息。
</br>
```C
void list_buddy(void)
```
打印动态内存中的空闲节点信息。
</br>
### 内存池
#### 创建内存池
```C
xs_gm_t xs_CreateMemGather(const char *gm_name, xs_size_t block_number, xs_size_t one_block_size)
```
创建一个内存池。如果创建成功返回第一个内存块的地址否则返回XS_NULL(0)。
| 参数 | 描述 |
| :------ | :------ |
| gm_name | 内存池名 |
| block_number | 内存池中的内存块数量 |
| one_block_size | 每个内存块的容量 |
</br>
```C
xs_err_t xs_InitMemGather(struct xs_MemGather *gm_handler, const char *gm_name, void *begin_address, xs_size_t gm_size, xs_size_t one_block_size)
```
初始化内存池,用于静态内存管理模式。
| 参数 | 描述 |
| :------ | :------ |
| gm_handler | 内存池对象 |
| gm_name | 内存池名称 |
| begin_address | 内存池起始地址 |
| gm_size | 内存池数据区大小 |
| one_block_size | 每个内存块的容量 |
</br>
#### 删除内存池
```C
xs_err_t xs_DeleteMemGather(xs_gm_t gm_handler)
```
删除由xs_CreateMemGather创建的内存池返回0。
| 参数 | 描述 |
| :------ | :------ |
| gm_handler | 需要被删除的内存池地址 |
</br>
```C
xs_err_t xs_RemoveMemGather(struct xs_MemGather *gm_handler)
```
删除由xs_MemGatherInit创建的内存池返回0。
| 参数 | 描述 |
| :------ | :------ |
| gm_handler | 需要被删除的内存池地址 |
</br>
#### 分配内存块
```C
void *xs_AllocBlockMemGather(xs_gm_t gm_handler, xs_int32 wait_time)
```
该函数将从指定的内存池中分配一个内存块。如果内存池中有可用的内存块则从内存池的空闲块链表上取下一个内存块将空闲内存块数目减1并返回这个内存块如果内存池中已经没有空闲内存块则判断超时时间设置若超时时间设置为零则立刻返回空内存块如果等待时间大于零则把当前线程挂起在该内存池对象上直到内存池中有可用的自由内存块或等待时间到达。
| 参数 | 描述 |
| :------ | :------ |
| gm_handler | 内存池对象 |
| wait_time | 超时时间 |
</br>
#### 释放内存块
```C
void xs_FreeBlockMemGather(void *data_block)
```
这个函数用于释放指定的内存块,然后增加内存池对象的可用内存块数目,并把该被释放的内存块加入空闲内存块链表上。接着判断该内存池对象上是否有挂起的线程,如果有则唤醒挂起线程链表上的首线程。
| 参数 | 描述 |
| :------ | :------ |
| data_block | 需要被释放的内存块指针 |
</br>
#### 内存池钩子函数
```C
void xs_GmSetAllocHook(void (*gm_allocation_hook)(struct xs_MemGather *gm, void *date_ptr))
```
该钩子函数会在内存池分配之前调用。
| 参数 | 描述 |
| :------ | :------ |
| MallocHook | 钩子函数指针 |
</br>
```C
void xs_GmSetFreeHook(void (*gm_release_hook)(struct xs_MemGather *gm, void *date_ptr))
```
该钩子函数会在内存池被删除后调用。
| 参数 | 描述 |
| :------ | :------ |
| gm_release_hook | 钩子函数指针 |
</br>
## 应用场景
### 内存堆应用场景
+ 为数组动态分配内存的常规场景。
**优点:** 能够实时分配和释放内存</br>
**缺点:** 容易产生碎片
### 内存池应用场景
+ 当线程间以信号通信时,在发送和接收信号前,可以初始化一个内存池储存信号。
+ Wifi 模块运行动态储存接收数据。
**优点:** 增加了内存动态分配的效率,提高内存的使用率,减少内存碎片的产生。
## 应用示例

1
docs/doc/kernel/synchron.md Executable file
View File

@ -0,0 +1 @@
# 资源管理

1
docs/doc/kernel/task.md Executable file
View File

@ -0,0 +1 @@
# 线程管理

View File

@ -0,0 +1,378 @@
# 线程间通信
XiUOS 的线程间通信使用邮箱、消息队列和信号三种方式。下面将分别介绍。
## 邮箱
### 邮箱的工作机制
XiUOS 的每一封邮件大小为4字节也就是一个指针的大小。典型的邮箱应用是线程或中断服务发送一封4字节长度的邮件到邮箱中其他的线程可以从邮箱中接收邮件并进行处理。</br></br>
当一个线程向邮箱发送邮件时如果邮箱没满就将邮件复制到邮箱中。如果邮箱满了并且超时时间设置为0则返回`-XS_EFULL`如果超时时间不为0先将该发送线程挂起当邮箱中的邮件被取出空出空间后等待挂起的发送线程被唤醒继续发送。但是如果到达超时时间仍没有空间则返回`-XS_EFULL`。</br></br>
当一个线程从邮箱中接收邮件时如果邮箱中有邮件就读出该邮件的内容并返回XS_EOK。如果邮箱中没有邮件并且超时设置为0则返回`-XS_ETIMEOUT`如果超时时间不为0则将该线程挂在邮箱的等待线程中有邮件时唤醒。但是如果到达超时时间仍没有邮件返回`-XS_ETIMEOUT`。
### 结构体定义和函数接口
#### 邮箱控制块
```C
struct xs_Mailbox
{
char name[XS_NAME_MAX];
xs_uint8 style;
xs_uint8 sign;
xs_list_t link;
xs_list_t pend_list;
xs_ubase *msg_buf;
xs_uint16 size;
xs_uint16 index;
xs_uint16 in_offset;
xs_uint16 out_offset;
xs_list_t pend_sender_list;
};
typedef struct xs_Mailbox *xs_mailbox_t;
```
| 参数 | 描述 |
| ------ | ------ |
| name | 邮箱名称 |
| style | 线程等待的方式可以取FIFO或PRIO |
| sign | 标记邮箱的创建方式,静态创建或动态创建 |
| link | 邮箱存放的列表 |
| pend_list | 线程等待队列 |
| msg_buf | 邮箱缓冲区开始地址 |
| size | 邮箱最大容纳的邮件数 |
| index | 邮箱中邮件的索引 |
| in_offset | 邮箱缓冲的进指针 |
| out_offset | 邮箱缓冲的出指针 |
| pend_sender_list | 发送线程的挂起等待队列 |
#### 函数接口
```C
xs_err_t xs_InitMailbox(xs_mailbox_t mb,
const char* name,
void* msgpool,
xs_size_t size,
xs_uint8 flag);
```
该函数用于创建一个静态邮箱对象,并将它加入邮箱管理列表中,创建成功返回`XS_OK`。</br>
| 参数 | 描述 |
| ------ | ------ |
| mb | 邮箱对象 |
| name | 邮箱名称 |
| msgpool | 缓冲区指针 |
| size | 邮箱容量 |
| flag | 线程等待的方式可以取FIFO或PRIO |
</br>
```C
xs_err_t xs_DetachMailbox(xs_mailbox_t mb);
```
该函数用于脱离静态初始化的邮箱对象。该函数唤醒所有挂在该邮箱上的线程,然后将该邮箱从邮箱存放的列表中脱离,返回`XS_OK`。
| 参数 | 描述 |
| ------ | ------ |
| mb | 邮箱对象 |
```C
xs_mailbox_t xs_CreateMailbox(const char *name, xs_size_t size, xs_uint8 flag);
```
该函数用于创建一个动态邮箱对象,并将它加入邮箱管理列表中。创建成功则返回`XS_OK`,创建失败返回`XS_NULL`。</br>
| 参数 | 描述 |
| ------ | ------ |
| name | 邮箱名称 |
| size | 邮箱容量 |
| flag | 线程等待的方式可以取FIFO或PRIO |
</br>
```C
xs_err_t xs_DeleteMailbox(xs_mailbox_t mb);
```
该函数用于删除动态邮箱对象。先唤醒挂在邮箱对象上的所有线程,然后释放该邮箱的使用内存,最后删除邮箱对象。返回`XS_OK`。</br>
| 参数 | 描述 |
| ------ | ------ |
| mb | 邮箱对象 |
</br>
```C
xs_err_t xs_MailboxSendWait(xs_mailbox_t mb, xs_ubase value, xs_int32 timeout);
```
该函数用于发送邮件。如果邮箱满了并且过了timeout时间仍然没有空位则返回`-XS_FULL`;否则将邮件存放入邮箱。</br>
| 参数 | 描述 |
| ------ | ------ |
| mb | 邮箱对象 |
| value | 邮件内容 |
| timeout | 超时时间 |
</br>
```C
xs_err_t xs_MailboxSend(xs_mailbox_t mb, xs_ubase value);
```
该函数用于发送邮件。与`xs_MailboxSendWait`唯一不同的地方是,该函数的`timeout == 0`。</br>
| 参数 | 描述 |
| ------ | ------ |
| mb | 邮箱对象 |
| value | 邮件内容 |
</br>
```C
xs_err_t xs_MailboxRecv(xs_mailbox_t mb, xs_ubase *value, xs_int32 timeout);
```
该函数用于接受邮件。
```C
xs_err_t xs_CmdControlMailbox(xs_mailbox_t mb, int cmd, void *arg);
```
该函数用于获取或设置邮箱的其他属性。目前当`cmd == XS_LINKLIST_CMD_RESET`时,重新初始化邮箱。</br>
| 参数 | 描述 |
| ------ | ------ |
| mb | 邮箱对象 |
| cmd | 需要执行的命令 |
| arg | 命令的参数 |
</br>
## 消息队列
### 消息队列的工作机制
消息队列能够接收线程或中断产生的不固定长度的消息,并储存到自己的内存空间中。其他线程可以从消息队列中读取相应的消息。当消息队列为空时,挂起读取线程,当有新的消息到达时,唤醒读取线程进行读取。
### 结构体定义和函数接口
#### 结构体定义
```C
struct xs_MessageQueue
{
char name[XS_NAME_MAX];
xs_uint8 style;
xs_uint8 sign;
xs_list_t link;
xs_list_t pend_list;
void *msg_buf;
xs_uint16 size;
xs_uint16 max_msgs;
xs_uint16 index;
void *mq_listhead;
void *mq_listtail;
void *mq_free;
xs_list_t pend_sender_thread;
};
typedef struct xs_MessageQueue *xs_messagequeue_t;
```
| 参数 | 描述 |
| ------ | ------ |
| name | 消息队列名称 |
| style | 线程等待的方式可以取FIFO或PRIO |
| sign | 标记消息队列的创建方式,静态创建或动态创建 |
| link | 消息队列存放的列表 |
| pend_list | 线程等待队列 |
| msg_buf | 存放消息的缓存区 |
| size | 缓存区大小 |
| max_msgs | 一条消息的最大长度 |
| index | 当前消息数 |
| mq_listhead | 消息链表头 |
| mq_listtail | 消息链表尾 |
| mq_free | 空闲消息链表 |
| pend_sender_thread | 发送线程的挂起等待队列 |
#### 函数接口
```C
xs_err_t xs_InitMessageQueue(xs_messagequeue_t mq,
const char *name,
void *msgpool,
xs_size_t msg_size,
xs_size_t pool_size,
xs_uint8 flag)
```
该函数用于初始化一个静态消息队列,并将它加入消息队列管理列表中。创建成功后返回`XS_OK`。</br>
| 参数 | 描述 |
| ------ | ------ |
| mq | 消息队列对象指针 |
| name | 消息队列名称 |
| msgpool | 指向存放消息的内存空间的指针 |
| msg_size | 一条消息的最大长度 |
| pool_size | 存放消息的内存区大小 |
| flag | 消息队列采用的等待方式可取FIFO或PRIO |
</br>
```C
xs_err_t xs_DetachMessageQueue(xs_messagequeue_t mq)
```
该函数用于将一个静态消息队列从消息队列管理列表中移除。移除成功则返回`XS_OK`。</br>
| 参数 | 描述 |
| ------ | ------ |
| mq | 消息队列对象指针 |
</br>
```C
xs_messagequeue_t xs_CreateMessageQueue(const char *name,
xs_size_t msg_size,
xs_size_t max_msgs,
xs_uint8 flag)
```
该函数用于动态创建一个消息队列,并将消息队列加入消息队列管理列表。</br>
| 参数 | 描述 |
| ------ | ------ |
| name | 消息队列名称 |
| msg_size | 缓冲区的大小 |
| max_msgs | 一条消息的最大长度 |
| flag | 消息队列采用的等待方式可取FIFO或PRIO |
</br>
```C
xs_err_t xs_DeleteMessageQueue(xs_messagequeue_t mq)
```
该函数用于将由`xs_CreateMessageQueue`创建的消息队列从消息队列管理列表中删除。</br>
| 参数 | 描述 |
| ------ | ------ |
| mq | 消息队列对象指针 |
</br>
```C
xs_err_t xs_MessageQueueSendwait(xs_messagequeue_t mq,
const void *buffer,
xs_size_t size,
xs_int32 timeout)
```
发送消息时,消息队列对象先从空闲消息链表上取下一个空闲消息块,把线程或者中断服务程序发送的消息内容复制到消息块上,然后把该消息块挂到消息队列的尾部,成功则返回`XS_EOK`。如果消息长度大于最大长度,则返回`XS_ERROR`。如果消息队列满了,则根据超时时间设定进行等待,超时则返回`-XS_EFULL`。</br>
| 参数 | 描述 |
| ------ | ------ |
| mq | 消息队列对象指针 |
| buffer | 消息内容 |
| size | 消息大小 |
| timeout | 超时时间 |
</br>
```C
xs_err_t xs_MessageQueueSend(xs_messagequeue_t mq, const void *buffer, xs_size_t size)
```
该函数是timeout为0的`xs_MessageQueueSendwait`。
</br>
| 参数 | 描述 |
| ------ | ------ |
| mq | 消息队列对象指针 |
| buffer | 消息内容 |
| size | 消息大小 |
</br>
```C
xs_err_t xs_MessageQueueUrgentSend(xs_messagequeue_t mq, const void *buffer, xs_size_t size)
```
发送紧急消息和发送普通消息的区别是:当发送紧急消息时,从空闲消息链表上取下来的消息块不是挂到消息队列的队尾,而是挂到队首,这样,接收者就能够优先接收到紧急消息,从而及时进行消息处理。</br>
| 参数 | 描述 |
| ------ | ------ |
| mq | 消息队列对象指针 |
| buffer | 消息内容 |
| size | 消息大小 |
</br>
```C
xs_err_t xs_MessageQueueReceive(xs_messagequeue_t mq,
void *buffer,
xs_size_t size,
xs_int32 timeout)
```
当队列中有消息时,接收消息。队列中没有消息时,根据超时时间设定进行等待。接收一个消息后消息队列上的队首消息被转移到了空闲消息链表的尾部。成功收到消息返回`XS_EOK`,超时返回`XS_ETIMEOUT`。接收消息失败返回`-XS_ERROR`。
</br>
| 参数 | 描述 |
| ------ | ------ |
| mq | 消息队列对象指针 |
| buffer | 消息内容 |
| size | 消息大小 |
| timeout | 超时时间 |
</br>
```C
xs_err_t xs_CmdControlMessageQueue(xs_messagequeue_t mq, int cmd, void *arg)
```
该函数用于获取或设置消息队列的其他属性。目前当cmd == XS_LINKLIST_CMD_RESET时重新初始化消息队列。
</br>
| 参数 | 描述 |
| ------ | ------ |
| mq | 消息队列对象指针 |
| cmd | 需要执行的命令 |
| arg | 命令的参数 |
</br>
## 信号
### 信号的工作机制
信号是在软件层次对中断机制的一种模拟。XiUOS中提供了信号用作异步通信的方式。</br></br>
收到信号的线程对各种信号有不同的处理方法,处理方法可以分为三类:</br></br>
第一种是类似中断的处理程序,对于需要处理的信号,线程可以指定处理函数,由该函数来处理。</br></br>
第二种方法是,忽略某个信号,对该信号不做任何处理。</br></br>
第三种方法是,对该信号的处理保留系统的默认值。</br></br>
具体来说假设其他线程要向线程1通信则在线程1中安装一个信号并解除阻塞在安装的同时规定对该信号的异常处理方式。其他线程给线程1发送信号触发线程1对该信号的处理。
### 函数接口
```C
xs_sighandler_t xs_InstallSignal(int signo, xs_sighandler_t handler)
```
该函数用于给当前线程安装一个新的信号。</br>
| 参数 | 描述 |
| ------ | ------ |
| signo | 信号值 |
| handler | 设置对信号值的处理方式,可以是用户自定义的函数,`SIG_IGN`或`SIG_DFL` |
</br>
handler的值为`SIG_IGN`时,忽略该信号;</br>
handler的值为`SIG_DFL`时,执行信号默认处理函数`_SignalDefaultHandler`</br>
handler为函数句柄时执行用户函数。 </br>
```C
void xs_MaskSignal(int signo)
```
该函数用于屏蔽一个信号。</br>
| 参数 | 描述 |
| ------ | ------ |
| signo | 信号值 |
</br>
```C
void xs_UnmaskSignal(int signo)
```
该函数用于解除对一个信号的屏蔽。</br>
| 参数 | 描述 |
| ------ | ------ |
| signo | 信号值 |
</br>
```C
int xs_WaitSignal(const xs_sigset_t *set, xs_siginfo_t *si, xs_int32 timeout)
```
等待`set`信号到来。如果没等到这个信号,则将该线程挂起直到等到信号或超过超时时间。如果等到信号,则将`set`信号指针存入`si`。</br>
| 参数 | 描述 |
| ------ | ------ |
| set | 指定等待的信号 |
| set | 指向存储等到信号信息的指针 |
| set | 超时时间 |
</br>
```C
int xs_KThreadKill(TaskDescriptorPointer tid, int sig)
```
该函数用于给线程`tid`发送信号`sig`。</br>
| 参数 | 描述 |
| ------ | ------ |
| tid | 线程 |
| sig | 信号值 |
```C
int xs_SysInitSignal(void)
```
该函数用于在内存池中给信号分配一片内存区。

View File

@ -0,0 +1,584 @@
# 力敏传感器
## QS-FS 风速传感器
<div class = "wrapper">
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" >
<tr>
<td style="width: 50%;">
<!--左侧内容-->
<img src = "./imagesrc/QS-fs.png" alt="QS-fs" width =100% max-width= 100% >
</td>
<td style="width: 50%;">
<!--右侧内容-->
体积小,携带方便、安装简捷</br></br>
测量精度高,量程宽,稳定性好</br></br>
结构设计合理,外观质量佳</br></br>
数据信息线性度好,信号传输距离长,抗外界干扰能力强</br></br>
</td>
</tr>
</table>
</div>
### 适用范围
该传感器可广泛应用于温室、环境保护、气象站、船舶、 码头、养殖等环境的风速测量。
### 接线说明
**电压、电流以及脉冲型接线定义**
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 600>
<tr>
<td width = 120 style = "text-align:center"><b>接入</b></td>
<td width = 480 colspan = "3" style = "text-align:center"><b>外部线</b></td>
</tr>
<tr style = "text-align:center">
<td width = 120 >电源正</td>
<td width = 160 >红色</td>
<td width = 160 rowspan = "3"></td>
<td width = 160 >棕色</td>
</tr>
<tr style = "text-align:center">
<td width = 120 >电源负</td>
<td width = 160 >蓝色</td>
<td width = 160 >黑色</td>
</tr>
<tr style = "text-align:center">
<td width = 120 >信号</td>
<td width = 160 >黄色</td>
<td width = 160 >蓝色</td>
</tr>
</table>
</div>
**485型接线定义**
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 600>
<tr style = "text-align:center">
<td width = 120 ><b>线色</b></td>
<td width = 120 >棕色</td>
<td width = 120 >蓝色</td>
<td width = 120 >灰色</td>
<td width = 120 >黑色</td>
</tr>
<tr style = "text-align:center">
<td width = 120 ><b>485</b></td>
<td width = 120 >电源正</td>
<td width = 120 >485A</td>
<td width = 120 >485B</td>
<td width = 120 >电源负</td>
</tr>
</table>
</div>
### 技术参数
启动风力0.2-0.4 m/s</br></br>
测量精度:±(0.3+0.03V)m/s(V表示风速示值)</br></br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 600>
<tr >
<td width = 150 rowspan = "10" style = "text-align:center"><b>电压型</b></td>
<td width = 150 >量程</td>
<td width = 300 >0~32. 4 m/s</td>
</tr>
<tr >
<td >供电电压</td>
<td >7V~24 V DC</td>
</tr>
<tr >
<td >输出信号</td>
<td >0.4~2V </td>
</tr>
<tr >
<td >风速值</td>
<td >(输出电压-0.4/1.6*32.4 </td>
</tr>
<tr >
<td >供电电压</td>
<td >12V~24 V DC</td>
</tr>
<tr >
<td >输出信号</td>
<td >0~5 V </td>
</tr>
<tr >
<td >风速值</td>
<td >输出电压/5*32.4 </td>
</tr>
<tr >
<td >供电电压</td>
<td >12V~24 V DC</td>
</tr>
<tr >
<td >输出信号</td>
<td >1~5 V </td>
</tr>
<tr >
<td >风速值</td>
<td >(输出电压-1/4*32.4 </td>
</tr>
<tr >
<td width = 150 rowspan = "5" style = "text-align:center"><b>电流型</b></td>
<td width = 150 >量程</td>
<td width = 300 >0~32. 4 m/s</td>
</tr>
<tr >
<td >供电电压</td>
<td >12V~24 V DC</td>
</tr>
<tr >
<td >输出信号</td>
<td >4~20 mA </td>
</tr>
<tr >
<td >负载能力</td>
<td >≤200Ω </td>
</tr>
<tr >
<td >风速值</td>
<td >(输出电流-4/16*32.4 </td>
</tr>
<tr >
<td width = 150 rowspan = "4" style = "text-align:center"><b>脉冲型</b></td>
<td width = 150 >量程</td>
<td width = 300 >0~60 m/s </td>
</tr>
<tr >
<td >供电电压</td>
<td >12V~24 V DC</td>
</tr>
<tr >
<td >输出信号</td>
<td >脉冲(每个脉冲对应0.88m/s) </td>
</tr>
<tr >
<td >信号说明</td>
<td >内加上拉电阻逻辑1=VCC逻辑0=GND</td>
</tr>
<tr >
<td width = 150 rowspan = "3" style = "text-align:center"><b>485型</b></td>
<td width = 150 >量程</td>
<td width = 300 >0~32. 4 m/s</td>
</tr>
<tr >
<td >供电电压</td>
<td > 7V~24 V DC</td>
</tr>
<tr >
<td >通信协议</td>
<td >Modbus-RTU </td>
</tr>
</table>
</div>
### 通信协议
**MODBUS协议(可定制)**
+ 通讯方式485 通讯,传送距离< 1000米
+ 通讯速率9600,n,8,1
+ 通讯协议MODBUS-RTU协议出厂站号为2号站依需要可以进行修改。
ModBus协议的命令包括</br>
读出风速的数值出厂为2号站</br>
读取风速值命令格式举例:</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 800>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
<td width = 100 style = "text-align:center">5</td>
<td width = 100 style = "text-align:center">6</td>
<td width = 100 style = "text-align:center">7</td>
</tr>
<tr>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x03</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x01</td>
<td style = "text-align:center">0x84</td>
<td style = "text-align:center">0x39</td>
</tr>
</table>
</div>
开始的第一个字节02是站号如果你已修改过站号设置应将第一位的 02 修改为您设置的站号最后两位84,39是 16位的CRC校验。</br>
返回风速的命令格式举例:</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 700>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
<td width = 100 style = "text-align:center">5</td>
<td width = 100 style = "text-align:center">6</td>
</tr>
<tr>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x03</td>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x1F</td>
<td style = "text-align:center">0xBD</td>
<td style = "text-align:center">0x8C</td>
</tr>
</table>
</div>
001F所在的位4,5位为风速的值客户自行计算CRC校验是否正确。</br>
风速数据解析方法:</br>
风速m/s=0X001F/10=31/10=3.1</br>
修改自身站号</br>
方法一:知道现在站号,发送如下指令</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 800>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
<td width = 100 style = "text-align:center">5</td>
<td width = 100 style = "text-align:center">6</td>
<td width = 100 style = "text-align:center">7</td>
</tr>
<tr>
<td style = "text-align:center"><b>0x02</b></td>
<td style = "text-align:center">0x06</td>
<td style = "text-align:center">0x10</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center"><b>0x03</b></td>
<td style = "text-align:center">0xCD</td>
<td style = "text-align:center">0x38</td>
</tr>
</table>
</div>
或者使用10功能码也可</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 1100>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
<td width = 100 style = "text-align:center">5</td>
<td width = 100 style = "text-align:center">6</td>
<td width = 100 style = "text-align:center">7</td>
<td width = 100 style = "text-align:center">8</td>
<td width = 100 style = "text-align:center">9</td>
<td width = 100 style = "text-align:center">10</td>
</tr>
<tr>
<td style = "text-align:center"><b>0x02</b></td>
<td style = "text-align:center">0x10</td>
<td style = "text-align:center">0x10</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x01</td>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center"><b>0x03</b></td>
<td style = "text-align:center">0xE3</td>
<td style = "text-align:center">0x60</td>
</tr>
</table>
</div>
其功能是将站号由2号改为3号</br>
方法二忘了原站站号需要将产品独自连接到电脑上注意总线上不能有其它485产品用0号站对其操作指令如下 </br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 800>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
<td width = 100 style = "text-align:center">5</td>
<td width = 100 style = "text-align:center">6</td>
<td width = 100 style = "text-align:center">7</td>
</tr>
<tr>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x06</td>
<td style = "text-align:center">0x10</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center"><b>0x03</b></td>
<td style = "text-align:center">0xCC</td>
<td style = "text-align:center">0xDA</td>
</tr>
</table>
</div>
注:加粗字替换为希望修改成的目标站号值即可。</br>
方法三:可以用清易电子科技有限公司软件的设置站号指令。详见软件</br>
## QS-FX 风向传感器
<div class = "wrapper">
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" >
<tr>
<td style="width: 50%;">
<!--左侧内容-->
<img src = "./imagesrc/QS-fx.png" alt="QS-fx" width =100% max-width= 100% >
</td>
<td style="width: 50%;">
<!--右侧内容-->
自体积小,重量轻,野外携带安装极为方便,防水防震结构设计,可在野外全天候使用 </br></br>
检测精度高,系统采用低功耗环保节能设计,数字处理技术</br></br>
量程宽,稳定性好</br></br>
数据信息显示线性度好,信号传输距离长,抗外界干扰能力强</br></br>
</td>
</tr>
</table>
</div>
### 适用范围
该传感器可测量室外环境中的风向可以测量以标签北为起点的0-359度的自然界风向具有很高的性价比。该仪器广泛用于环保、气象、农业、林业、水利、建筑、科研及教学等领域。
### 接线说明
**电压、电流型接线定义**
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 600>
<tr>
<td width = 120 style = "text-align:center"><b>接入</b></td>
<td width = 480 colspan = "3" style = "text-align:center"><b>外部线</b></td>
</tr>
<tr style = "text-align:center">
<td width = 120 >电源正</td>
<td width = 160 >红色</td>
<td width = 160 rowspan = "3"></td>
<td width = 160 >棕色</td>
</tr>
<tr style = "text-align:center">
<td width = 120 >电源负</td>
<td width = 160 >蓝色</td>
<td width = 160 >黑色</td>
</tr>
<tr style = "text-align:center">
<td width = 120 >信号</td>
<td width = 160 >黄色</td>
<td width = 160 >蓝色</td>
</tr>
</table>
</div>
**485型接线定义**
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 600>
<tr style = "text-align:center">
<td width = 120 ><b>线色</b></td>
<td width = 120 >棕色</td>
<td width = 120 >蓝色</td>
<td width = 120 >灰色</td>
<td width = 120 >黑色</td>
</tr>
<tr style = "text-align:center">
<td width = 120 ><b>485</b></td>
<td width = 120 >电源正</td>
<td width = 120 >485B</td>
<td width = 120 >485A</td>
<td width = 120 >电源负</td>
</tr>
</table>
</div>
### 技术参数
测量范围0--359度 (0.4V,或4MA对应0度北的方向)</br>
16个方向每增加0.1v或1ma增加一个方位</br>
0.4-2v或4-20ma16个刻度对应16个方位</br></br>
测量精度±1度</br></br>
工作电流15mA</br></br>
负载能力小于600欧 一般建议250欧</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 600>
<tr >
<td width = 150 rowspan = "6" style = "text-align:center"><b>电压型</b></td>
<td width = 150 >输入电压</td>
<td width = 300 >7V24V DC</td>
</tr>
<tr >
<td >输出信号</td>
<td >0.4~2V </td>
</tr>
<tr >
<td >风向值</td>
<td >(输出电压-0.4/1.6*360 </td>
</tr>
<tr >
<td >输入电压</td>
<td >12V~24 V DC</td>
</tr>
<tr >
<td >输出信号</td>
<td >0~5 V </td>
</tr>
<tr >
<td >风向值</td>
<td >(输出电压-1/4*360 </td>
</tr>
<tr >
<td width = 150 rowspan = "3" style = "text-align:center"><b>电流型</b></td>
<td width = 150 >输入电压</td>
<td width = 300 >12V24 V DC </td>
</tr>
<tr >
<td >输出信号</td>
<td >420mA</td>
</tr>
<tr >
<td >风向值</td>
<td >(输出电流-4/16*360 </td>
</tr>
<tr >
<td width = 150 rowspan = "2" style = "text-align:center"><b>485型</b></td>
<td width = 150 >输入电压</td>
<td width = 300 >7V~24 V DC</td>
</tr>
<tr >
<td >通信协议</td>
<td >Modbus-RTU</td>
</tr>
</table>
</div>
### 通信协议
**MODBUS协议(可定制)**
+ 通讯方式485 通讯,传送距离< 1000米
+ 通讯速率9600,n,8,1
+ 通讯协议MODBUS-RTU协议出厂站号为2号站依需要可以进行修改。
ModBus协议的命令包括</br>
读出风向的数值出厂为2号站</br>
读取风向值命令格式举例:</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 800>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
<td width = 100 style = "text-align:center">5</td>
<td width = 100 style = "text-align:center">6</td>
<td width = 100 style = "text-align:center">7</td>
</tr>
<tr>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x03</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x01</td>
<td style = "text-align:center">0x84</td>
<td style = "text-align:center">0x39</td>
</tr>
</table>
</div>
开始的第一个字节02是站号如果你已修改过站号设置应将后第一位的 02 修改为您设置的站号。随之,最后两位是 16位的CRC校验重新计算过后写上。</br>
返回风向的命令格式举例:</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 700>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
<td width = 100 style = "text-align:center">5</td>
<td width = 100 style = "text-align:center">6</td>
</tr>
<tr>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x03</td>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x1F</td>
<td style = "text-align:center">0xBD</td>
<td style = "text-align:center">0x8C</td>
</tr>
</table>
</div>
001F所在的位4,5位为风向的值</br>
风向数据解析方法:</br>
风向(°)=0X001F=31以北为开始输出成顺时针输出度数</br>
修改自身站号</br>
方法一:知道现在站号,发送如下指令</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 1100>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
<td width = 100 style = "text-align:center">5</td>
<td width = 100 style = "text-align:center">6</td>
<td width = 100 style = "text-align:center">7</td>
<td width = 100 style = "text-align:center">8</td>
<td width = 100 style = "text-align:center">9</td>
<td width = 100 style = "text-align:center">10</td>
</tr>
<tr>
<td style = "text-align:center"><b>0x02</b></td>
<td style = "text-align:center">0x10</td>
<td style = "text-align:center">0x10</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x01</td>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center"><b>0x03</b></td>
<td style = "text-align:center">0xE3</td>
<td style = "text-align:center">0x60</td>
</tr>
</table>
</div>
其功能是将站号有2号为3号</br>
目标站号值即可发送需客户自行计算CRC的值。</br>
方法二忘了原站站号 需要将产品独自连接到电脑上注意总线上不能有其它485产品用0号站对其操作指令如下</br>
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 1100>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
<td width = 100 style = "text-align:center">5</td>
<td width = 100 style = "text-align:center">6</td>
<td width = 100 style = "text-align:center">7</td>
<td width = 100 style = "text-align:center">8</td>
<td width = 100 style = "text-align:center">9</td>
<td width = 100 style = "text-align:center">10</td>
</tr>
<tr>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x10</td>
<td style = "text-align:center">0x10</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center">0x01</td>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x00</td>
<td style = "text-align:center"><b>0x03</b></td>
<td style = "text-align:center">0xFA</td>
<td style = "text-align:center">0x00</td>
</tr>
</table>
</div>
方法三:可以用清易电子科技有限公司软件的设置站号指令。详见软件</br>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
# 热敏传感器

View File

@ -0,0 +1,2 @@
# 湿敏传感器
##

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

View File

@ -0,0 +1 @@
# 磁敏传感器

View File

@ -0,0 +1 @@
# 光电传感器

View File

@ -0,0 +1,52 @@
# 压强传感器
## BMP180
<div class = "wrapper">
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" >
<tr>
<td style="width: 50%;">
<!--左侧内容-->
<img src = "./imagesrc/bmp180.jpg" alt="bmp180" width =100% max-width= 100% >
</td>
<td style="width: 50%;">
<!--右侧内容-->
适合智能的高精度测量和数据采集,输出高精度的压力(或高度)和温度测量数据。</br></br>
与加速度计相互搭配在没有GPS讯号的环境下提供可靠的楼层侦测能力以实现三维(3D)室内导航。</br></br>
可以检测:温度,大气压强,海拔高度。</br></br>
</td>
</tr>
</table>
</div>
### 接线说明
按照上图中从右向左的顺序:
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 600>
<tr>
<td width = 100>序号</td>
<td width = 250>BMP180模块</td>
<td width = 250>备注</td>
</tr>
<tr>
<td>1</td>
<td>VIN</td>
<td>供电电压1.8 V~3.6 V,典型值2.5 V</td>
</tr>
<tr>
<td>2</td>
<td>GND</td>
<td>模块公共地</td>
</tr>
<tr>
<td>3</td>
<td>SCL</td>
<td>I2C 时钟线</td>
</tr>
<tr>
<td>4</td>
<td>SDA</td>
<td>I2C 数据线</td>
</tr>
</table>
</div>
###

View File

@ -0,0 +1,69 @@
# 声音传感器
## D124
</br>
<div style="display: flex;justify-content: center;align-items: center;">
<img src = "./imagesrc/D124.png" alt="D124" width =30% max-width= 30% >
</br>
</div>
### 应用领域
用于采集当前环境中的声音分贝大小,并以串口形式输出。
### 接线说明
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 600>
<tr>
<td width = 100>1</td>
<td width = 250>棕线</td>
<td width = 250>VCC/DC12V</td>
</tr>
<tr>
<td>2</td>
<td>黑线</td>
<td>GND/电源线</td>
</tr>
<tr>
<td>3</td>
<td>蓝线</td>
<td>RXD</td>
</tr>
<tr>
<td>4</td>
<td>黄线</td>
<td>TXD</td>
</tr>
</table>
</div>
### 注意事项
+ 模块具有防反接保护接时只要注意不要把电源接到串口输出线上即可以免烧坏转换模块或MCU。
+ 串口输出为 TTL 电平,测试时请使用 TTL 转 USB 的模块。请勿使用 232 转 USB。
+ 模块在平常安静的环境中输出为 50dB 左右。
+ 测试时,电源地与串口地一定连通,让信号形成回路,否则测试时,串口软件显示无数据输出。当软件显示有乱码时,把串口测试软件的十六进制显示勾上即可显示正常数据。
### 通信协议
波 特 率9600</br>
输出方式:串口输出(协议见下) 1 次/1S</br>
起始位与停止位为固定值。</br>
数据计算方法数据_H\*256+数据_L/10</br>
校验位计算方法: 数据_H+数据_L</br></br>
例:
<div>
<table style="margin-left: auto; margin-right: auto; table-layout: fixed;" width = 500>
<tr>
<td width = 100 style = "text-align:center">0</td>
<td width = 100 style = "text-align:center">1</td>
<td width = 100 style = "text-align:center">2</td>
<td width = 100 style = "text-align:center">3</td>
<td width = 100 style = "text-align:center">4</td>
</tr>
<tr>
<td style = "text-align:center">0xAA</td>
<td style = "text-align:center">0x02</td>
<td style = "text-align:center">0x21</td>
<td style = "text-align:center">0x23</td>
<td style = "text-align:center">0xFF</td>
</tr>
</table>
</div>
声音计算方法: (2\*256+2\*16+1)/10=54.5dB</br>

73
package-lock.json generated Normal file
View File

@ -0,0 +1,73 @@
{
"name": "XiUOS",
"version": "0.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz",
"integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==",
"requires": {
"babel-runtime": "6.x"
}
},
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg=="
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
}
},
"core-js": {
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg=="
},
"deepmerge": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz",
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ=="
},
"element-ui": {
"version": "2.13.2",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.13.2.tgz",
"integrity": "sha512-r761DRPssMPKDiJZWFlG+4e4vr0cRG/atKr3Eqr8Xi0tQMNbtmYU1QXvFnKiFPFFGkgJ6zS6ASkG+sellcoHlQ==",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
"deepmerge": "^1.2.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
}
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
},
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
},
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz",
"integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg=="
}
}
}

View File

@ -17,5 +17,8 @@
"vuepress": "^1.3.1",
"@vuepress/plugin-back-to-top": "^1.3.1",
"@vuepress/plugin-medium-zoom": "^1.3.1"
},
"dependencies": {
"element-ui": "^2.13.2"
}
}