SCR RTC Interrupt Configuration

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Karthik7386
Level 2
Level 2
10 questions asked 50 sign-ins 10 replies posted

Hello,

How to configure SCR RTC to get Interrupt in every one second. Can you please check and provide the feedback.

0 Likes
1 Solution
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored
/* RTC ISR to blink a LED */
#if defined (__TASKING__)
void __interrupt(0x6B) rtc_interrupt(void)
#elif defined(__KEIL__)
void rtc_interrupt(void) interrupt 13
#endif
{
	SCR_IO_PAGE = 0;
	SCR_P00_OMTR = 0x10;
}

 That's because of different compiler define as above sample.

View solution in original post

0 Likes
5 Replies
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

A SCR source code please refer to here, if no access please refer to myICP. This project needs BIFACES environment.

C:\Aurix2G_Workspace_V1_0_1_15_0\_Examples_TC3xx\ScrBaseFramework_TC3xx\
0 Likes

Hello,

Thank you for your feedback. I configured the SCR RTC registers to get interrupt.

SCR_SCU_PAGE=1,SCR_PMCON1= 0X2B, SCR_IEN1 = 0X80,SCR_IEN0 = 0X80,SCR_RTC_CNT3,CNT2,CNT1,CNT0=0,

SCR_RTC_RTCCR3= 0X00,RTCCR2=0X01,RTCCR1=0X17,RTCCR0=0X04( Get interrupt in one second), RTCON=0X15,

Call back function for RTC interrupt: void rtc_interrupt( void) interrupt 13. But still not able to get the RTC interrupt. Can you please check.

0 Likes
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

It's suggested to start from the example project. 

void main(void)
{
	/* SCU module configurations*/
	SCR_SCU_PAGE = 1;       //Switch to page 1
	SCR_PMCON1 =0x3B;       //OCDS, T2CCU and SSC enabled

	SCR_SCU_PAGE = 0;       //Switch to page 0
	SCR_IRCON0 = 0x0;       //Reset interrupts

	SCR_IEN0 = 0x80;        //Enable global interrupts
	SCR_IEN1 = 0x80;        //XINTR13 is enabled

	/* RTC module configurations*/
	SCR_RTC_RTCCR3 = 0x00;
	SCR_RTC_RTCCR2 = 0xFF;
	SCR_RTC_RTCCR1 = 0xFF;
	SCR_RTC_RTCCR0 = 0x40;
	SCR_RTC_RTCON =  0x17;		// RTC Interrupt Enable, RTC start operation, RTC 100Mhy/DIV clock, 9-bit prescaler is bypassed

	/* IO module configurations*/
    SCR_IO_PAGE = 2;		//Switch to page 2
    SCR_P00_PDISC = 0x00;

    SCR_IO_PAGE = 0;		//Switch to page 0
    SCR_P00_OUT = (1 << 4);	//Initialize P00.4 out to 1. LED 0 on Triboard off

    SCR_IO_PAGE = 1;		//Switch to page 1
    SCR_P00_IOCR4 = 0x80;	//P00 pin 4 is output

    SCR_IO_PAGE = 0;		//Switch back to page 1

	while(1)
	{
	}
}

 

0 Likes

Hello,

Thank you for your feedback. In sample program call back function is configured as void _interrupt(0x6B) rtc_interrupt(void) but getting compiler error. void Rtc_interrupt (void) interrupt 13 this call back is fine?

0 Likes
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored
/* RTC ISR to blink a LED */
#if defined (__TASKING__)
void __interrupt(0x6B) rtc_interrupt(void)
#elif defined(__KEIL__)
void rtc_interrupt(void) interrupt 13
#endif
{
	SCR_IO_PAGE = 0;
	SCR_P00_OMTR = 0x10;
}

 That's because of different compiler define as above sample.

0 Likes