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.

Example_2833xGpioToggle porta

this is controlsuit:

void Gpio_select(void)
{

  
    EALLOW;
 GpioCtrlRegs.GPAMUX1.all = 0x00000000;  // All GPIO
 GpioCtrlRegs.GPAMUX2.all = 0x00000000;  // All GPIO

    GpioCtrlRegs.GPADIR.all = 0xFFFFFFFF;   // All outputs
    GpioCtrlRegs.GPBDIR.all = 0x0000000F;   // All outputs
    EDIS;
    

 

  for(;;)
   {  
       GpioDataRegs.GPADAT.all    =0xAAAAAAAA;
       GpioDataRegs.GPBDAT.all    =0x0000000A;       
      
       delay_loop();

       GpioDataRegs.GPADAT.all    =0x55555555;
       GpioDataRegs.GPBDAT.all    =0x00000005;
   
       delay_loop(); 
    }

I control the GpioDataRegs.GPADAT.all   

and watch the value of the GpioDataRegs.GPADAT.all   

but the value in the Expressions is not  "0xAAAAAAAA;" or "0x55555555; ".

the  value which I saw is "0xAAAE8AAA" or "0x55517555"

 

and my delay is

void delay_loop()
{
    volatile long i,j;
    for (i = 0; i < 1000000; i++)
     for(j=1000;j>0;j--);
}

is very long time already.

I don't Know what reason reault This?

  • See page 96 of http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=sprufb0&fileType=pdf:

    "Typically the DAT registers are used for reading the current state of the pins. To easily modify the output

    level of the pin refer to the SET, CLEAR and TOGGLE registers."

    Stephen

  • Thank you for your reply.but i change the code like this:

    void Gpio_example2(void)
    {
       // Example 2:
       // Toggle I/Os using SET/CLEAR registers
       for(;;)
       {   
      
           GpioDataRegs.GPASET.all    =0xAAAAAAAA;
           GpioDataRegs.GPACLEAR.all  =0x55555555;
          
           GpioDataRegs.GPBSET.all    =0x0000000A;       
           GpioDataRegs.GPBCLEAR.all  =0x00000005;       
                 
           delay_loop();

           GpioDataRegs.GPACLEAR.all    =0xAAAAAAAA;
           GpioDataRegs.GPASET.all      =0x55555555;
          
           GpioDataRegs.GPBCLEAR.all    =0x0000000A;       
           GpioDataRegs.GPBSET.all      =0x00000005;       
       
           delay_loop(); 
      
        }
    }

    but the result is still like above.IS there some debug on PORTA?

     

  • but the result is still like above.IS there some debug on PORTA?

    I am not sure what you mean by debug on PORTA.  Are you working with your own hardware or a TI development board? 

    Check to see if those port pins (GPIO12-GPIO15) are being pulled high or low by some external hardware?