|
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
|