PWM Hardware problem???!!!

Started by power_overwhelming_4 October 13, 2004

I just recently soldered header pins on the pins 25, 26, 27 of the
BX-24 chip. Last month I tested the PWM in pin 26 via the example
program in BasicX "PWM Example" and it worked, including the dimming
of the green LED (which is connected to the pin 26).

However, I really need dual PWMs. I'm just new to using the PWMs in
BX. When i connected the chip to my H-bridges with the motor plus
the control software, the problems began to appear. The PWM in pin
26 seems to be wrong, the green LED is not blinking either. I
tested the chip using the "PWM example" program again that generates
dual PWM and uses pins 26 and 27. I connected an oscilloscope probe
to both pins. Pin 27 PWM is fine -it generates pulse trains and it
continually updates its PWM duty cycle according to the program.
But pin 26 is not responding - it is always in between 4 V and 5V,
if you look at it at the oscilloscope. No pulses are present, and
the green LED is not blinking either.

So I thought that it might be due to header connections in pin 26.
It might be loosely connected. Just to make sure, I ran the LED
demo program included in BasicX package - it uses pins 25 and 26 to
blink the red (connected to 25 accdng. to schematic) and green LED
by sending pulses. I also connected probes on both pins. The red
LED blinks, but the green doesn't. But both pins 25 and 26 displays
pulsed waveform on the scope, and from there i conclude that pin 26
I/O pin is not the problem. But if I used PWM again, using the PWM
example program, nothing happens - no pulse trains appear. Only 4 -
5 V DC is present. What may have caused this improper behavior? Is
the Atmel chip the one at issue here? Is the problem a hardware
one, and is the problem on-board? How can I further track the
error? Help!!!




I encountered the same problem while using both PWM outputs.

If you look at the BX-24 schematic, (C:\program
files\basicx\bx24_docs\bx24_schematic.gif),
you will see that pin 26, OC1A, is connected to the cathode side of the
green LED. Notice that
pin 27, OC1B, has no such connection. Electric current through the green LED
is the problem.
Simply cut the copper trace on the bottom of the BX24 module leading away
from pin 26. That
frees pin 26 from the LED. Then, again from the bottom, solder a thin jumper
wire across the
two vias, or holes, at the bottom left corner of the BX24Q. This attaches
the cathode side of the
green LED to ground so it can light whenever power is applied. You can skip
this step if you wish.
You will now have both PWM outputs functioning properly.

Chuck



> ... Simply cut the copper trace...

I have two dual-PWM BX-24 projects running on the bench. I've done two
others in the last few years that also use dual-PWM from the BX-24.
I've never cut a run on the module, and I suggest that you do not do so. Tom
Tom Becker
--... ...--
www.RighTime.com
The RighTime Clock Company, Inc., Cape Coral, Florida USA
+1239 540 5700


> ... no pulse trains appear. Only 4-5 VDC...

Try setting pins 26 and 27 to Input, either in the IDE (Project/Chip) or
using PutPin in your code before initializing PWM mode. Perhaps you
have pin 26 set as a high output. Tom
Tom Becker
--... ...--
www.RighTime.com
The RighTime Clock Company, Inc., Cape Coral, Florida USA
+1239 540 5700


Tom,

I'd love to see the circuit you have tied to P26. I studied and tested for
several days
before I discovered that any circuit, that eventually went to GND, caused
current to
flow through the green LED. Cutting the run was the only solution. Also, in
the PWM
example program, both PinOC1A and PinOC1B are set to bxOutputLow. Did you
use the PWM example program or some other code?

Chuck ----- Original Message -----
From: "Tom Becker" <>
To: <>
Sent: Wednesday, October 13, 2004 8:25 AM
Subject: RE: [BasicX] PWM Hardware problem???!!! >
>> ... Simply cut the copper trace...
>
> I have two dual-PWM BX-24 projects running on the bench. I've done two
> others in the last few years that also use dual-PWM from the BX-24.
> I've never cut a run on the module, and I suggest that you do not do so. > Tom >
> Tom Becker
> --... ...--
> www.RighTime.com
> The RighTime Clock Company, Inc., Cape Coral, Florida USA
> +1239 540 5700 > Yahoo! Groups Links





> ... I'd love to see the circuit you have tied to P26...

Pins 26 and 27 feed simple HCMOS gates in my stuff. They are inputs, of
course, which draw essentially no current in either state. The only
path that will pull the green LED cathode to ground - in my projects -
is the BX-24 pin 26 driver, in the 8535. That driver will easily pull
the pin to ground, whether the green LED cathode is connected to it or
not. Tom
Tom Becker
--... ...--
www.RighTime.com
The RighTime Clock Company, Inc., Cape Coral, Florida USA
+1239 540 5700



I just loaded and ran the BX-24 PWM example. I started, I'm certain,
with this code but mine looks nothing like it now. Still, the example
code runs fine and it does, as you point out, set the pins to low output
initially. My suggestion to make them inputs will not help.

FWIW, it is possible to see the PWM on both pins without a scope by -
making sure pin 25 is an input - jumpering pins 25 and 27. If the demo
does not exercise both LEDs in that configuration, something is wrong
with the module. If both LEDs do cycle through the 10-second loop, the
module is probably fine. Tom
Tom Becker
--... ...--
www.RighTime.com
The RighTime Clock Company, Inc., Cape Coral, Florida USA
+1239 540 5700


Tom,

In using HC logic, you sink the inputs to GND to drive the component.
With the op-amp I was using I had to source the input, thus allowing current
from
the op-amp's input through the LED to VCC. This is what was distorting the
output of the op-amp. By sinking the input, current flowed from P26 equally
through the LED and the HC component, which eliminated any distortion.
Interesting stuff!!! Good lesson for everyone!

Chuck



> ... current flowed from P26 equally through the LED and the HC
component...

No, that's incorrect, Chuck. The CMOS input is essentially a voltage
input; it draws and supplies little practical current. When the BX-24
output pin is pulled to ground by the processor the voltage on the pin
drops to zero; that's what the CMOS logic sees. As it happens,
simultaneously, current is drawn through the green LED via its series
resistance from Vcc; because the current required by the LED is not
large, it's effect on the output pin voltage is small.

Chuck, your view of current flow is classically correct, I believe;
electrons move from negative toward positive supplies. Conventional
current flow, though, is usually viewed as the opposite, from positive
toward negative supplies. Are you classically educated? Tom
Tom Becker
--... ...--
www.RighTime.com
The RighTime Clock Company, Inc., Cape Coral, Florida USA
+1239 540 5700



Classically educated?

No, not really. I was thinking about electron flow and typing at
the same time. The point is, your circuit was sinking voltage and
mine was sourcing voltage. In you circuit, current, in the
conventional thinking, flows from VCC through the pullup resistor,
thru the LED to GND. At the same time current flows from VCC
thru your CMOS component to the same GND. Good results. In my circuit,
current flowed from the LED and the BX24 into the op-amp's GND.
Two sources thru the same component distorted the expected results.
I had to cut the LED free to allow only the BX24 output to source
voltage to the op-amp. Again, this is something we all need to think
about when connecting external devices to any microcontroller.
Look for the unexpected consequences of that connection.

Chuck