当前位置:网站首页>[development tutorial 11] crazy shell arm function mobile phone timer experimental tutorial
[development tutorial 11] crazy shell arm function mobile phone timer experimental tutorial
2022-07-27 23:56:00 【efans_ Mike】
ARM Feature phone
—— Crazy shell · Development board series
Timer experiment tutorial
chart 1
8LED Hardware circuit
There is a controllable in the board LED, Connect to DA14580 Of P24 Pin ,LED Series connection 1K Current limiting resistance of , As shown in the figure below :
chart 2
In the second quarter Timer register
2.1 Timer Introduce
The software timer module contains two timer modules , They can be controlled by software 、 Programmed and used for various tasks .
2.1.1 Timer0
Timer 0 Yes 16 Bit Universal timer ; It can generate two PWM signals ; Programmable output frequency ; Programmable duty cycle ; Programmable software interrupts .
2.1.2 Timer2
Timer 2 Yes 14 Bit Universal timer ; Can produce 3 Channel PWM signal ; The input clock frequency is 16MHz; Programmable input frequency ; Adjustable duty cycle ; For white LED Brightness control .
2.2 Register introduction
2.2.1 Timer 0 Control register
chart 3
15:4 position : Keep unused ;
3 position :PWM Mode selection ,’0’ Express PWM Output when the signal is high ’1’,’1’ Express PWM When the signal is high, it outputs the bisection of the fast clock signal , Then the output frequency range is 1~8MHz;
2 position : Timer 0 Clock frequency division of , by ’1’ Use the selected clock source frequency , by ’0’ Use the selected clock source 10 frequency division , Note that this value applies to the count register ;
1 position : Clock source selection ,’1’ Use a fast clock (16、8、4、2MHz),’0’ Use a slow clock (32KHz);
0 position : Timer 0 Control bits ,’0’ Indicates a timer 0 Close and reset ,’1’ Timer 0 function .
2.2.2 Timer 0 Count control register
chart 4
Timer 0 Count reload values , If this register is read, the value of the current counter is returned .
2.2.3 Timer 0 High level reload value
chart 5
Timer 0 High level reload value , If this register is read, the timer is returned 0 The count of .
2.2.4 Timer 0 Low level reload value
chart 6
Timer 0 Low level reload value , If this register is read, the timer is returned 0 The count of .
2.2.5 PWM2 Duty cycle
chart 7
PWM2 Duty cycle of the signal .
2.2.6 PWM3 Duty cycle
chart 8
PWM3 Duty cycle of the signal .
2.2.7 PWM4 Duty cycle
chart 9
PWM4 Duty cycle of the signal .
2.2.8 PWM2,3,4 The frequency of
chart 10
PWM2、3、4 The frequency of the signal , The three signals have the same frequency .
2.2.9 PWM2,3,4 Control register
chart 11
2 position : Hardware pause enable , by ’1’ Then the hardware can stop PWM2、3、4.
1 position : Software pause enable , by ’1’ be PWM2、3、4 Pause .
0 position :PWM Signal enable , by ’1’ be PWM2、3、4 Can make .
2.3 Explanation of register configuration
#define CLK_PER_REG (* ( volatile uint16*)0x50000004)
#define TIMER0_CTRL_REG (* ( volatile uint16*)0x50003400)
#define TIMER0_ON_REG (* ( volatile uint16*)0x50003402)
#define TIMER0_RELOAD_M_REG (* ( volatile uint16*)0x50003404)
#define TIMER0_RELOAD_N_REG (* ( volatile uint16*)0x50003406)
#define PWM2_DUTY_CYCLE (* ( volatile uint16*)0x50003408)
#define PWM3_DUTY_CYCLE (* ( volatile uint16*)0x5000340A)
#define PWM4_DUTY_CYCLE (* ( volatile uint16*)0x5000340C)
#define TRIPLE_PWM_FREQUENCY (* ( volatile uint16*)0x5000340E)
#define TRIPLE_PWM_CTRL_REG (* ( volatile uint16*)0x50003410)
start-up Timer0 Module clock :CLK_PER_REG |= 0x0008;
Timer 0 initialization , Select high frequency clock , normal PWM Pattern , No frequency division , be TIMER0_CTRL_REG = 0X0E;
Set the count value to 1000, The high level is 500, The low level is 200, be TIMER0_ON_REG=1000; TIMER0_RELOAD_M_REG=500; TIMER0_RELOAD_N_REG=200;
On timer interrupt NVIC_SetPriority (SWTIM_IRQn, 254); NVIC_EnableIRQ(SWTIM_IRQn);
Start timer TIMER0_CTRL_REG = (TIMER0_CTRL_REG|0x01);
In the third quarter Timer experiment
The modules used in the experiment are : Bottom plate of mobile phone development board ,Jlink Debugging tools , DuPont line 、3.7V Lithium battery or Mocro USB Line .
Use JLINK Connect the mobile phone through DuPont line. Bluetooth is located on the main control backplane of the mobile phone , 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 12
(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 13
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 the timer to experiment Keil engineering timer0_general.uvproj, Located in the directory :
..\WT_Mobile\1. Junior course \DA14580\3_ primary _ Timer \projects\target_apps\peripheral_examples\timer0\timer0_general\Keil_5. As shown in the figure below :
chart 14
Use the bracelet to debug and connect the download cable Jlink, compile , Click on DEBUG, Then click Run at full speed , You can see blue LED flashing , As shown in the figure below :

chart 15
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
边栏推荐
- BUU-CTF basic rsa
- BUUCTF-Baby RSA
- BUUCTF-childRSA费马小定理
- BUUCTF-bbbbbbrsa
- The txt file named according to the sequence number is renamed from the back to the front
- New technology leads new changes in marketing of large and medium-sized enterprises, and UFIDA BiP CRM is launched!
- xss.haozi.me练习通关
- [RoarCTF2019]RSA
- 给网站套上Cloudflare(以腾讯云为例)
- Socket interaction process of four waves
猜你喜欢

Unity implements simple Sketchpad drawing function (notes)

如果我们是那晚负责修复 B 站崩了的开发人员

Redefine analysis - release of eventbridge real-time event analysis platform
![[December Haikou] the 6th International Conference on ships, marine and Maritime Engineering in 2022 (naome 2022)](/img/a4/041268aadd5d8ff493b52ead9c5e79.png)
[December Haikou] the 6th International Conference on ships, marine and Maritime Engineering in 2022 (naome 2022)

Bank Marketing预测一个客户购买理财产品的成功率

【C语言】通讯录(动态版本)

Decrypt the secret of 90% reduction in oom crash~

TCP的粘包拆包问题+解决方案

消息队列常见的几种使用场景介绍

传奇外网架设教程带图文解说——Gom引擎
随机推荐
The share price soared 180.46%! Shanghai silicon industry, the leader of domestic large silicon wafers, is listed: the cumulative net profit in recent four years is less than 60million
Key points of data management
主数据管理理论与实践
Binary conversion method
Sudden, wechat important notice
硬布线控制器的特点:
Why do I need to wait for 2msl?
Construction and application of super large scale knowledge map of ants
MySQL之数据查询(WHERE)
Is it really hard to understand? What level of cache is the recyclerview caching mechanism?
Solve 5g pain points, Meizu 17 smart 5g fast and stable technology release
Lua basic grammar learning
Bank Marketing预测一个客户购买理财产品的成功率
What is the difference between concurrency and parallelism?
BUUCTF-Dangerous RSA
Buuctf childrsa Fermat theorem
[C language] address book (dynamic version)
网站被黑后处理方法及删除批量恶意代码的方法步骤
Comparison between virtual memory and cache
[ACTF新生赛2020]crypto-aes