This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Configure RTC registers using c55xx_csl API library for RTC only mode

Other Parts Discussed in Thread: TMS320C5515

Hello Everyone,

I am working with TMS320C5515 ezDSP kit and would like operate the processor in RTC only mode. I have included the c55xx_csl API library in my project and was able to successful execute the RTC example provided along with the library. But, the RTC registers RTCINTREG, RTCINTEN and RTCPMGT do not take the values as mentioned in the RTC user guide.  These registers are defined in the csl_rtcregs struct but equating values to the struct registers do not configure the registers in hardware.  

Also, as per http://processors.wiki.ti.com/index.php/C55xx_RTC_ONLY_MODE_SUPPORT I have tried configuring the registers using asm instructions but I was not successful.

Find below the code used to configure the registers

void rtc_regConfig(void)
{
Uint16 temp1920, temp1924, temp1930;

/* Structure of RTC registers */
CSL_RtcRegs rtcRegs;

/* Using rtc */
rtcRegs.RTCINTFL = 0x803Fu;
rtcRegs.RTCINTEN = 0x0001u;
rtcRegs.RTCINTREG = 0x0020u;
rtcRegs.RTCPMGT = 0x0000u;

do
{
temp1924 = rtcRegs.RTCINTREG;
}while((temp1924 & 0x0020) == 0);

temp1920 = rtcRegs.RTCINTFL;
if(temp1920 != 0)
{
rtcRegs.RTCINTFL = 0x803Fu;
}

rtcRegs.RTCPMGT = 0x0006u;
rtcRegs.RTCINTFL = 0x803Fu;

/* Using asm to configure the registers. But unsuccessful */
asm("*port(#0x1920) = #0x803F");
asm("*port(#0x1900) = #0x0001");
asm("*port(#0x1924) = #0x0020");
asm("*port(#0x1930) = #0x0006");

/* Tried configuring directly using CSL_RTC_REGS pointer */
CSL_RTC_REGS->RTCINTREG = 0x0020;
CSL_RTC_REGS->RTCPMGT = 0x0006;
}

Could anyone let me know how I could configure the RTC registers?

Thanks

  • Hi 

    I currently have a program that generates a sinewave of 1 KHz using different sampling frequencies :8000,12000,16000,48000.. Changing the sampling frequency is easy. But waht if I want to change the frequency of the actual sine wave. Instead of 1 KHz Let's say I want to generate a sinewave of 10 KHz or 100 KHz. I know it has something to do with the PLL but i dont know where to start to be honest. The program is named PlayTone.c and  is as follow:

    #include "stdio.h"
    #include "usbstk5505.h"

    extern void tone(Uint32, Int16, Int16, Uint16, Int16*);

    #define SIZE 48
    Int16 dataTable[SIZE];

    void main( void )
    {
    /* Pre-generated sine wave data, 16-bit signed samples */
    Int16 table[SIZE] = {
    0x0000, 0x10b4, 0x2120, 0x30fb, 0x3fff, 0x4dea, 0x5a81, 0x658b,
    0x6ed8, 0x763f, 0x7ba1, 0x7ee5, 0x7ffd, 0x7ee5, 0x7ba1, 0x76ef,
    0x6ed8, 0x658b, 0x5a81, 0x4dea, 0x3fff, 0x30fb, 0x2120, 0x10b4,
    0x0000, 0xef4c, 0xdee0, 0xcf06, 0xc002, 0xb216, 0xa57f, 0x9a75,
    0x9128, 0x89c1, 0x845f, 0x811b, 0x8002, 0x811b, 0x845f, 0x89c1,
    0x9128, 0x9a76, 0xa57f, 0xb216, 0xc002, 0xcf06, 0xdee0, 0xef4c
    };

    Int16 gain,playtime,i,j,k,n,m;
    Uint32 sf;

    printf("Exp. 1.4 --- playTone\n");

    printf("Enter an integer number for Gain between (-6 and 29)\n");
    scanf ("%d", &gain);

    printf("Enter the Sampling Frequency, select one: 8000, 12000, 16000, 24000 or 48000\n");
    scanf ("%ld", &sf);

    printf("Enter the playing time duration (5 to 60)\n");
    scanf ("%i", &playtime);

    if ((gain < -6)||(gain > 29))
    {
    printf("Your have entered an invalid Gain\n");
    printf("Use default gain = 0dB\n");
    gain = 0;
    }
    else
    {
    printf("Gain is set to %ddB\n", gain);
    }

    if ((sf == 8000)||(sf == 12000)||(sf == 16000)||(sf == 24000)||(sf == 48000))
    {
    printf("Sampling Frequency is set to %ldHz\n", sf);
    }
    else
    {
    printf("Your have entered an invalid Sampling Frequency\n");
    printf("Use default Sampling Frequency = 48000Hz\n");
    sf = 48000;
    }

    if ((playtime < 5)||(playtime > 60))
    {
    printf("Your have entered an invalid playing time\n");
    printf("Use default duration = 10s\n");
    playtime = 10;
    }
    else
    {
    printf("Playing time is set to %ds\n", playtime);
    }

    for (i=0; i<SIZE; i++)
    dataTable[i] = 0;

    switch (sf)
    {
    case 8000:
    m = 6;
    break;
    case 12000:
    m = 4;
    break;
    case 16000:
    m = 3;
    break;
    case 24000:
    m = 2;
    break;
    case 48000:
    default:
    m = 1;
    break;
    }

    for (n=k=0, i=0; i<m; i++) // Fill in the data table
    {
    for (j=k; j<SIZE; j+=m)
    {
    dataTable[n++] = table[j];
    }
    k++;
    }

    tone(sf, playtime, gain, 0, dataTable);

    printf("\nExp --- completed\n");

    I completely understand what that program does. But I do not see where it sets the PLL and the sampling time. 

    I even checked the file where the tone function is defined. Tone.c is as follow:

    #define AIC3204_I2C_ADDR 0x18
    #include "usbstk5505.h"
    #include "usbstk5505_gpio.h"
    #include "usbstk5505_i2c.h"
    #include "usbstk5505_i2s.h"
    #include <stdio.h>

    extern void aic3204_tone_headphone( );
    extern void tone(Uint32, Int16, Int16, Uint16, Int16*);
    extern void Init_AIC3204(Uint32 sf, Int16 gDAC, Uint16 gADC);
    extern Int16 AIC3204_rset( Uint16 regnum, Uint16 regval);

    void tone(Uint32 sf, Int16 playtime, Int16 gDAC, Uint16 gADC, Int16 *sinetable)
    {
    Int16 sec, msec;
    Int16 sample, len;

    /* Initialize BSL */
    USBSTK5505_init( );

    /* Set A20_MODE for GPIO mode */
    CSL_FINST(CSL_SYSCTRL_REGS->EBSR, SYS_EBSR_A20_MODE, MODE1);

    /* Use GPIO to enable AIC3204 chip */
    USBSTK5505_GPIO_init();
    USBSTK5505_GPIO_setDirection(GPIO26, GPIO_OUT);
    USBSTK5505_GPIO_setOutput( GPIO26, 1 ); // Take AIC3204 chip out of reset

    /* Initialize I2C */
    USBSTK5505_I2C_init( );

    /* Initialized AIC3204 */
    Init_AIC3204(sf, gDAC, gADC);

    /* Initialize I2S */
    USBSTK5505_I2S_init();

    switch (sf)
    {
    case 8000:
    len = 8;
    break;
    case 12000:
    len = 12;
    break;
    case 16000:
    len = 16;
    break;
    case 24000:
    len = 24;
    break;
    case 48000:
    default:
    len = 48;
    break;
    }

    /* Play tone */
    for ( sec = 0 ; sec < playtime ; sec++ )
    {
    for ( msec = 0 ; msec < 1000 ; msec++ )
    {
    for ( sample = 0 ; sample < len ; sample++ )
    {
    /* Write 16-bit left channel data */
    USBSTK5505_I2S_writeLeft( sinetable[sample]);

    /* Write 16-bit right channel data */
    USBSTK5505_I2S_writeRight(sinetable[sample]);
    }
    }
    }

    #if 0
    USBSTK5505_I2S_close(); // Disable I2S
    AIC3204_rset( 1, 1 ); // Reset codec

    USBSTK5505_GPIO_setOutput( GPIO26, 0 ); // Disable AIC3204
    #endif
    }

    I can see there is a loop . Every millisec, the program takes a number of samples(depending of the sampling frequency set by you ). But how they know it's gonna take exactly one millisec.Based on what? Where do they check the timing for one millisec? Is there any interrupt? Please can you assist me with regard to that matter?

    Thanks 

  • Hi Aubin,

    Could you create a seperate thread for your question and not overload my thread. However, if you have a solution to my question you are welcomed.

     

  • The code provided in the RTC_ONLY_MODE _SUPPORT is a standalone code without using any API. Can you try only the asm codes to confirm registers access?

    Regards.

  • Hi Steve,

    I executed the code provided in  RTC_ONLY_MODE _SUPPORT wiki with few changes and it worked fine. I tweaked the code to generate an RTC interrupt for 1s instead of wake up for my testing. 

    But, I am facing an issue while setting values to the RTCPMGT [0x1930h] register to switch off the LDO and BG. When I uncomment these lines the program breaks with the below error.

    /*
    * main.c
    */

    #include <stdio.h>
    #include "csl_intc.h"
    #include "tistdtypes.h"


    extern void VECSTART(void);
    interrupt void RTC_isr (void);


    void main(void)
    {
       Uint16 temp1920, temp1924;
       asm(" @#IFR0_L = #0xffff || mmap() "); // clear int flags
       asm(" @#IER0_L = #0x0000 || mmap() "); // set RTC int
       asm(" @#IFR1_L = #0xffff || mmap() "); // clear int flags
       asm(" @#IER1_L = #0x0004 || mmap() "); // set RTC int
       asm(" bit(ST1,#11) = #0 "); // GLOBAL INTERRUPT ENABLE

      // RTC configure

      IRQ_setVecs((Uint32)&VECSTART);
      IRQ_plug (RTC_EVENT, &RTC_isr); 

      asm(" *port(#0x1920) = #0x803F "); //clear interrupt flags
      asm(" *port(#0x1900) = #0x0001 "); //RTCINTEN enabled
      asm(" *port(#0x1924) = #0x0002 "); //EXTINTEN enabled
      asm(" *port(#0x1930) = #0x0000 "); //WU_DIR input


      do 
      {
        temp1924 = *(volatile ioport unsigned int *) (0x1924);
      } while ((temp1924&0x0002)==0);

      temp1920 = *(volatile ioport unsigned int *) (0x1920);
      if ((temp1920&0x0002)!=0)
      {
        asm(" *port(#0x1920) = #0x803F "); //clear interrupt flags
      }

      asm(" *port(#0x1930) = #0x0000 "); //WU_DIR input & LDO & BG shutdown
      asm(" *port(#0x1920) = #0x803F "); //clear interrupt flags

      // Enter RTC-only

      while (1)
      {
        temp1920 = *(volatile ioport unsigned int *) (0x1920);
        if ((temp1920&0x0002)!=0)
        {
           asm(" *port(#0x1920) = #0x803F "); //clear interrupt flags
           printf("while loop\n\n");
        // asm(" *port(#0x1930) = #0x0006 "); //WU_DIR input & LDO & BG shutdown
           asm(" *port(#0x1920) = #0x803F "); //clear interrupt flags
        }
      }
    }

    // Interrupt code
    interrupt void RTC_isr (void)
    {
       printf("ISR\n");
       asm(" @#IFR1_L = #0xffff || mmap() "); // clear int flags
       asm(" *port(#0x1920) = #0x803F "); // clear flags
       asm(" *port(#0x1930) = #0x0006 "); //WU_DIR input & LDO & BG shutdown
       asm(" *port(#0x1920) = #0x803F "); // clear flags
       asm(" *port(#0x1924) = #0x0002 "); // enable external interrupt
    }

     

    C55xx: Can't Single Step Target Program: (Error -1141 @ 0x0) Device is not responding to the request. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 5.1.232.0)

    I am using TMS320C5515 eZDSP kit and XDS100v1 USB emulator .  For my target configuration, I have selected board or device type as USBSTK5515 and in advanced tab under CPU Properties the initialization script points to the location to the gel file downloaded from http://support.spectrumdigital.com/boards/usbstk5515_v2/reva/

    The "Test Connection" in target configuration also provides successful results.

    All of the values were scanned correctly. The JTAG IR Integrity scan-test has succeeded. The JTAG DR Integrity scan-test has succeeded.

    Am not sure what could be error. Could you please help?

    Thanks.

  • Enabling RTC-Only mode will shut off all the power domains except RTC. You will not be able to connect JTAG and run the code after enabling RTC-Only mode.

    - Pratap.

  • Thank you. Pratap.

    Mr. Lobo,

    As Pratap stated, in RTC-Only mode, the device is pretty much powered down and JTAG will not be functional. Great news that your modified code works. With such, next would be tested out your code in normal functional mode.

    Regards.

  • Thank you Pratap and Steve.

    For the wake up sequence from RTC only mode, should only re-enabling the LDO and BG in the RTCPMGT suffice?

    I have coded my ISR as below but my device does not wake up.

    interrupt void RTC_isr (void)
    {
    	asm("	@#IFR1_L = #0xffff || mmap() ");
    	asm("	*port(#0x1920) = #0x803F "); 
    	asm("	*port(#0x1930) = #0x0000 "); 		
    
    	printf("Executing interrupt\n"); 		
    		
    	asm("	*port(#0x1930) = #0x0006 "); 
    	asm("	*port(#0x1920) = #0x803F "); 
    	asm("	*port(#0x1924) = #0x8000 "); 
    }

     

  • Mr Lobo,

    You do not required to power up the LDOs & BG when wakeup. Using WAKEUP pin is the only way to wakeup from RTC-Only mode. Once a high pulse of >30.5us of WAKEUP is detected, DSP_LDOO will start ramping up. Pleease refer to "RTC Only Mode" mode section in C5515 data manual.

    I have provided the original test code to Florian Kohl. The RTC_isr in the test code is to make sure the power down sequence is executed to enter RTC-Only mode once it has initiated even a real time clock interrupt comes in. The test code is a standalone code without any dependence to CSL. As such, it can be used a s an included call function in any application codes.

    Regards.

     

     

  • That's pretty interesting! In the manual, RTCPMGT register bit description it's mentioned that the LDO and POR can be re-enabled by the Wake-Up pin or the RTC alarm interrupt. So I was trying to wake up the device from the RTC alarm  interrupt.

    Thank you for clearing my ambiguity.

    Regards.

     

     

     

     

  • Hi Richard

    I met the same problem.   RTC alarm interrupt can not wake up system.  I don't know what's reason.

    And I have posted some question in this forum,  but no answer.

    I guess the high pulse width of RTC alarm is shorter than 30.5us,  so It can not wake up system.

    Because when I set 1s alarm interrup,  the led will shock in a very short time.

    On the other hand,  When I give wakeup pin high Voltage manually,  the system can wake up.

    Hi Steve

    Do you have any good solution to resovle this problem?  I don't know the high pulse of RTC alarm can be control by developer or not.

    This problem is very serious which is blocking our project.

    We are waiting for your answer................

    Thanks

  • Hello,

    I have attached the working code for setting up RTC alarm for every one second and toggling the LED.

    I guess you would be able to figure out the changes required in your code.

    #include <stdio.h>
    #include <csl_rtc.h>
    #include <csl_intc.h>
    #include <csl_general.h>
    #include <csl_gpio.h>
    
    
    extern void VECSTART(void); // CSL asm file
    
    // borrowed from CSL
    
    #define CSL_SYS_CGCR1_RESETVAL           (0x1000u)
    #define CSL_SYS_CGICR_RESETVAL           (0x0000u)
    #define CSL_SYS_CGOCR_RESETVAL           (0x0000u)
    #define CSL_SYS_CGCR3_RESETVAL           (0x0806u)
    
    void configure_pll(void)
    {
        Uint16 timeout = 1000;
        
         // Bypass the PLL and SYSCLK is driven by RTC oscillator
        CSL_SYSCTRL_REGS->CCR2 = 0x0000;
        
        // Reset PLL register
        CSL_SYSCTRL_REGS->CGCR1 	= CSL_SYS_CGCR1_RESETVAL;
        CSL_SYSCTRL_REGS->CGCR2 	= CSL_SYS_CGICR_RESETVAL;
        CSL_SYSCTRL_REGS->CGCR4	 	= CSL_SYS_CGOCR_RESETVAL;
        CSL_SYSCTRL_REGS->CGCR3 	= CSL_SYS_CGCR3_RESETVAL;
    
        // Set CLR_CTRL = 0 in CGCR1 
        CSL_SYSCTRL_REGS->CGCR1 	&= 	CSL_SYS_CGCR1_PLL_PWRDN_MASK ^ CSL_SYS_CGCR1_M_MASK;    
        CSL_SYSCTRL_REGS->CGCR2 	= 	CSL_SYS_CGCR1_RSVD_MASK;
        CSL_SYSCTRL_REGS->CGCR4 	= 	CSL_SYS_CGCR4_RESETVAL;
        CSL_SYSCTRL_REGS->CGCR3 	= 	CSL_SYS_CGCR3_RESETVAL;
    
        // Set PLL_PWRDN = 0, PLL_STANDBY = 0, CLR_CNTL = 1 and program MH in CGCR1
        // according to your required settings
        CSL_SYSCTRL_REGS->CGCR1 	= 	0x8BE8;
    
        while (!(CSL_SYSCTRL_REGS->CGCR3&0x0008) && timeout--)
        {
            
        }
        // Select pll 
        CSL_SYSCTRL_REGS->CCR2 = 0x0001;    
        return;
    }
    
    void configure_io_toogle(void)
    {
      #ifdef USE_EVAL_STICK     
        // Toggle GPIO21 
        // Set GP21 instead of A[15]
        CSL_SYSCTRL_REGS->EBSR |= 0x0001;			// Assign pin to be mapped to GPIO
        
        
        CSL_GPIO_REGS->IOINTEN1 &= 0xEFFF;			// Set 1 to trigger interrupt using GPIO 
        CSL_GPIO_REGS->IOOUTDATA1 |= 0x1000;		// Set data for the pin if configured as output
        CSL_GPIO_REGS->IODIR1 |= 0x1000;			// Set direction of GPIO. Set 1 for output
        
        // disable interrupt
        // set IO high and enable as output
        CSL_GPIO_REGS->IOINTEN2 &= 0xFFDF;
        CSL_GPIO_REGS->IOOUTDATA2 |= 0x0020;
        CSL_GPIO_REGS->IODIR2 |= 0x0020;
        
      #else
          // toggle GPIO14
          
          // disable interrupt
        // set IO high and enable as output
        CSL_GPIO_REGS->IOINTEN1		&= 	0xBFFF;
        CSL_GPIO_REGS->IOOUTDATA1 	|= 	0x4000;
        CSL_GPIO_REGS->IODIR1 		|= 	0x4000;
      #endif
    }
    
    void toggle_io(void)
    {
        static Uint8 setval = 1;
    
        if ( setval )
        {
          #ifdef USE_EVAL_STICK      	
            CSL_GPIO_REGS->IOOUTDATA2 &= 0xFFDF;
            CSL_GPIO_REGS->IOOUTDATA1 &= 0xEFFF;
          #else
            CSL_GPIO_REGS->IOOUTDATA1 &= 0xBFFF;
          #endif  
            setval = 0;   
            
        }
        else
        {
          #ifdef USE_EVAL_STICK
            CSL_GPIO_REGS->IOOUTDATA2 |= 0x0020;
            CSL_GPIO_REGS->IOOUTDATA1 |= 0x1000;
          #else
            CSL_GPIO_REGS->IOOUTDATA1 |= 0x4000;
          #endif            
            setval = 1;
        }   
        printf("value :	%d\n", setval);
    }
    interrupt void rtc_isr(void)
    {
    	Uint16 delay;
    	
    	printf("executing the interrupt routine.. %u\n", CSL_RTC_REGS->RTCINTFL);	
    	 
    	// PLL power up
    	CSL_SYSCTRL_REGS->CGCR1 &= 0xEFFF;
    	
    	for(delay=0;delay<100;delay++); 
    	
    	// SYSCLKSEL PLL mode selected		
    	CSL_SYSCTRL_REGS->CCR2 = 0x0001;
    	
    	for(delay=0;delay<100;delay++);
        
    	// Clear RTC interrupt flags
    	CSL_RTC_REGS->RTCINTFL = CSL_RTC_REGS->RTCINTFL;	 
    }
    
    
    void configure_rtc(void)
    {
        Uint8 timeOut = 1000;
        
        // Configure and enable the RTC interrupts using INTC module 
        IRQ_globalDisable();
    
        // Clear any pending interrupts 
        IRQ_clearAll();
    
        // Disable all the interrupts 
        IRQ_disableAll();
    
        IRQ_setVecs((Uint32)&VECSTART);
        
        IRQ_plug (RTC_EVENT, &rtc_isr);
    
        IRQ_enable(RTC_EVENT);
        IRQ_globalEnable();
           
        // before writing the time to RTC Registers clear time update bit 
        CSL_RTC_REGS->RTCUPDATE = 0;
    
        // set time registers 
        CSL_RTC_REGS->RTCMIL   = 0;
        CSL_RTC_REGS->RTCSEC   = 0;
        CSL_RTC_REGS->RTCMIN   = 0;
        CSL_RTC_REGS->RTCHOUR  = 0;
        CSL_RTC_REGS->RTCDAY   = 0;
        CSL_RTC_REGS->RTCMONTH = 0;
        CSL_RTC_REGS->RTCYEAR  = 0;
        
        // Time updates enabled 
        //  Updates the time registers from DSP to RTC
        CSL_RTC_REGS->RTCUPDATE |= 0x8000;
        while( (CSL_RTC_REGS->RTCUPDATE & 0x8000) && (--timeOut != 0));
    	
    	// switch of the LDO 
    	CSL_RTC_REGS->RTCPMGT  = 0x0000;
    
        // set interrupt register 
        CSL_RTC_REGS->RTCINTREG = 0x0001;   
        
        // enable interrupts
        CSL_RTC_REGS->RTCINTEN = 0x0001; 
        
        // Start RTC clock
        RTC_start();   
    }
    
    void main(void) 
    {
        Uint16 i;
        Uint32 count;
        Uint32 delayi;
        
        // Sets IDLE configuration bits before executing idle instruction. All ports and CPU remain active.
        CSL_IDLECTRL_REGS->ICR = 0x000E; 
        asm("  idle");
        asm("  nop");
        asm("  nop");
        asm("  nop");
        
        // Configure PLL
        configure_pll();
        
        // System clock active. Rest are disabled.
        CSL_SYSCTRL_REGS->PCGCR1 &= 0x7FFF;
        CSL_SYSCTRL_REGS->PCGCR2 &= 0x007F;
    
        // Idle Setup
        // Reset all peripherals after a SYSCLK cycles of 20h 
        CSL_SYSCTRL_REGS->PSRCR = 0x0020;
        CSL_SYSCTRL_REGS->PRCR  = 0x00BF;
        
        for(i=0; i<0xff; i++)
        {
            asm("   nop");
        }
        
        // We need to active the EMIF clock so it can ACK our request
        // Activate EMIF Clock
        // Proably should activate USB and UART's clocks also, but that seems
        // to be done by bootloader
        
        // Activates all the clocks
        CSL_SYSCTRL_REGS->PCGCR1 = 0x0000;
        CSL_SYSCTRL_REGS->PCGCR2 = 0x0000;
    
        // Configure IO for toggling
        configure_io_toogle();
        
        // configure RTC Second Alarm
        configure_rtc();
        
        // disable TMR0
        CSL_TIM_0_REGS->TCR = 0;
    
        // disable USB OSC
        CSL_SYSCTRL_REGS->USBSCR = 0x804C;
    
        // Need to request from UART / USB / EMIF if we can disable clocks
        CSL_SYSCTRL_REGS->CLKSTOP = 0x0015;
        
        // need to check to make sure all of the above ack before disabling clocks
        while(0x3F != CSL_SYSCTRL_REGS->CLKSTOP)
        {
            asm("   nop");
        }
        	
        // Disable all clocks but SYSCLK
        CSL_SYSCTRL_REGS->PCGCR2 = 0x007F;
        CSL_SYSCTRL_REGS->PCGCR1 = 0x7FFF;	
    	
    
    
    	while(1)
    	{            
     		// Bypass PLL and SYSCLK is generated by RTC oscillator
       		CSL_SYSCTRL_REGS->CCR2 = 0x0000;
       		
           	// PLL power down
        	CSL_SYSCTRL_REGS->CGCR1 |= 1u<<12;   	         
        	   
            // Configure for Idle, enable idle on all domains
            CSL_IDLECTRL_REGS->ICR = 0x03EF; // enable idle on all domains
            asm("  nop");
            asm("  nop");
            asm("  idle");
            asm("  nop");
            asm("  nop");
            printf("Processing in main loop..\n");
            
            for (count=0; count<2; count++)
            { 
            toggle_io();
            for(delayi=0;delayi<50;delayi++){} 
            }            
    	}
    }
    

    Richard