[quote="CptTitanic"]Yes, so you're not initializing the clock on the peripheral device you wish to configure.
AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_PIOB); // Enable Clock to PIOB
See Page 24
http://www.atmel.com/dyn/resources/prod ... oc6221.pdf[/quote]Ok, thanks for hint, I've checked the docs and got following peripheral id numbers:
Port A - 2
Port B - 3
Port C - 4
According to this info, I've renamed void initPIO_Port(const AT91PS_PIO port) to void initPIO_PortPins(const AT91PS_PIO port) and added void initPIO_Port(const AT91PS_PIO port, const unsigned int iPeripheralId) method:
void initPIO_PortPins(const AT91PS_PIO port)
{
if(port==0)
return;
port->PIO_PER=0xffffffff;
port->PIO_OER=0xffffffff;
} // initPIO_Port
void initPIO_Port(const AT91PS_PIO port,
const unsigned int iPeripheralId)
{
// AT91PS_SYS pSystemPeripheral=AT91C_BASE_SYS;
AT91PS_PMC pPMController=AT91C_BASE_PMC;
//pSystemPeripheral->PMC_PCER|=(1<<iPeripheralId); // Enable Clock to selected PIO
pPMController->PMC_PCER|=(1<<iPeripheralId); // Enable Clock to selected PIO
initPIO_PortPins(port);
}
But it still does not work! All Power Management Controller (Clock and etc) is done in previous code from lecturer, why still does not work??