How to see the 1Hz RTC Clock on RTC_CLKOUT

cancel
Showing results for 
Search instead for 
Did you mean: 

How to see the 1Hz RTC Clock on RTC_CLKOUT

483 Views
kevinyuthermo
Contributor III

MK64FN1M0VLQ12

I am trying to get the 1Hz square wave RTC output clock on PTE_26(Alt6).

I am using the code below, but unable to get the wave, it is always HIGH.

CLOCK_EnableClock(kCLOCK_PortE);
PORT_SetPinMux(PORTE, 26, kPORT_MuxAlt6); // RTC_CLKOUT
CLOCK_SetRtcClkOutClock(0);

Can anyone help me out?

Kevin

0 Kudos
5 Replies

260 Views
kevinyuthermo
Contributor III

Hi Mark,

To enable RTC, I use the code below:

rtc_config_t rtcConfig;

RTC_GetDefaultConfig(&rtcConfig);
RTC_Init(RTC, &rtcConfig);

To allow its output to be supplied to other peripherals:

CLOCK_SetRtcClkOutClock(0);

But test shows the RTCCLKOUT pin is always HIGH, no square wave output.

0 Kudos

260 Views
mjbcswitzerland
Specialist V

Hi Kevin

In the uTasker project we do:


fnClkout(RTC_CLOCK_OUT);                                         // connect the RTC to RTC_CLKOUT
fnStartRTC(0);                                                   // start the RTC if it isn't yet operating

These essentially do:
_CONFIG_PERIPHERAL(E, 26, (PE_26_RTC_CLKOUT | PORT_SRE_SLOW | PORT_DSE_LOW)); // configure the RTC_CLKOUT pin (alt. 6)
See http://www.utasker.com/forum/index.php?topic=1875.0 for a description of macro usage

POWER_UP_ATOMIC(6, RTC);                                         // enable access and interrupts to the RTC
RTC_CR = (RTC_CR_OSCE | RTC_CR_CLKO);                            // enable oscillator but don't supply clock to other peripherals
// wait stabilisation time, if turned on for the first time
RTC_SR = RTC_SR_TCE;                                             // enable counter

I have attached a binary for the FRDM-K64F which you can load to your board which will output the 1Hz RTC_CLKOUT and hence flash the green LED at 1Hz.
On the OpenSDA VCOM there is a command line interface (at 115200Baud) with a memory viewer (go to the I/O menu) to see the commands and usage (the same CLI is also available on the processor's USB port that appears as a VCOM too):

 Input/Output menu
===================
up             go to main menu
md             Memory Display [address] [<l>|<w>|<b>] [num]
mm             Memory Modify [address] [<l>|<w>|<b>] [val]
mf             Memory Fill [address] [<l>|<w>|<b>] [val] [num]
sd             Storage Display {as md}
sm             Storage Modify {as mm}
sf             Storage Fill {as mf}
se             Storage Erase [address] [len-hex]
lp_cnt         Read LPTMR CNT
save           Save port setting as default
help           Display menu specific help
quit           Leave command mode

and you can read register values to see what differences there are to your setup, or else use a debugger to pause the operation and view the internal registers.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html
RTC and time keeping: http://www.utasker.com/docs/uTasker/uTasker_Time.pdf

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

0 Kudos

260 Views
kevinyuthermo
Contributor III

Hi Mark,

Where is the binary image for the FRDM-K64F? Can you share me the source?

0 Kudos

260 Views
mjbcswitzerland
Specialist V

Hi Kevin

>>Where is the binary image for the FRDM-K64F?
It is attached to the previous post; possibly you need to be logged in to see it (?)

>>Can you share me the source?
I shared the basic commands and linked to the complete project in the last post.

Regards

Mark

0 Kudos

260 Views
mjbcswitzerland
Specialist V

Kevin

You have configured the RTC_CLKOUT pin but have you enabled the RTC and allowed its output to be supplied to other peripherals?

Regards

Mark

0 Kudos