LPC15xx: Using SCT as a simple timer...

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC15xx: Using SCT as a simple timer...

1,037 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 1234567890 on Mon Jan 05 14:04:04 MST 2015
LPCOpen for LPC15xx offers a lot, but nothing I found to use the SCT as a [u]simple[/u] timer.
LPCOpen documentation starts with a missing module 'State Configurable Timer driver'. Just 'State Configurable Timer PWM driver' is there, although the package contains sct_15xx.c and sct15xx.h.
There I miss functions like Chip_SCT_ReadCount, Chip_SCT_ReadCountL and Chip_SCT_ReadCountH. UM10736 talks only about writing this register?

And from my point of view:
- The function Chip_SCT_SetCount uses the member COUNT_U
- The function Chip_SCT_SetCountL uses the member COUNT_L
- The function Chip_SCT_SetCountH uses the member COUNT_H

So why isn't 'Chip_SCT_SetCount' not named 'Chip_SCT_SetCountU'?

Edit: Corrected typo in the last sentence, so last character is 'U'.
Labels (1)
0 Kudos
6 Replies

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 1234567890 on Tue Jan 06 13:00:21 MST 2015
Well, let me...  of course... not necessarily... it's possible that...
It's about a counter used as a timer, with constant clock source, free running, without interrupts, just polling until...
Yes, one can name it counter.

Of course it's a shame to waste this peripheral for such simple things, especially because there are more simple timers to rape (RIT, MRT).
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Jan 06 10:15:17 MST 2015

Quote: 1234567890
@ R2D2: Thank's, I have found it before and it is very helpful. But my 'problem' is that LPCOpen doesn't support such simple things (yet).
Of course it's very easy to implement these functions by myself (or directly with CMSIS), but it should be in the package for general usage and convenience.



:~

I'm not sure what you are trying to do...

A simple timer to toggle a LED without interrupt, a simple time to generate an interrupt (like SysTick) ?

Or are we talking about counter ?
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Tue Jan 06 10:00:31 MST 2015
Hi 1234567890,
Thanks for your below feedback.


Quote:
@ R2D2: Thank's, I have found it before and it is very helpful. But my 'problem' is that LPCOpen doesn't support such simple things (yet).
Of course it's very easy to implement these functions by myself (or directly with CMSIS), but it should be in the package for general usage and convenience.




We will look into it.
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 1234567890 on Tue Jan 06 04:39:37 MST 2015
I corrected a typo in the original post.

@ R2D2: Thank's, I have found it before and it is very helpful. But my 'problem' is that LPCOpen doesn't support such simple things (yet).
Of course it's very easy to implement these functions by myself (or directly with CMSIS), but it should be in the package for general usage and convenience.

@ mc:Thank you as well. Of course I read 16.6.7 of the UM where the last sentence 'Software
can read the counter registers at any time' is missed (and not 15.6.8).
But yes, with fresh eyes there is some more information about reading the register in that chapter(s).
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Mon Jan 05 15:30:00 MST 2015
Hi,
You can read counter see below text from UM

"Writing to the COUNT_L, COUNT_H, or unified register is only allowed when the
corresponding counter is halted (HALT bits are set to 1 in the CTRL register). Software
can read the counter registers at any time."


See below image from UM
http://www.lpcware.com/system/files/LPC1500Sct.PNG
0 Kudos

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Jan 05 14:35:58 MST 2015

Quote: 1234567890
LPCOpen for LPC15xx offers a lot, but nothing I found to use the SCT as a [u]simple[/u] timer.



http://www.lpcware.com/content/nxpfile/an11538-sctimerpwm-cookbook
0 Kudos