Jump to content
43oh

A few question on systick


Recommended Posts

Hello,

I have the EK-TM4C123GXL launchpad and I'm learning to use the systick counter. I have a few questions.

The internal oscillator is 16.0 MHz, so the smallest time unit is 1/16e6 = 62.5 ns.

 

I have written a program that toggles a the red LED at 5s intervals. The problem is that the values I used do not match the frequency of the internal oscillator :

 

Reload value = 0x00FFFFFF

Number of loops : 15

Theoretical time delay = 15 * 0x00FFFFFF * 62.5ns = 15 * 16777215 * 62.5e-9 = 15.728s

That theoretical time delay is 3 times larger than what I really get !!

 

More over, when I setup the PLL with different frequencies, I still get the same value !

 

Where (in a program)  does one change the OSCSRC2 value of RCC2 register (p260 of the datasheet) ? I would like to try PIOSC / 4.

 

 

Here's the datasheet link  : http://www.ti.com/lit/ds/symlink/tm4c123gh6pm.pdf

 

Thanks

 

 

main.c

Link to post
Share on other sites

Hi,

 

The frequency of the internal oscillator doesn't yet determine the actual clock frequency of the CPU - the PLL gets in the mix, too.

 

From your observation of a 5s interval, I bet your CPU is running at 50 MHz.

 

Suggest you download TI's TivaWare, then take a look at the source of the SysCtlClockSet function and the documentation as well.

Link to post
Share on other sites

Hello,

I have the EK-TM4C123GXL launchpad and I'm learning to use the systick counter. I have a few questions.

The internal oscillator is 16.0 MHz, so the smallest time unit is 1/16e6 = 62.5 ns.

 

I have written a program that toggles a the red LED at 5s intervals. The problem is that the values I used do not match the frequency of the internal oscillator :

 

Reload value = 0x00FFFFFF

Number of loops : 15

Theoretical time delay = 15 * 0x00FFFFFF * 62.5ns = 15 * 16777215 * 62.5e-9 = 15.728s

That theoretical time delay is 3 times larger than what I really get !!

 

More over, when I setup the PLL with different frequencies, I still get the same value !

 

Where (in a program)  does one change the OSCSRC2 value of RCC2 register (p260 of the datasheet) ? I would like to try PIOSC / 4.

 

 

Here's the datasheet link  : http://www.ti.com/lit/ds/symlink/tm4c123gh6pm.pdf

 

Thanks

 

 

You don't use the 16Mhz of the internal oscilator for the math. The SysTick clock is supplied by the system clock.

I have here a code that i use every time i start a project that sets the system tick to interrupt every 1mS, i didn't use the SysCtlClockGet because i think there was a bug with it and i don't know if it's already fixed.

https://sites.google.com/site/luiselectronicprojects/tutorials/create-a-tiva-project

Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...