Java 2 Ada

Fixing the rising edge of a 68HC11 output signal

By stephane.carrez

My embedded board uses a 68HC11 micro-controller that drives a PNP transistor to control some output. The software has to generate small pulses of 4 to 5 microsecond each millisecond. This is not something that you can observe easily, at least you need an oscilloscope and trigger it correctly. After plugging the oscilloscope, the signal looked like the following:

The output signal has a raising edge of arround 18.4 us (between the two highlighted points). This is huge for a micro-controller that is capable of generating 1 us pulses with a typical raising edge of 100 ns. There is an electronic explanation to this situation even though the cause was a software issue.

In the board the 68HC11 output drives a PNP transistor through a 100K resistor as shown above. What happens is that the PNP transistor has a parasitic capacitor that has to be charged and discharged. On the 68HC11 side, the output was configured with open collector, hence making this discharge very slow. The transistor was connected to a PORT D output and the PORT D was configured with Wire-OR mode, thus disabling the pull-up MOSFET of the output. After clearing the SPCR register (or more precisely the DWOM bit in that register), the signal looked good.

I was then able to generate by software a pulse of 4.5 us as needed.

The conclusion is that the use of an oscilloscope was more than helpful to spot the issue!