Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).
Problem with PWM4 on 9S12C128 80 pin version - Nigel Johnson - Jan 3 20:47:40 2008
I have downloaded AN2250, which was written in CW for the DP256. I
converted and compiled it under gcc3.6.
I am trying to generate pwm audio on PWM4, using the generate sounds
app from AN2250.
The output of PWM4, pin 80, is connected to a first order filter
consisting of a .01 uF to gnd and A 47Kohm going to a 4066 input which
is disabled.
I have tried all combinations of input/output pull-up, pull-down, no
pulls on the pin and all I can get is the (apparently) correct
waveforms running at 100mV, as if it is breakthrough from some routing
device that I have not enabled.
Debugging it live using NoICE and a PE micro USB Multilink, all I can
do is change the amplitude to 50% if I set the reduced drive enable
bit for the pin.
I have scanned all the individual module manuals and can't see
anything about routing the PWM to port P - does anybody have any ideas
about what might be going wrong here?
Any help will be appreciated.
regards,
Nigel Johnson
ve3id
The Toronto Repeater Controller Project

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Problem with PWM4 on 9S12C128 80 pin version - Petrescu - Jan 4 1:14:03 2008
Hi,
From what you write, it seems to me you have a wrong connection:
The output pin should go first to a 47K resistor and then to the
capacitor to gnd.
The common point of RC should go to the 4066 input.
Otherwise you shorted the output with a capacitor to gnd and what you see is
only the normal ripple.
Yoan
Nigel Johnson wrote:
>
> I have downloaded AN2250, which was written in CW for the DP256. I
> converted and compiled it under gcc3.6.
>
> I am trying to generate pwm audio on PWM4, using the generate sounds
> app from AN2250.
>
> The output of PWM4, pin 80, is connected to a first order filter
> consisting of a .01 uF to gnd and A 47Kohm going to a 4066 input which
> is disabled.
>
> I have tried all combinations of input/output pull-up, pull-down, no
> pulls on the pin and all I can get is the (apparently) correct
> waveforms running at 100mV, as if it is breakthrough from some routing
> device that I have not enabled.
>
> Debugging it live using NoICE and a PE micro USB Multilink, all I can
> do is change the amplitude to 50% if I set the reduced drive enable
> bit for the pin.
>
> I have scanned all the individual module manuals and can't see
> anything about routing the PWM to port P - does anybody have any ideas
> about what might be going wrong here?
>
> Any help will be appreciated.
>
> regards,
> Nigel Johnson
> ve3id
> The Toronto Repeater Controller Project
>
>

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Problem with PWM4 on 9S12C128 80 pin version - Edward Karpicz - Jan 4 1:16:09 2008
Yeah, looks like RC input is swapped with output.
And regarding PMW/TIM routing. Nigel, did you see MODRR register in the
docs? C family allows to route individual PWM outputs from port P pins to
port T pins. But if you didn't touch MODRR, then it should default to PWM on
port P pins.
Edward
Petrescu wrote:
> Hi,
> From what you write, it seems to me you have a wrong connection:
> The output pin should go first to a 47K resistor and then to the
> capacitor to gnd.
> The common point of RC should go to the 4066 input.
> Otherwise you shorted the output with a capacitor to gnd and what you see
> is
> only the normal ripple.
> Yoan
>
> Nigel Johnson wrote:
>>
>> I have downloaded AN2250, which was written in CW for the DP256. I
>> converted and compiled it under gcc3.6.
>>
>> I am trying to generate pwm audio on PWM4, using the generate sounds
>> app from AN2250.
>>
>> The output of PWM4, pin 80, is connected to a first order filter
>> consisting of a .01 uF to gnd and A 47Kohm going to a 4066 input which
>> is disabled.
>>
>> I have tried all combinations of input/output pull-up, pull-down, no
>> pulls on the pin and all I can get is the (apparently) correct
>> waveforms running at 100mV, as if it is breakthrough from some routing
>> device that I have not enabled.
>>
>> Debugging it live using NoICE and a PE micro USB Multilink, all I can
>> do is change the amplitude to 50% if I set the reduced drive enable
>> bit for the pin.
>>
>> I have scanned all the individual module manuals and can't see
>> anything about routing the PWM to port P - does anybody have any ideas
>> about what might be going wrong here?
>>
>> Any help will be appreciated.
>>
>> regards,
>> Nigel Johnson
>> ve3id
>> The Toronto Repeater Controller Project

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Problem with PWM4 on 9S12C128 80 pin version - VE3ID - Jan 4 19:48:58 2008
Aargh! I can't believe I did that! You are right. I started drawing it
with input from the left, coming from a DAC. When I changed to the PWM,
it was coming from the right of the schematic and I forgot to reverse it!
Thanks. How much do I pay you for not telling anybody about my stupid
mistake?
cheers,
Nigel
Petrescu wrote:
>
> Hi,
> From what you write, it seems to me you have a wrong connection:
> The output pin should go first to a 47K resistor and then to the
> capacitor to gnd.
> The common point of RC should go to the 4066 input.
> Otherwise you shorted the output with a capacitor to gnd and what you
> see is
> only the normal ripple.
> Yoan
>
> Nigel Johnson wrote:
> >
> > I have downloaded AN2250, which was written in CW for the DP256. I
> > converted and compiled it under gcc3.6.
> >
> > I am trying to generate pwm audio on PWM4, using the generate sounds
> > app from AN2250.
> >
> > The output of PWM4, pin 80, is connected to a first order filter
> > consisting of a .01 uF to gnd and A 47Kohm going to a 4066 input which
> > is disabled.
> >
> > I have tried all combinations of input/output pull-up, pull-down, no
> > pulls on the pin and all I can get is the (apparently) correct
> > waveforms running at 100mV, as if it is breakthrough from some routing
> > device that I have not enabled.
> >
> > Debugging it live using NoICE and a PE micro USB Multilink, all I can
> > do is change the amplitude to 50% if I set the reduced drive enable
> > bit for the pin.
> >
> > I have scanned all the individual module manuals and can't see
> > anything about routing the PWM to port P - does anybody have any ideas
> > about what might be going wrong here?
> >
> > Any help will be appreciated.
> >
> > regards,
> > Nigel Johnson
> > ve3id
> > The Toronto Repeater Controller Project
> >
> >
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.17.13/1209 - Release Date: 2008-01-04 12:05
>
--
Nigel Johnson
MSc., MIEEE, MCSE
VE3ID/G4AJQ/VA3MCU
http://nigel.homelinux.net
http://va3mcu.ham-radio-op.net
You can reach me by voice on Skype: TILBURY2591
If time travel ever will be possible, it already is. Ask me again yesterday
It's "is not", it isn't "ain't", and it's "it's", not "its", if you mean it is. If you
don't, it's "its". Then too, it's "hers". It isn't "her's". It isn't "our's" either. It's
"ours", and likewise "yours" and "theirs".
-- Oxford University Press, Edpress News
Nigel Johnson

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )Re: Problem with PWM4 on 9S12C128 80 pin version - "smith.jeff28" - Jan 4 20:29:06 2008
How about posting the converted gcc project in the files section, and
we won't tell anybody about your boo boo.
*Like I haven't done that myself*

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Problem with PWM4 on 9S12C128 80 pin version - VE3ID - Jan 4 21:40:15 2008
Yes, MODRR is clear (untouched) but the problem is with the R/C network,
see my previous post. If if I had set the bit in MODRR, the doc says
it should be outputting on PTP as well because it is for the
lower-pin-count version that has not a port P bit 4.
Thanks!
Nigel
Edward Karpicz wrote:
>
> Yeah, looks like RC input is swapped with output.
> And regarding PMW/TIM routing. Nigel, did you see MODRR register in the
> docs? C family allows to route individual PWM outputs from port P pins to
> port T pins. But if you didn't touch MODRR, then it should default to
> PWM on
> port P pins.
>
> Edward
>
> Petrescu wrote:
>
> > Hi,
> > From what you write, it seems to me you have a wrong connection:
> > The output pin should go first to a 47K resistor and then to the
> > capacitor to gnd.
> > The common point of RC should go to the 4066 input.
> > Otherwise you shorted the output with a capacitor to gnd and what
> you see
> > is
> > only the normal ripple.
> > Yoan
> >
> > Nigel Johnson wrote:
> >>
> >> I have downloaded AN2250, which was written in CW for the DP256. I
> >> converted and compiled it under gcc3.6.
> >>
> >> I am trying to generate pwm audio on PWM4, using the generate sounds
> >> app from AN2250.
> >>
> >> The output of PWM4, pin 80, is connected to a first order filter
> >> consisting of a .01 uF to gnd and A 47Kohm going to a 4066 input which
> >> is disabled.
> >>
> >> I have tried all combinations of input/output pull-up, pull-down, no
> >> pulls on the pin and all I can get is the (apparently) correct
> >> waveforms running at 100mV, as if it is breakthrough from some routing
> >> device that I have not enabled.
> >>
> >> Debugging it live using NoICE and a PE micro USB Multilink, all I can
> >> do is change the amplitude to 50% if I set the reduced drive enable
> >> bit for the pin.
> >>
> >> I have scanned all the individual module manuals and can't see
> >> anything about routing the PWM to port P - does anybody have any ideas
> >> about what might be going wrong here?
> >>
> >> Any help will be appreciated.
> >>
> >> regards,
> >> Nigel Johnson
> >> ve3id
> >> The Toronto Repeater Controller Project
> >>
> >>
> >
> >
> >
> >

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Problem with PWM4 on 9S12C128 80 pin version - Edward Karpicz - Jan 5 3:52:43 2008
Thanks! You are right, C-family MODRR routing isn't switching PWM from PTP
to PTT. PWM are always outputed to PTP. Using MODRR PWMs can be gated and
doubled on PTT. I could get caught by this in my last design that is using
52pins xPB package.
It's interesting that doubling PWM on 2 pins is explained only under figure
"Pin Assignments In 80-Pin QFP":
"Note that when mapping PWM channels to Port T in an 80QFP option, the
associated PWM channels are then mapped to both Port P and Port T"
I think it should be the same for 52pins package. PTP3 and PTP4 are bounded
out in 52-pin QFP, but I didn't find a note about PWM on both port P and
port T and 52pins pkg. That could explain why I missed it, I just didn't
read about 80-pins package I'm not using...
Edward
"VE3ID" wrote:
> Yes, MODRR is clear (untouched) but the problem is with the R/C network,
> see my previous post. If if I had set the bit in MODRR, the doc says
> it should be outputting on PTP as well because it is for the
> lower-pin-count version that has not a port P bit 4.
>
> Thanks!
>
> Nigel
>
> Edward Karpicz wrote:
>>
>> Yeah, looks like RC input is swapped with output.
>> And regarding PMW/TIM routing. Nigel, did you see MODRR register in the
>> docs? C family allows to route individual PWM outputs from port P pins to
>> port T pins. But if you didn't touch MODRR, then it should default to
>> PWM on
>> port P pins.
>>
>> Edward
>>
>> Petrescu wrote:
>>
>> > Hi,
>> > From what you write, it seems to me you have a wrong connection:
>> > The output pin should go first to a 47K resistor and then to the
>> > capacitor to gnd.
>> > The common point of RC should go to the 4066 input.
>> > Otherwise you shorted the output with a capacitor to gnd and what
>> you see
>> > is
>> > only the normal ripple.
>> > Yoan
>> >
>> > Nigel Johnson wrote:
>> >>
>> >> I have downloaded AN2250, which was written in CW for the DP256. I
>> >> converted and compiled it under gcc3.6.
>> >>
>> >> I am trying to generate pwm audio on PWM4, using the generate sounds
>> >> app from AN2250.
>> >>
>> >> The output of PWM4, pin 80, is connected to a first order filter
>> >> consisting of a .01 uF to gnd and A 47Kohm going to a 4066 input which
>> >> is disabled.
>> >>
>> >> I have tried all combinations of input/output pull-up, pull-down, no
>> >> pulls on the pin and all I can get is the (apparently) correct
>> >> waveforms running at 100mV, as if it is breakthrough from some routing
>> >> device that I have not enabled.
>> >>
>> >> Debugging it live using NoICE and a PE micro USB Multilink, all I can
>> >> do is change the amplitude to 50% if I set the reduced drive enable
>> >> bit for the pin.
>> >>
>> >> I have scanned all the individual module manuals and can't see
>> >> anything about routing the PWM to port P - does anybody have any ideas
>> >> about what might be going wrong here?
>> >>
>> >> Any help will be appreciated.
>> >>
>> >> regards,
>> >> Nigel Johnson
>> >> ve3id
>> >> The Toronto Repeater Controller Project
>> >>
>> >>
>> >
>> >
>> >
>> >

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Problem with PWM4 on 9S12C128 80 pin version - Nigel Johnson - Jan 5 15:27:09 2008
--- In 6...@yahoogroups.com, "smith.jeff28"
wrote:
>
> How about posting the converted gcc project in the files section, and
> we won't tell anybody about your boo boo.
>
> *Like I haven't done that myself*
>
I have posted it as PWM_tone_gen.zip. There is all sorts of
experimental stuff in there you can take out, but the PWM part works
on PP4
cheers,
Nigel

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )