cancel
Showing results for 
Search instead for 
Did you mean: 

Getting a PCM Output on uPSD3400

davidm
Associate II
Posted on February 03, 2006 at 00:58

Getting a PCM Output on uPSD3400

2 REPLIES 2
davidm
Associate II
Posted on May 17, 2011 at 12:10

My attempts at getting a simple PWM output on TCM5 leaves me baffled.

My Keil code on a 24MHz uPSD3434E is:-

PCACON1 = 0x00; // Disable PCA, use prescaled clock

CCON3 = 0x14; // 1:16 prescaler, PCA clock enabled

TCMMODE5 = 0x41; // fixed frequency PWM

CAPCOMH5 = 0x80; // nominal 50% duty cycle

PCACH1 = PCACL1 = 0; // zero the counter

// Set P4.6 for TCM5 use

P4SFS0 |= 0x40;

P4SFS1 &= ~0x40;

PCACON1 |= 0x40; // Enable PCA

I am not seeing any activity on P4.6 so I have missed something, perhaps others can see my obvious mistake.

To add a note: I assume interrupts are not necessary when operating the PCA for PWM output as all interaction is contained within the PCA hardware.

davidm
Associate II
Posted on May 17, 2011 at 12:10

To answer my own post - in another software module P4SFS0 was being cleared soon after the PWM setup - effectively returning the port pin to GPIO mode. No wonder there was no PWM activity.

Lesson learnt - adjust only those attributes that are applicable to the module which in my case is P4SFS0 &= ~0xC0 and not P4SFS0 = 0 as I had.