RTC Second interrupt

cancel
Showing results for 
Search instead for 
Did you mean: 

RTC Second interrupt

Jump to solution
993 Views
pascalschröer
Contributor V

Hi at all,

does the MK20DX128 mc support the RTC second interrupt?

regards

Labels (1)
0 Kudos
1 Solution
194 Views
mjbcswitzerland
Specialist V

Pascal

I have attached a binary for the FRDM-K20D50M which uses the 1s interrupt.

- the RED LED toggles a 1s - controlled by the RTC seconds interrupt  (and the green at 2.5Hz)

- If you connect via a terminal emulator on the OpenSDA virtual COM there is a command line menu (115k Baud) - in the administrator menu (4) there are commands to set the time and date and to display the present time and date:

  Admin. menu

===================

up              go to main menu

..

show_time        display time

set_time        Set time 01:22:56

set_date        Set Date 23:02:2010

reset            Reset device

last_rst        Reset cause

help            Display menu specific help

quit            Leave command mode

#show_time

17:04:2014 20:40:20

show_time

17:04:2014 20:40:21

show_time

17:04:2014 20:40:22

show_time

17:04:2014 20:40:23

Here you can see that the seconds are counting (driven by the interrupt).

Did you get the alarm interrupt working? The seconds interrupt is otherwise very similar - just set the seconds interrupt enable rather than the alarm interrupt enable.

Personally I don't see any real advantage of parts with the seconds interrupt since the alarm interrup can be used for second interrupts anyway. Since the RTC is just a 32 bit counter the SW needs to perform time/date management so a seconds interrupt is the simplest way to do it. The SW that is attached performs Gregorian time conversions and allows the same features as the RTC in the Coldfires (using emulation). That is, it supports seconds interrupts, minutes interrupts, hours, day interrupts, alarm and stop-watch interrupts.

If you load this to your board you can check what is missing in your configuration.

Attached is also the complete RTC interface code, including configuration, interrupt handling, Gregorian conversions, etc.

If you prefer the complete project code it is at KINETIS Project Code - this also enable you to simulate your FRDM board, the Kinetis and its peripherals so that you will be able to make better progress.

Regards

Mark

View solution in original post

0 Kudos
7 Replies
194 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Pascal,

I recommend customer to refer Kinetis 100MHz RTC example code, which generate an interrupt every second.

Customer can download the example code from below link, the project is [rtc_demo].

The software should be very similar with your application, and customer need to check RTC second interrupt related interrupt vector number.

KINETIS512_V2_SC  : Kinetis 100MHz Rev 2 Example Projects:

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-K60D100M&fpsp=1&tab=Design_Tools_...


Wish it helps.

Best regards,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

194 Views
pascalschröer
Contributor V

Thanks for you help but it doesen't work... I have created a second interrupt with the help of PEX but that doesn't work too... Is it possible,

that there is a interrupt vector number in the datasheet, but not implemented in my special MCU? Because all the other interrupts

(PIT, WDOG, alram) work like they should. Now I have created a RTC with the help of a PIT interrupt but that isn't the solution of my problem^^

thanks :smileywink:

0 Kudos
195 Views
mjbcswitzerland
Specialist V

Pascal

I have attached a binary for the FRDM-K20D50M which uses the 1s interrupt.

- the RED LED toggles a 1s - controlled by the RTC seconds interrupt  (and the green at 2.5Hz)

- If you connect via a terminal emulator on the OpenSDA virtual COM there is a command line menu (115k Baud) - in the administrator menu (4) there are commands to set the time and date and to display the present time and date:

  Admin. menu

===================

up              go to main menu

..

show_time        display time

set_time        Set time 01:22:56

set_date        Set Date 23:02:2010

reset            Reset device

last_rst        Reset cause

help            Display menu specific help

quit            Leave command mode

#show_time

17:04:2014 20:40:20

show_time

17:04:2014 20:40:21

show_time

17:04:2014 20:40:22

show_time

17:04:2014 20:40:23

Here you can see that the seconds are counting (driven by the interrupt).

Did you get the alarm interrupt working? The seconds interrupt is otherwise very similar - just set the seconds interrupt enable rather than the alarm interrupt enable.

Personally I don't see any real advantage of parts with the seconds interrupt since the alarm interrup can be used for second interrupts anyway. Since the RTC is just a 32 bit counter the SW needs to perform time/date management so a seconds interrupt is the simplest way to do it. The SW that is attached performs Gregorian time conversions and allows the same features as the RTC in the Coldfires (using emulation). That is, it supports seconds interrupts, minutes interrupts, hours, day interrupts, alarm and stop-watch interrupts.

If you load this to your board you can check what is missing in your configuration.

Attached is also the complete RTC interface code, including configuration, interrupt handling, Gregorian conversions, etc.

If you prefer the complete project code it is at KINETIS Project Code - this also enable you to simulate your FRDM board, the Kinetis and its peripherals so that you will be able to make better progress.

Regards

Mark

View solution in original post

0 Kudos
194 Views
pascalschröer
Contributor V

Now it works!

Thank you :smileyhappy:

regards

0 Kudos
194 Views
mjbcswitzerland
Specialist V

Pascal

The best place to look is in the interrupt vector table in the user's manual to the exact part that you are using.

Some devices have just the Alarm interrupt and some have the alarm and seconds interrupt.The 72MHz K20DX128, for example, has a seconds interrupt at IRQ 67 (and the alarm at IRQ66).

Regards

Mark

0 Kudos
194 Views
pascalschröer
Contributor V

Some more information, I have set the RTC module with the help of PEX but that isn't possible. It says that it's only possible if the HW supports the second interrupt.

Well but where can I see this? In the Sub family reference it is suported and I don't find any else datasheet...

regards

Pascal

0 Kudos
194 Views
pascalschröer
Contributor V

Well I did that... in the K20 Sub family reference there is the RTC second interrupt described as IRQ 29

(VECTOR 44) but if I would like to activate, the interrupt doesn't fire... So I though that the interrupt isn't

implemented maybe. By the way, the Alarm interrupt works like it should, that is IRQ 28... so I don't kwon what's wrong with the second interrupt.

regards

Pascal

0 Kudos