Dear developpers,
I'm creating my own application using the ezdspc5535 in an embedded field and I would like to have the DSP in low power mode when I'm not using it. I would like to wakeup the DSP every second so I'm using a periodical interrupt ( one second).
First of all, I read several post on the RTC-only mode already present on this forum :
https://e2e.ti.com/support/dsp/c5000/f/109/t/361039#pi317310=1
https://processors.wiki.ti.com/index.php/C55xx_RTC_ONLY_MODE_SUPPORT
Based on those threads, I wrote my own software but it doesn't work as I expect. I'm using mnemonic instruction and I try to avoid using CSL when I can. there is my code :
#define IER0 *(volatile unsigned *)0x0000
#define IFR0 *(volatile unsigned *)0x0001
#define IER1 *(volatile unsigned *)0x0045
#define IFR1 *(volatile unsigned *)0x0046
#define RTC_CTR *(ioport volatile unsigned *)0x1900 // RTC Control Register
#define RTC_STAT *(ioport volatile unsigned *)0x1920 //RTC Status Register
#define RTC_INT *(ioport volatile unsigned *)0x1924 //RTC Interrupt Control Register
#define RTC_PMGT *(ioport volatile unsigned *)0x1930 //RTC Power Management Control Register
int main(void) {
Uint16 temp1920, temp1924;
IFR0 = 0xffff || mmap() ; // clear int flags
IER0 = 0x0000; // set RTC int
IFR1 = 0xffff || mmap() ;
IER1 = 0x0004 || mmap() ;
asm(" bset #11, ST1_55"); // global interrupt enable
// RTC configure
IRQ_setVecs((Uint32)&VECSTART);
IRQ_plug (RTC_EVENT, &rtc_isr);
RTC_STAT = 0x803F; //clear interrupt flags
RTC_CTR = 0x0001; //RTCINTEN enabled
RTC_INT = 0x0022; //SECINT enabled (and WAKEUP pin)
RTC_PMGT = 0x0000; //WU_DIR input
do // waiting until RTC interrupt is enabled in the RTC domain could take 2 RTC clocks for write to propagate
{
temp1924 = *(volatile ioport unsigned int *) (0x1924);
} while ((temp1924&0x0022)==0);
temp1920 = *(volatile ioport unsigned int *) (0x1920);
if ((temp1920&0x0022)!=0)
{
RTC_STAT = 0x803F; //clear interrupt flags
}
RTC_PMGT = 0x0006; //WU_DIR input & LDO & BG shutdown
RTC_STAT = 0x803F; //clear interrupt flags
// Enter RTC-only
while (1)
{
temp1920 = *(volatile ioport unsigned int *) (0x1920);
if ((temp1920&0x0022)!=0)
{
RTC_STAT = 0x803F; //clear interrupt flags
RTC_PMGT = 0x0006; //WU_DIR input & LDO & BG shutdown
RTC_STAT = 0x803F; //clear interrupt flags
}
}
}
interrupt void rtc_isr (void)
{
IFR1 = 0xffff || mmap();
RTC_STAT = 0x803F;
RTC_PMGT = 0x0000;
RTC_STAT = 0x803F;
RTC_INT = 0x0022;
}
The purpose of this code is to go to RTC-only mode and wakeup every second. I would like to see the XF led blinking ever second.
When I run the program, the XF led blink one time and stay high. After that, the LCD reset and nothing change anymore. I guess I'm in RTC-only mode since I can't halt the CPU with CCS when I'm running that code.
Any idea why the XF led blink only one time and where I should put a asm(" bset XF") / asm(" bclr XF") to see the cycle (1 per second).
Best Regards.