0% found this document useful (0 votes)
55 views

S. Assume The Bus Clock Is Running at 16 MHZ

The document contains questions and answers about the SysTick timer. The SysTick timer is 24 bits wide and counts down at the bus clock frequency, which is initially 16 MHz. Reading the current value register returns the counter value, while writing clears the register and count bit. A C function is provided to wait 100 microseconds using SysTick by loading a reload value, clearing the current value, and waiting in a loop for the count flag to trigger.

Uploaded by

Jafar Hussain
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

S. Assume The Bus Clock Is Running at 16 MHZ

The document contains questions and answers about the SysTick timer. The SysTick timer is 24 bits wide and counts down at the bus clock frequency, which is initially 16 MHz. Reading the current value register returns the counter value, while writing clears the register and count bit. A C function is provided to wait 100 microseconds using SysTick by loading a reload value, clearing the current value, and waiting in a loop for the count flag to trigger.

Uploaded by

Jafar Hussain
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

EE319K Lecture Lec6.

ppt in class worksheet


Question 1. How many bits wide is the SysTick timer?

Question 2. Does SysTick count up or down?

Question 3. At what rate does SysTick count?

Question 4. What happens if you read from NVIC_ST_CURRENT_R?

Question 5. What happens if you write to NVIC_ST_CURRENT_R?

Question 6. Write a C function that uses SysTick to wait 100 s. Assume the bus clock is
running at 16 MHz.
Answer 1. SysTick is 24 bits.
Answer 2. SysTick counts down
Answer 3. SysTick counts at the bus clock frequency. In this class the bus clock is
initially 16 MHz and will change to 80 MHz once we activate the phase lock loop (PLL).
Answer 4. Reading NVIC_ST_CURRENT_R gets the current value of the counter.
Answer 5. When write any value to NVIC_ST_CURRENT_R it clears this register and
also clears the COUNT bit in the NVIC_ST_CTRL_R register.
Answer 6. (1599+1)*62.5ns = 100 s.
void SysTick_100usWait(void){
NVIC_ST_RELOAD_R = 1599; // number of counts to wait
NVIC_ST_CURRENT_R = 0; // any value written to CURRENT clears
while((NVIC_ST_CTRL_R&0x00010000)==0){ // wait for count flag
}
}

You might also like