Page 1 of 1

how to enable gpio pins in ATSAM4E16E?

Posted: Tue Aug 18, 2015 12:57 pm
by sandeep
HI,
i had been trying to initialize the gpio pins in sam4e16e but i didnt get how to initialize them please help me with this problem and if any one have the sample code for gpio initializing please share with me.

Re: how to enable gpio pins in ATSAM4E16E?

Posted: Wed Aug 19, 2015 12:25 am
by cwunder
Besides reading the datasheet there are example projects in Studio 6.2 that use ASF to demonstrate it.
Here is an example which is very basic for the SAM4E-XPRO to toggle the Yellow LED on the board (PD22):

Code: Select all

int main(void)
{
  /* Initialize the SAM system */
  SystemInit();

  /* LED is on PD22, Output Enable */
  PIOD->PIO_OER = PIO_OER_P22;
  
  while (1)
  {
    for(int i=0; i < 0x500000;i++);
    /* set the data */
    PIOD->PIO_SODR = PIO_SODR_P22;
    for(int i=0; i < 0x500000;i++);
    /* clear the data */
    PIOD->PIO_CODR = PIO_CODR_P22;
  }
}

Re: how to enable gpio pins in ATSAM4E16E?

Posted: Wed Aug 26, 2015 9:42 am
by sandeep
really thanks for the help it really works

Re: how to enable gpio pins in ATSAM4E16E?

Posted: Tue Feb 16, 2016 3:08 pm
by juanpuol
Hi, cwunder.
I see you used the macros for the registers as structures, but I haven't been able to find this header files in which they are defined for the ATSAM4E16E.

Where can I find those files? thanks