Topic: PWM signals on P200 header not working

Hello,

I am trying to get the PWM2, 3, and 4 signals working with no success. I went through every post I could find and the datasheet for the processor. I even checked the HW_CLKCTRL_XTAL register to make sure the clock was turned on to the PWM hardware. I am trying to control PWM2. This is the sequence I attempted.

HW_PINCTRL_MUXSEL3_CLR = 0x03000000
HW_PWM_CTRL = 0  // doing this makes the registers accessible.
HW_PWM_ACTIVE2 = 0x01770000
HW_PWM_PERIOD2=0x005b1d4c
HW_PWM_CTRL=4

Am I missing something? Did I do the wrong sequence? Is PWM2 really available?

Ivan

Re: PWM signals on P200 header not working

Where are you tapping PWM2 on P200?  I didn't think it was exposed on P200?

From the schematics I had the impression that PWM2 is routed to P406 and then to the LED stepup-converter chip.  I don't have a CHB handy to confirm this with, but P406 looks like it must be a jumper.  If you removed the jumper you would disconnect PWM2 from the video circuitry and have PWM2 available on pin 2 (but don't use pin 1 as GND).  The only problem then is making sure that there is no video driver wrestling with you for control of the signal.

I should add that I'm a software guy and everything I say about hardware is probably wrong.

Re: PWM signals on P200 header not working

On the opposite side of P200, the pins are labeled. PWM2 is labeled as PM2. Looking at the schematics, it is brought out from the processor to the connector as PWM2. I will look into the P406.

I also tried PWM0 and 1 on the debug uart connector with no success. I can't believe it would be this difficult.

Ivan

Re: PWM signals on P200 header not working

I found P406 and it had a shorting block on it. I removed it. Interesting behaviour.  With the shorting block removed, the signal is high when I configure PWM2. When I insert the shorting block, the signal goes low and stays low even when removing the shorting block. Not sure what that means.

But still no PWM signal. I checked HW_TIMROT_ROTCTRL to make sure the rotary encoder was not using the PWM signals for input.

Ivan

Re: PWM signals on P200 header not working

Derp, I was looking at the wrong version of the schematics which is why I couldn't find PWM2 on P200.
Agreed this shouldn't be so hard; I hope we as a community can get together a critical mass of documentation to make it easier.

It appears to me like PWM0 and PWM1 are connected to the JTAG interface, PWM2 to the LCD driver circuit (unless isolated at P406), PWM3 to the accelerometer interrupt output.  PWM4 looks like it might be connected to pin E on the D-pad at SW400, but I'm unsure how to interpret the schematic labels there.  That would suggest 3 and 4 are  being used as inputs.  Seems like pulling P406 and using PWM2 is the cleanest avenue.

Let us know if you make progress.

Re: PWM signals on P200 header not working

I have a person who also tried programming. He went a step further and configured the PWM ports as GPIO and was able to control the ports so some other task or driver is not overwriting the port. This was done with PWM2. The jumper on P406 was removed.

What is the task acceld that I see? Is that a daemon for the accelerometer?

Re: PWM signals on P200 header not working

ivang44 wrote:

What is the task acceld that I see? Is that a daemon for the accelerometer?

Yes.

Re: PWM signals on P200 header not working

OK, found what was stopping the PWM. The clock to the PWM was disabled. I fixed by by clearing bit 29 in register HW_CLKCTRL_XTAL.

I'm learning about this particular processor. The enables are opposite than the other processors I work on.

This is good. Now I can move on with my project. Next is to get the APPUART working and see where the USB signals on P200 go.