AnsweredAssumed Answered

OSBDM - how I did it

Question asked by Jaromir Sukuba on Feb 4, 2007
Latest reply on Dec 11, 2007 by Jaromir Sukuba
Hi all.
Hope you don't mind a few words to illustrate how I got to my version of OSBDM.

Few months ago I built "original" OSBDM for HCS08, with two 74LVC1T45 buffers. That time I had virtually none experiences wit HCS08 family (alhough I worked for years with other MCU's). It worked perfectly for RD16 device and didn't work for QG8 device. Later I found out that only way how to get QG8 into debug mode is holding BKGD pin low while power-on reset (somebody from Freescale explained here on forum why it is so), adding button on my experimental board solved this. I found holding button everytime I need disconnect and reconnect my hardware (for circuit changes) annoying, that's why I looked for some way to do this automatically. That time update for OSBDM was issued (including support for RS devices, look on that long thread by Joerg). In that circuit is RESET circuitry omitted for HCS devices and for RS devices it is just to bring "high" voltage to target. That's why all HCS devices must start debug mode just with BKGD pin low while power-on reset (not only QG). This is handled with resistor and capacitor (transient on capacitor ensures low voltage for a short time on BKGD pin). I did further experiments with my OSBDM. LVC buffer for RESET pin was suspended (by removing appropriate 47R resistor) and I added RC (22kohms and 1uF) circuit + small schottky diode to BKGD pin, as necessary. I found out that this circuit is unreliably. Target very often didn't get into debug mode, thus OSBDM plus Hiwave wasn't able to connect it. Getting it into debug mode was always a long work.
I took my favourite simulation program and tried to simulate behaviour of this RC device on simulated power-on reset. It happens exactly what I expected. Considering that for Vdd=3V is Vil about 1V (according to datasheet 0.35*Vdd), voltage on BKGD pin will excess this in a few milliseconds, but get above Vih after about twice the time! Slowly changing "analog" voltage on digital input is in general ilegal and incorrect, that's why I tried to improve it a little bit. I added a transistor, resistor, decreased capacity, as you can see here, on this schematics:

on power-on, capacitor is charging and transistor is opened because of current flowing into it's base. Volatage on BKGD pin is forced to low level. As capacitor is charging, voltage on it increases, currend through resistors decreases and volatage on R2 falls down. After a some time (given mostly by resistors and capacitor) volatage on R2 falls down below Vbe limit, transistor gets closed realtively fast (because of "knee" on VA characteristics of B-E junction, as well as other PN junctions) and BKGD pin is released as fast. R2 also ensures discharge of capacitor (discharging through this resistor and rest of whole debugged circuit) after power-down, to get OSBDM ready to start again. Voltage change (between low and high level) on it's collector is much faster compared to original circuit with only RC device. Here you can see oscillograms of simulation.

I simulated two circuits at once, one with transistor and original one. Red curve means voltage on BKGD pin with transistor circuit, green one means voltage on the same pin with just RC device and diode. Blue arrow shows approximately start of transient (power-on). I think it's clearly to see difference.
Of course, I realised the circuit to verify my calculations. Targets (I tried both RD16 and QG8) supplied 3V from external LE30 regulator gets into debug mode much more reliable compared to original RD circuit. I'm quite satisfied with this circuit. I used old KC238 transistor from my junk-box. It's a small silicone transistor in TO92, older than I am. BC550, 2N3904 or any general purpose NPN transistor would do the job, probably.
And I also would be happy if somebody can try my small improvement to verify it's functionality again and report comments or suggestions.

I'm considering to built better device to hold BKGD pin low, with comparator and RC device. I added some MCP6546 comparators from Microchip to my last order and I'll try to use them for this purpose. I'll report about it.

I'm going to start to make PCB for this OSBDM, I'll place it and whole schematics here on forum when done.

I tried to describe it as clear as possible, in my native language it would be definitely better, but unfortunately it's not the case of English language.