Embedded System - APS
Basic concepts
Definition
Any device contains microprocessor,like digital clock, hand phone, electric appliance
Short History
- Embedded system : MIT Whirlwind - flight simulation
- 1940s
 
- Embedded device : calculator - first Intel 4004
- 1970s
 
Main Properties
- Complicated and special calculation
- real-time feedback
- low power and energy consumption
- sensor information input
- direct control motor or relay
- communication between chips and outside
Composition
CPU, Flash, memory, I/O port, function module (beeper, digital tube), Auxiliary circuit( connecting ), power

Programming
- Clock, interrupter and other function part initialize
- communication inter chip or with outside program
- power manage program
- system application algorithm
Communication technology
- Inter chips - SPI (4 lines) Serial Peripheral Interface - 1 to multiple
- full duplex
- SDI : data in
- SDO
- SCLK : clock
- CS : 片选
  
- I2C ( 2 lines, half duplex ) ( synchronous serial ) 8/10bit - SDA
- SCL
  - 传输步骤  - Master发起START
- Master发送I2C addr ( 7bit ) 和w操作0 ( 1bit ) , 等待ACK
- Slave发送ACK
- Master发送reg addr ( 8bit ) , 等待ACK
- Slave发送ACK
- Master发送data ( 8bit ) , 即要写入寄存器中的数据, 等待ACK
- Slave发送ACK
- 第6步和第7步可以重复多次, 即顺序写多个寄存器
- Master发起STOP
 
 
- RS232 ( asynchronous ) 
 
- Outside - RS232 : 3-15V 1,-3~-15 0
- RS422 : 差分
- RS485 : 差分, 2-6 1, -2~-6 0
- CAN
- Ethernet
- USB
 
Components
- circuit symbol
- electronic parameter
- footprint
Resistance value
- resistor color ring 4/5/6  
- Digital symbol 
 “XXn” : $XX\times 10^n {\rm\Omega}$
 R: decimal point
- Footprint 
 Paster ( length, width$\mu m$ )- 1mil=0.0254mm, round up
- 0603 60 and 30mil
 | inch | mm |
 | :–: | :–: |
 | 0201 | 0603 |
 | 0402 | 1005 |
 | 03 | 08 |
 | 04 | 10 |
 | 05 | 12 |
 | 06 | 16 |
 | 08 | 20 |
 | 10 | 25 |
 | 12 | 32 |
 | 18 | 48 |
 | 20 | 50 |
 | 25 | 64 |
 
PCB Print Circuit Board
Electronic connection between components
- printed wiring
- boding pad
- through hole
CCL Copper-clad plate
sheet copper on insulating material
- single sided board
- double sided board
- multilayer boards
Layer definetion
- Double layer - GTO Gerber Top Overlay : text explain
- GTS Gerber Top Solder : green oil
- GTL Gerber Top Layer : electronic connect
- GBL Gerber Bottom Layer
- GBS Gerber Bottom Solder
- GBL Gerber Bottom Layer
- GKO Gerber KeepOut : shape forming
- DRL : drill hole
 
- Multilayer +Midlayer Internlayer  - Midlayer 1 G1 : 1st electronic connect
- Midlayern Gn : nth electronic connect
- Internlayer 1 GP1 : 1st information connect
- Internlayer n GPn : nth information connect
 
Make PCB
- film push
- develop
- exposure
- etching board
- wipe out

Hand welding
- Soldering iron- cleaning sponge
 
- solder wire- rosin
- solder wick : remove redundant soldering tin
- heat gun
 
- tweezer
Standard
surface smooth and blink, the cross section like moon
PCB Design
EDA Electronic Design Automation Softeware: Altium Designer :au:
Cadence Allegro,OrCAD :us:
EAGLE :de:
Design Flow in AltiumDesign
Schematic diagram design
- New project
- graph size choose A4, A3
- Set up component symbol library, choose component
- Circuit design, draw schematic diagram
- check design rule
- choose footprint
- create BOM Bill of Material
PCB diagram design
- draw new footprint
- Design PCB shape, size[Keepout Layer]- 选择单位尺寸
- 选Keepout Layer
- Place命令绘制边框
- Design->Board Shape制作
 
- Input Schematic file information : Design->Input Changeds From…
- Layout [modularity, functionalization]
- set up wiring rule
- manual[first choose layer], automatic
- Draw symbol description ( Overlay layer )
All Step
- 建立PCB项目(.PCBPRJ)
- 设计电路图(.SCHDOC)
- 为电路图中所有元器件选择适合的封装
- 确定PCB板形状, 尺寸和非布线区域(固定位置等)(.PCBDOC)
- 编译导入元器件,并分别设置各个模块中 元件在板上的位置
- 手动/自动/半自动布线(电源地点/线可不布)
- 生成敷铜层
- 增添接地点
- 在上下OVERLAYER层添加文字图形说明
- 将生成的 FOOL.PCBDOC文件送出,生产样品(打样)
- 焊接制作PCB板,测试功能正确性和完整性。若有问题则返回1重新开始
- 设计完成后根据设计记录文件写出相关设计技术文档
Digital tube



Communication
Basic concepts
- definition : object use information to communicate
- Object : any creature or functional system
- Communication way- human language
- Computer Protocol- protocol format
- sequence progress
 
 
ISO OSI Open System Interconnection
| Application | User port | HTTP / FTP / DNS | 
| Presentation | data encode/decode | ASCII / JPEG / MP3 | 
| Session | distinguish data | NETBIOS, WINSOCK | 
| Transport | reliable/unreliable data transmission | TCP / UDP | 
| Network | routing | IP,ARP | 
| Link | bit$\rightarrow$frame | SDLC / HDLC | 
| Physical | send bit flow | 232 | 



Physical
transmission media
- wireless, wired ( optical fiber /twisted-pair ) 
- 连接器类型  
- Protocol : RS232 
Data-link
- point to point 
- framing : end with wrong check  
- 检错FCS Frame Check Sequence - 奇偶校验位Parity Bit
- 校验和Checksum
- CRC Cyclic Redundancy Check
 
- 透明传输 转译ESCape字符 
- 7E$\rightarrow$7D 5E 
- 7D$\rightarrow$7D 5D
Network
Routing way

- 版本 : 4 Bit- v4 : 4个字节
- v6 : 16个字节, 128 Bit
 
- 首部长度 : 4 Bit
- 区分服务
- 总长度
- 标识
- 生存时间Time To Live : 8 Bit
- 协议 : - TCP
- UDP
- ARP
- OSPF(Open Shortest Path First开放式最短路径优先 )
 
- 首部检验和 : 16Bit+
- 源地址 : 255.255.255.255 点分十进制
- 目的地址 :
Transport
Process, Task communication
Port to port communication

端口号
1024-65535, [IP,PORT]
- 动态分配
- 其他方式 : pipe管道通信, 共享内存 
- 熟知端口号 : 0-1023 - 80 : 服务器–总台, - 开新进程 : 连接copy版
 
- 21 : 邮件
 
- 80 : 服务器–总台, 
- 登记端口号 : 1024-49151
- 客户端口号 : 49152-65535
- DOS攻击
- 用完导到另一个服务器
TCP Transmission Control Protocol[Reliable]
- 打电话, 双方 
- 基于连接 
- 全双工 : 同时相互发送 



UDP User Datagram Protocol[unreliable, no response]
- 信, 到达时间和与否不知道
- 效率高

Application
- DNS 
- FTP 
- TELNET 
- SSH 
- SMTP 
- HTTP HyperText Transfer Protocol    

ESP8266
- netassist.exe
- uartassist.exe