Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: GPIO programming in KB9202C board
PostPosted: Mon Sep 06, 2010 3:51 pm 
Offline

Joined: Sat Sep 04, 2010 2:21 pm
Posts: 2
Hi ,
i require help to access the PC27/CP26/PC25/PC24 GPIO pins, present in the SV1 header.

I am able to access the inbuild LEDs using program given by the vendor. Those LEDs are connected in PC18, PC19,PC20. I have used the same method, but not able access the external GPIOs.

the code is below,

if ((memMapFile = open("/dev/mem", O_RDWR | O_SYNC)) < 0)
{
printf("ERROR: Unable to open /dev/mem\n");
return (DRIVER_NOT_FOUND);
}

at91SysCtrlr = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
MAP_SHARED, memMapFile, (unsigned)AT91C_BASE_SYS);

if (at91SysCtrlr == MAP_FAILED)
{
printf("ERROR: Unable to mmap the system controller\n");
close (memMapFile);
memMapFile = -1;
return (MEMMAP_FAILED);
}

/* set LED signals for output */
/* set digital output ports init value = all on (active low) */
at91SysCtrlr->PIOC_CODR = GPIO_LED_MASK;
at91SysCtrlr->PIOC_PPUDR = GPIO_LED_MASK;
at91SysCtrlr->PIOC_PER = GPIO_LED_MASK;
at91SysCtrlr->PIOC_OER = GPIO_LED_MASK;


if ((memMapFile = open("/dev/mem", O_RDWR | O_SYNC)) < 0)
{
printf("ERROR: Unable to open /dev/mem\n");
return (DRIVER_NOT_FOUND);
}

at91SysCtrlr = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
MAP_SHARED, memMapFile, (unsigned)AT91C_BASE_SYS);

if (at91SysCtrlr == MAP_FAILED)
{
printf("ERROR: Unable to mmap the system controller\n");
close (memMapFile);
memMapFile = -1;
return (MEMMAP_FAILED);
}

/* set LED signals for output */
/* set digital output ports init value = all on (active low) */
at91SysCtrlr->PIOC_CODR = GPIO_LED_MASK;
at91SysCtrlr->PIOC_PPUDR = GPIO_LED_MASK;
at91SysCtrlr->PIOC_PER = GPIO_LED_MASK;
at91SysCtrlr->PIOC_OER = GPIO_LED_MASK;
}

at91SysCtrlr->PIOC_CODR=(ledSignalMapping[ledindex]);

inbuild LEDs are glowing, but the LEDs connected in the external GPIO pins are not glowing.
any help appriciated.
thanks
suresh


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: