Monday, 12 March 2007

PWM Signals on a PXA270 Chip

NB Clearly this is a non-chess post

Trap for young players trying to get a PWM (Pulse Width Modulation) signal off a PXA270 chip using the Colibri board. As a power saving feature, the 13Mhz clock used to control the signal is switched OFF by default, and must be enabled before anything can happen. To do this you need to set either bits 0 or 1 in the CKEN (Clock Enable) register which is mapped to memory location 0x4130_0004.

1 comment:

Anonymous said...

Hi,
I’m trying to use the Colibri PXA270’s PWM (PWM1, GPIO 17) functions by configuring registers (even CKEN).
But it does not work. I always have a '0' in GPIO 17.

Here find my configuration:

pGPIORegs=(GPIOREG*)MapRegister(0x40E00000)

pGPIORegs->gpdr0|=(1<<17); //Set GPIO17 as output

pGPIORegs->gafr0_u = (pGPIORegs->gafr0_u)|0x00000008; //use special function 2 for pwm(1)=gpio17



pCKEN=(DWORD*)MapRegister(0x41300004)); //13Mhz clock enabled

*pCKEN|=0x1;



pPWM1REG = (PWM1REG*)MapRegister(0x40C00000);

pPWM1REG->pwmcr1 = 0x00000003; //CONTROL REGISTER : prescaler = 3+1, PSCLK = 13Mhz by default

pPWM1REG->pwmdcr1 = 0x00000020; //DUTY CYCLE REGISTER : duty = 32 (50%)

pPWM1REG->pwmpcr1 = 0x00000040; //PERIOD REGISTER : period = 64+1

Did I forget something? Did I make a mistake?

Thank you for your help.

Best regards