S3C2440 bare metal experiment timer

Publisher:740322lwjLatest update time:2021-10-18 Source: eefocusKeywords:S3C2440  timer Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

S3c2440 has 5 16-bit timers. Timers 0, 1, 2, and 3 have pulse width modulation (PWM) functions. Timer 4 has an internal timer without an output pin. Timer 0 has a dead zone generator for high-current devices.
 
Timers 0 and 1 share an 8-bit prescaler (prescaler), and timers 2, 3, and 4 share another 8-bit
prescaler .
 
 
The clock source of the timer is PCLK, which first passes through the prescaler to reduce the frequency and then enters the second division. Five different division signals (1/2, 1/4, 1/8, 1/16 and TCLK) can be generated.
 
After the timer is started, TCNTn starts to count down by one. When TCNTn is equal to TCMPn, TOUTn reverses and TCNTn continues to decrement.


When TCNTn= 0, TOUTn reverses again and triggers an interrupt (the interrupt is enabled).
If TCON is set to auto-load, the value of TNCTn/TCMPNn is reloaded.
 
Register:
TCFG0: Configure two 8-bit prescalers, [15:8] These 8 bits determine the prescaler value of timer 2, 3, and 4, [7:0] These 8 bits determine the prescaler value of timer 0 and 1
Output frequency: = PCLK / (prescaler value + 1)
 
TCFG1:
Used to set the second divider. Five different divider signals can be set (1/2, 1/4, 1/8, 1/16 and TCLK).
 
So
the timer operating frequency = PCLK / (prescaler value + 1) / (divider value)
 
divider value = 2,4,8, 16
 
TCON: Timer control register
 
TCNTBn: Set an initial value to be loaded into the down counter.
 
TCMPBn: Sets an initial value to be loaded into the compare register for comparison with the down
counter value.
 
TCNTOn: Reads the value of TCNTBn
 
Timer initialization example:
void timer0_init(void)
{
    TCFG0 = 99; // Prescaler 0 = 99        
    TCFG1 = 0x03; // Select 16-division
    TCNTB0 = 31250; // Trigger an interrupt once every 0.5 seconds
    TCON |= (1<<1); // Manual update

    TCON = 0x09; // Automatically load, clear the "manual update" bit, and start timer 0

}


Keywords:S3C2440  timer Reference address:S3C2440 bare metal experiment timer

Previous article:01 ubuntu20.04 2440 environment construction
Next article:[JZ2440 Notes] Bare Metal Experiment Using Interrupts

Recommended ReadingLatest update time:2024-11-16 11:45

Embedded ARM Learning Summary (VII) - Interrupt - Based on S3C2440
1. Interrupt the execution process 1) Save the PC value before the interrupt 2) Keep CPSR to spsr before interruption 3) Modify the corresponding value of CPSR and enter the corresponding abnormal mode 4) Execution exception 5) Now restore SPSR to CPSR 6) Restore your PC    ARM hardware does not support nested int
[Microcontroller]
S3C2440 development board practice (11): synchronization and mutual exclusion
Atomic operation implementation Purpose: Prevent two processes from opening the same file at the same time. Exit automatically when the latter process opens the file. Defining atomic variables Define an atomic variable v and initialize it to 1 atomic_t canopen = ATOMIC_INIT(1); Get Lock Decrement the atomic variab
[Microcontroller]
s3c2440 bare metal - i2c programming - 2 - i2c controller
1.I2C master and slave device relationship For write operations, the master acts as a transmitter and the slave device acts as a receiver. For read operations, the master acts as a receiver and the slave device acts as a transmitter. 2.I2C controller 2.1 Overall Block Diagram
[Microcontroller]
Design of Fragment Velocity Measurement System for Shooting Range Based on S3C2440 and EP2S15 Chips
0 Preface Fragment velocity is an important parameter for evaluating the effectiveness of warhead explosion. Traditional range fragment velocity measurement systems mostly use multi-channel data acquisition cards to set parameters to collect the test waveform of the target on-site. After the test is completed, it is h
[Microcontroller]
Design of Fragment Velocity Measurement System for Shooting Range Based on S3C2440 and EP2S15 Chips
S3C2440 UART usage notes
  Uart_Init(0,115200); ////////////////////////////////********************************************************************//////////////////////////////////////////////// void Uart_Init(int pclk,int baud) {     int i;     if(pclk == 0)     pclk    = PCLK;     rUFCON0 = 0x0;   //UART channel 0 FIFO control register, F
[Microcontroller]
Talk about the comparison with S3C2440
I recently did a Linux platform project with a certain amount of computing. Due to the power consumption requirements, I chose this S5P210 Cortex-A8 development board. The photos are as follows. Overall, the workmanship is relatively good. In particular, the core board manufacturer said that it was directly transferre
[Microcontroller]
Talk about the comparison with S3C2440
Talk about the welding of BGA chip S3C2440
When you first come into contact with BGA chips, you may feel overwhelmed. The first reason is that they have to be laid out in more than four layers, which makes it difficult to find problems. The second reason is that the vias and line widths are small, which makes it easy to have problems. In fact, there is no need
[Microcontroller]
How to use ARM serial port (UART) (S3C2440)
UART Overview Universal Asynchronous Receiver and Transmitter (UART) Working mode: serial, full-duplex. Only 3 wires are needed: TXD (transmit data), RXD (receive data), GND. Data transmission process: It was originally high level (idle state) The sender pulls the level low and holds it for 1 bit, which is the sta
[Microcontroller]
How to use ARM serial port (UART) (S3C2440)
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号