This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTC_IRQHandler never entered

Hi everybody,

I want to use the the RTC (Real Time Counter) interrupt in my code. To do it, I need to program the associated RTC_IRQHandler function which is declared in the startup-ARMC0plus.s file.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;/**************************************************************************//**
; * @file startup_ARMCM0plus.s
; * @brief CMSIS Core Device Startup File for
; * ARMCM0plus Device Series
; * @author S.Wright
; * @version v1.1.0
; * @date 2018/06/19
; * @attention changes from original startup_ARMCM0plus.s are copyright: 2016..2018, Cobham AES
; *
; * @note
; *
; ******************************************************************************/
;/* Copyright (c) 2012 ARM LIMITED
;
; All rights reserved.
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; - Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; - Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

First, I initialized the RTC in a counter.c file as follow. It wrap when it reaches 0x1FFFFFFF and the interruption must be risen.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#define C_RTC_PLACE_BIT_3 3
#define C_RTC_PLACE_BIT_2 2
#define C_RTC_PLACE_BIT_1 1
#define C_RTC_PLACE_BIT_0 0
#define C_INIT_RTC_WEN 1 // RTC wrap enable
#define C_INIT_RTC_EN 1 // Start RTC
#define C_INIT_RTC_MASK 0 // no mask on interrupts
#define C_INIT_RTC_IEN 1 // interrupts enable
#define C_INIT_COUNTER_CONTROL_MASK ((C_INIT_RTC_WEN<<C_RTC_PLACE_BIT_3) | (C_INIT_RTC_EN<< C_RTC_PLACE_BIT_2) | (C_INIT_RTC_MASK<<C_RTC_PLACE_BIT_1) | (C_INIT_RTC_IEN<<C_RTC_PLACE_BIT_0) )
void counterInit(void)
{
NVIC_SetPriority (RTC_IRQn, 0);
NVIC_EnableIRQ(RTC_IRQn);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I also programmed the RTC_IRQHandler in the same file

Fullscreen
1
2
3
4
5
6
7
8
9
10
void RTC_IRQHandler(void);
void RTC_IRQHandler(void)
{
volatile t_int32u l_readEOIRegister;
s_extraBitsCounter++; // increment a counter
l_readEOIRegister = s_counter->endOfInterruptRegister; // read EOI register to clear it
NVIC_ClearPendingIRQ(RTC_IRQn);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

However, when the counter wraps, the interrupts is risen but the program never enter the RTC_IRQHandler function.

What could be wrong ?

Thank you for your help.

Best regards.

Rémi G.

0