当前位置:网站首页>[development tutorial 5] crazy shell arm function mobile phone serial port experiment tutorial
[development tutorial 5] crazy shell arm function mobile phone serial port experiment tutorial
2022-07-20 21:10:00 【efans_ Mike】
ARM Feature phone
—— Crazy shell · Development board series
Serial port experiment tutorial
chart 1
Section 1 serial port hardware circuit
Serial port through USB Mouth and bracelet download debugging line lead out , Connect MCU Of P12 And P13 Pin , As shown in the figure below :
chart 2
In the second quarter UART register
2.1 UART Introduce
This UART Meet industry standards 16550, And it can communicate with peripheral devices in serial . Main equipment (CPU) adopt APB The bus writes data into UART And it is converted into serial format and sent to the target device . Serial data can also be accessed through UART After being received and stored , The master device reads the received data .
UART Module not supported DMA, But it has an interior FIFOs, And support hardware flow control signals (RTS,CTS,DTR,DSR).
UART Module has 16 Byte sending and receiving FIFO; Support hardware flow control (CTS/RTS); Shadow register to reduce software overhead and programmable software reset ; Send interrupt mode with empty register ;IrDA 1.0 SIR Mode supports low power consumption mode ; Programmable byte attributes 、 Check bit and stop bit (1,1.5,2); It can disconnect the communication and detect whether the communication line is disconnected ; Identification of interrupt priority ; Programmable serial communication baud rate .
2.2 UART register
UART There are many related registers , So we only introduce the commonly used registers , For others, please refer to the official data manual DA14580_DS_v3.1.pdf, Located in the directory :..\WT Development board \ Hardware information .
2.2.1 Receive buffer register
chart 3
15:8 position : Keep unused ;
7:0 position : Receive buffer register .
2.2.2 Interrupt enable register
chart 4
15:8 position : Keep unused ;
7 position : Send the air interrupt enable bit ;
6:4 position : Keep unused ;
3 position : Modulation state interrupt enable bit ;
2 position : Receive status interrupt enable bit ;
1 position : Send end interrupt enable bit ;
0 position : Data received enable bit .
2.2.3 Interrupt identification register /FIFO Control register
chart 5
15:0 position : Write as FIFO Control register , Read is interrupt identification register .
2.2.4 Communication line control register
chart 6
15:8 position : Keep unused ;
7 position : Baud rate enable bit ;
6 position : Stop control bit ;
5 position : Keep unused ;
4 position : Parity select bit ;
3 position : Check bit ;
2 position : Stop bit ;
1:0 position : Data length .
2.2.5 Modulator control register
chart 7
15:7 position : Keep unused ;
6 position : Infrared communication enable bit ;
5 position : Automatic flow control enable bit ;
4 position : Loop position , Used for testing ;
3 position : User specified output 2;
2 position : User specified output 1;
1 position : Send a request ;
0 position : Keep unused .
2.2.6 Communication line status register
chart 8
15:8 position : Keep unused ;
7 position : receive FIFO Error bit ;
6 position : Transmitter vacancy ;
5 position : Send hold register empty ;
4 position : Abnormal stop in broken position ;
3 position : Frame error bit ;
2 position : Check the error bit ;
1 position : Overflow error bit ;
0 position : Data ready bits .
2.3 Explanation of register configuration
#define CLK_PER_REG (* ( volatile uint16*)0x50000004)
#define UART_RBR_THR_DLL_REG (* ( volatile uint16*)0x50001000)
#define UART_IER_DLH_REG (* ( volatile uint16*)0x50001004)
#define UART_IIR_FCR_REG (* ( volatile uint16*)0x50001008)
#define UART_LCR_REG (* ( volatile uint16*)0x5000100C)
#define UART_MCR_REG (* ( volatile uint16*)0x50001010)
#define UART_LSR_REG (* ( volatile uint16*)0x50001014)
#define UART_MSR_REG (* ( volatile uint16*)0x50001018)
#define UART_SCR_REG (* ( volatile uint16*)0x5000101C)
start-up UART1 Module clock CLK_PER_REG |= 0x0080;
Serial port initialization register configuration :
First enable baud rate configuration UART_LCR_REG = 0X08;
Configure baud rate UART_IER_DLH_REG = 0; UART_RBR_THR_DLL_REG = 9;
8 Bit data , No verification ,1 Bit stop bit UART_LCR_REG = 0X03;
Turn off the infrared communication function UART_MCR_REG = 0X00;
Can make FIFO, UART_IIR_FCR_REG = 0X01;
Turn off interrupt UART_IER_DLH_REG = 0X00;
Receive a byte , Wait for reception to complete while((UART_LSR_REG&0x01)==0); Read received data rx_data = UART_RBR_THR_DLL_REG;
Send a byte 0x55, Waiting to send is empty while((UART_LSR_REG&0x20)==0); Fill in the sending data UART_RBR_THR_DLL_REG = 0xaa;
In the third quarter UART experiment
The modules used in the experiment are : Bottom plate of mobile phone development board ,Jlink Debugging tools ,USB Conversion module 、 DuPont line 、3.7V Lithium battery or Mocro USB Line .
Use USB The serial transfer module is connected to the Bluetooth serial port of the mobile phone , The connection is as follows :
(1)USB One end of the transfer module only needs to be connected with DuPont line RXD、TXD、GND Three pins , As shown in the figure below :
chart 9
(2) One end of the main control backplane of the mobile phone needs to use DuPont cable to connect to the left J7 Three pins , And USB The pins of the conversion module correspond one by one ( Serial port pins cross ), Respectively RXD-->TXD、TXD-->RXD、GND-->GND, As shown in the figure below :
chart 10
Use JLINK Connect your mobile phone with Bluetooth via DuPont cable , The connection is as follows :
(1)JLINK One end only needs to be connected with DuPont wire JLINK Of SWC、SWD、GND Three pins , As shown in the figure below :
chart 11
(2) The Bluetooth end of the mobile phone needs to use DuPont cable to connect the upper right J3 Three pins , And JLINK The connecting pins of the correspond one by one , Respectively SWC-->SWCLK、SWD-->SWDIO、GND-->GND, As shown in the figure below :
chart 12
take JLINK Plug in the computer USB Interface , After connecting, power the main control board of the mobile phone , For detailed introduction, please refer to 《 How to power on 》 course , Path is :..\WT_Mobile\0. So let's start here \0. Power on test .
Open serial port experiment Keil engineering uart.uvproj, Located in the directory :..\WT_Mobile\1. Junior course \DA14580\2_ primary _ A serial port \projects\target_apps\peripheral_examples\uart\Keil_5, As shown in the figure below :
chart 13
Open the serial port debugging assistant to connect the serial port , The baud rate is 115200. stay KEIL in , Compile code , Click on DEBUG, Then click Run at full speed , You can see the information printed by the serial port debugging assistant , Return whatever you send , For example, send “WT Mobile Test!” It will return “WT Mobile Test!”, As shown in the figure below :
chart 14
More complete learning materials and corresponding open source Suites , Please visit the official website :“ Crazy shell ”
For customized development , Please use the official website “ Crazy shell ” At the bottom of the page “ Contact us ” Make contact
边栏推荐
猜你喜欢
【快速上手教程2】疯壳·开源编队无人机-硬件资源简介
How to make a reliable delay queue with redis (classic collection version)
Skynet天网监测到的数笔可疑交易背后:又一欺诈项目Forest Tiger Pro被确认
远程登陆----radius认证
103. (cesium chapter) cesium honeycomb diagram (square)
几点建议:给想进入Web3的创作者们
Alternative interpretation of the macro situation: the Federal Reserve may soon end the process of raising interest rates and return to quantitative easing?
web:从10到1的编译大重构
Leetcode interview question 05.06 Integer conversion
Brief introduction of yolov3 spp ultralytics model
随机推荐
在线会议中人脸面部轮廓图像提取(三)——Dlib库人脸面部轮廓图像特征提取
Mktdt02 txt
Install the SVN tool TortoiseSVN
Leetcode interview question 05.06 Integer conversion
Dear bosses, how does MySQL CDC slice a table without a primary key?
The principles and methods of using the generator and using the generator to realize simple projects (including detailed explanation and parameter transmission)
Llvm pass PWN getting started (3)
Cookie addition, deletion, modification and exception
Communication overhead: a key factor limiting the size of rediscluster
DNS原理及配置
A review of the latest introduction to neural data compression
leetcode 面试题 05.06. 整数转换
10000人游戏服务器怎么选?
Introduction and use cases of iterator
2022/07/19 学习笔记 (day11) 方法重载
2022杭电多校联赛第一场 题解
报告解读下载 | 墨天轮七月数据库行业报告,居安思危,安全先行
LeetCode每日一题(396. Rotate Function)
Customize ViewGroup container horizontalscrollviewex
How to make a reliable delay queue with redis (classic collection version)