how to enable gpio pins in ATSAM4E16E?

Discussion around product based on ARM Cortex M4 core.
This forum will be discontinued soon.

Moderators: nferre, ncollot

sandeep
Posts: 13
Joined: Tue Aug 18, 2015 12:49 pm

how to enable gpio pins in ATSAM4E16E?

Tue Aug 18, 2015 12:57 pm

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.
cwunder
Posts: 34
Joined: Fri Jul 01, 2011 9:39 pm

Re: how to enable gpio pins in ATSAM4E16E?

Wed Aug 19, 2015 12:25 am

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;
  }
}
sandeep
Posts: 13
Joined: Tue Aug 18, 2015 12:49 pm

Re: how to enable gpio pins in ATSAM4E16E?

Wed Aug 26, 2015 9:42 am

really thanks for the help it really works
juanpuol
Posts: 1
Joined: Tue Feb 16, 2016 3:02 pm

Re: how to enable gpio pins in ATSAM4E16E?

Tue Feb 16, 2016 3:08 pm

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

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: No registered users and 2 guests