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.

Problems setting the PSC on DaVinci DM365 GEL file on Code Composer Studio 4

Hello TI staff,

Beside my problems of setting the PLLs, I have met a spurious problem which did not occur before : the power and sleep controller for modules presents some infinite setup time.

Let me explain:

In my GEL file I have a Setup_Psc_All() procedure, that I made carefully not to set the reserved modules (as on evm files on few reserved modules which is problematic).

I followed the procedure explained on the ARM subsystem Datasheet.

And I got an infinite time/loop: on watching that the state has gone to the requested state in the MDSTAT register.

When I meet a problematic module, I remove it and then the 'error' propagates to the next one.

My procedure is here for information:

Any help is welcome.

----------------------------------------------------

 

 

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  Setup_Psc_All_On( )                                                     *
 *      Enable all non-reserved power modules.                              *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Setup_Psc_All_On( )
{
   
  unsigned char i=0;
  unsigned char lpsc_start;
  unsigned char lpsc_end,lpscgroup,lpscmin,lpscmax;
 
  lpscmin  =0;
  lpscmax  =3;

  GEL_TextOut( "Setup Power Modules (All on)... " );
 
  for(lpscgroup=lpscmin ; lpscgroup <=lpscmax; lpscgroup++)
  {
      if(lpscgroup==0)
      {
        lpsc_start = 0; // Enabling LPSC 0 to 15 SCR first
        lpsc_end   = 15;
      }
      else if(lpscgroup==1)
      {/* Skip reserved LPSCs 16 */
        lpsc_start = 17; // Enabling LPSC 17 to 28 SCR first
        lpsc_end   = 28;
      }
      else if (lpscgroup == 2)
      { /* Skip locked =(Always on or reserved) LPSCs [29-37] */
        lpsc_start = 38;
        lpsc_end   = 47;
      }
      else
      {
        lpsc_start = 50;
        lpsc_end   = 51;
      }
   
      //state=0x3=Enable LPSC's
      for(i=lpsc_start; i<=lpsc_end; i++)
      {     
           GEL_TextOut( "Module i= %d... ",,,,,i );     
        psc_change_state( i , 3 );                               
      }    
  }     

  GEL_TextOut("\nDM365 all Module Clocks are Turned on\n");   
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  psc_change_state( id, state )                                           *
 *      id    = Domain #ID                                                  *
 *      state = ( ENABLE, DISABLE, SYNCRESET, RESET )                       *
 *              (   =3  ,   =2   ,    =1    ,   =0  )                       *
 *                                                                          *
 * ------------------------------------------------------------------------ */
psc_change_state( int id, int state )
{

    int* mdstat                 = ( int* )( 0x01c41800 + ( 4 * id ) );
    int* mdctl                  = ( int* )( 0x01c41a00 + ( 4 * id ) );
    int set_interrupt;

    /*
     *  Step 0 - Ignore request if the state is already set as is
     */
    if ( ( ( *mdstat ) & 0x1f ) == state )
        return;

    /*
     *  Step 1 - Wait for PTSTAT.GOSTAT to clear = previous transitions must finish
     */
    while( PSC_PTSTAT & 1 )
    {
           GEL_TextOut( "waiting PTSTAT for %d... ",,,,,id );       
    };

    /*
     *  Step 2 - Set MDCTLx.NEXT to new state
     */
    *mdctl &= ~0x1f;
    *mdctl |= state;

    /*
     *  Step 3 - Start power transition ( set PTCMD.GO to 1 )
     */
    PSC_PTCMD |= 1;

    /*
     *  Step 4 - Wait for PTSTAT.GOSTAT to clear
     */
    while( PSC_PTSTAT & 1 )
    {
           GEL_TextOut( "waiting PTSTAT for %d... ",,,,,id );       
    };
    /*
     *  Step 5 - Wait for MDSTAT to be set to requested state
     */
    while ( (*mdstat)&0x1f != state )
    {
           GEL_TextOut( "waiting MDSTAT for %d go for %d... ",,,,,id,state );       
    };
}

----------------------------------------------------------------------------------------------

  • Hi,

    We made one change to your gel and tried it with the Dm365EVM and it seems to be working.

    From:    while ( (*mdstat)&0x1f != state );

    To:     while ( ((*mdstat)&0x1f) != state );

    Would you verify it again?

    Thanks,

    Tai Nguyen

  • HI Taï.

    It seems to work now. I believed the C/C++ priorities were kept. It looks like there is a little bug in the interpreter concerning this point.

    I consider this problem solved now. I can go through biggest roblem of PLL I talked about in another post.

    Thank you for your help.

    reda