Author Topic: Noob question isolating homemade programmer  (Read 3368 times)

0 Members and 3 Guests are viewing this topic.

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Noob question isolating homemade programmer
« on: March 07, 2020, 01:00:09 am »
Hello I have no real background designing stuff but I made a in circuit EEprom programmer for instrument clusters I work on a lot. Its currently a breadboard project but I want to take it to the next step and make a shield with easyeda.

Before I can move on to that next step I want to Isolate the Micro controller and its power supply from the EEprom that is going to be programmed while it is not reading/writing. reason for this is so that way I don't risk damaging the circuit board I am flashing while attaching the connector and so I don't have to unplug the connector every time I turn the boards I am programming to test the results. my current work around is that I just unplug the 5v/ground pin off the Arduino.

What would be the best way to do that? I feel like a relay is overkill. Use transistors as switches? 

maybe y'all could look over the project and let me know if you think I overlooked anything. I want it be open for anyone else to make the same thing.
Here is a video I did on it: https://youtu.be/JH3pLX_Xkbk
Github on it: https://github.com/garnerm91/st95020
« Last Edit: March 07, 2020, 03:02:56 am by Fixed_Until_Broken »
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 7195
  • Country: fi
    • My home page and email address
Re: Noob question isolating home made programmer
« Reply #1 on: March 07, 2020, 03:06:10 am »
Get yourself an Arduino Pro Micro clone off eBay, and treat it as if it was an Arduino Leonardo.  Also get a cheap ADuM3160 USB isolator.  All told this will cost you about ten, twelve bucks or so.  The isolator has a small DIP switch; make sure it is in the position that lights up the blue led (full speed, 12 Mbit/s) and not in the other position (low speed, 1 Mbit/s).

Change the pins in your Arduino sketch to match the Arduino Pro Micro pinout.  For everything other than the pinout, treat the clones as Arduino Leonardos in the Arduino environment.  (This is because the Pro Micro clones do not have the SparkFun bootloader, just the standard Arduino Leonardo bootloader.  So, the clones are essentially Arduino Leonardos [which has the same ATmega32u4 microcontrollers], but with the same pinout as SparkFun Pro Micros.)

The ADuM3160 isolates the USB bus from the microcontroller up to one kilovolt.  The isolated DC-DC converter on them provides about 200mA, which should be plenty enough for your use case.
 

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #2 on: March 07, 2020, 03:18:56 am »
What I am trying to isolate is the 5volt and ground feed going to my SOP8 clip I am using to program the eeprom. Maybe I am using the wrong word I want to turn off of power to the clip when it is not reading/writing. If that makes sense? Its mostly to protect the circuit board that is being programmed just in case someone does something stupid like clip it on the wrong IC or clip it backwards.
 

Offline angrybird

  • Regular Contributor
  • *
  • !
  • Posts: 142
  • Country: pr
  • I have a particular fascination with birds.
Re: Noob question isolating homemade programmer
« Reply #3 on: March 07, 2020, 05:32:58 am »
Hello I have no real background designing stuff but I made a in circuit EEprom programmer for instrument clusters I work on a lot. Its currently a breadboard project but I want to take it to the next step and make a shield with easyeda.

Before I can move on to that next step I want to Isolate the Micro controller and its power supply from the EEprom that is going to be programmed while it is not reading/writing. reason for this is so that way I don't risk damaging the circuit board I am flashing while attaching the connector and so I don't have to unplug the connector every time I turn the boards I am programming to test the results. my current work around is that I just unplug the 5v/ground pin off the Arduino.

What would be the best way to do that? I feel like a relay is overkill. Use transistors as switches? 

maybe y'all could look over the project and let me know if you think I overlooked anything. I want it be open for anyone else to make the same thing.
Here is a video I did on it: https://youtu.be/JH3pLX_Xkbk
Github on it: https://github.com/garnerm91/st95020

So, umm, you rewriting odometers there, buddy?  :D
THE CAKE IS A LIE AND THESE NUTHATCH ARE WAY TOO DISTRACTING
 

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #4 on: March 07, 2020, 03:04:38 pm »
So, umm, you rewriting odometers there, buddy?  :D

I mean you can and I do a lot of odometer corrections if you buy a used cluster you have 2 options install it as is and now you have report in writing that the odometer is inaccurate or you are committing felony here in the US and that doesn't matter if it is high or low. Your other option is to program to the correct amount. I didn't really make the tool for odometer correction though the digiprog is a cheap ass tool that does that just fine the same way the arduino is doing and Xstar makes a cheap obd2 tools that do it better and easier you don't have take the board apart.

What I am doing with it for the most part is going in and enabling trans temp, turning km clusters into miles, fix odometer error and yes odometer correction. the tools mentioned before can't do that.
 

Offline angrybird

  • Regular Contributor
  • *
  • !
  • Posts: 142
  • Country: pr
  • I have a particular fascination with birds.
Re: Noob question isolating homemade programmer
« Reply #5 on: March 07, 2020, 03:06:22 pm »
So, umm, you rewriting odometers there, buddy?  :D

Mi amigo, why are you so fascinated in car repairing?

Hi mr. communist, I'm sorry that I made you angry in the other thread, please don't derail this one.
THE CAKE IS A LIE AND THESE NUTHATCH ARE WAY TOO DISTRACTING
 

Offline angrybird

  • Regular Contributor
  • *
  • !
  • Posts: 142
  • Country: pr
  • I have a particular fascination with birds.
Re: Noob question isolating homemade programmer
« Reply #6 on: March 07, 2020, 03:12:57 pm »
So, umm, you rewriting odometers there, buddy?  :D

I mean you can and I do a lot of odometer corrections if you buy a used cluster you have 2 options install it as is and now you have report in writing that the odometer is inaccurate or you are committing felony here in the US and that doesn't matter if it is high or low. Your other option is to program to the correct amount. I didn't really make the tool for odometer correction though the digiprog is a cheap ass tool that does that just fine the same way the arduino is doing and Xstar makes a cheap obd2 tools that do it better and easier you don't have take the board apart.

What I am doing with it for the most part is going in and enabling trans temp, turning km clusters into miles, fix odometer error and yes odometer correction. the tools mentioned before can't do that.

Hehe, thought so.  I have used various tools in the past for cluster changes but I very careful with odometer corrections - With these, trust no one and keep records on all customers to protect yourself!  Some time ago I took a guy to court for something related to this, about a year after buying a car from him. He sent the cluster in to an internet vendor for the odometer change, and sold it to me with 50k less miles than it actually had.  He did a pretty good job keeping mileage records off of carfax and the like but I found some records at an independent repair shop and that was what started it.  It ended up costing him more than $30k for a $7k car in the end, and I got my money and damages and he got the car back with a bad transmission  :-DD
THE CAKE IS A LIE AND THESE NUTHATCH ARE WAY TOO DISTRACTING
 

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #7 on: March 07, 2020, 04:11:11 pm »
Back on topic though. How would y'all switch the 5volts and ground on and off to the the sop8 clip? I feel like relays might be overkill. I have optocoupler laying around so they would work but doesn't really seem like the right tool for the job. so transistors?  I am a total noob when it comes to making stuff... I just fix broken stuff haha. I am probably over thinking this.
 

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #8 on: March 07, 2020, 04:43:44 pm »
Thanks.
PN2222 do the job just fine? that is what I normally use when I am playing with my arduino
...Edit never mind checked the data sheet that is a NPN not PNP
« Last Edit: March 07, 2020, 04:47:54 pm by Fixed_Until_Broken »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: Noob question isolating homemade programmer
« Reply #9 on: March 07, 2020, 05:13:09 pm »
Data lines should be protected with Schottky diode clamps between target Vcc and ground, and 50mA polyfuses between the clamps and the target.  Output lines from the Arduino should be buffered with line drivers capable of more current than the 50mA polyfuse rating.  Input lines should have 1K series resistors to ensure that the Arduino's MCU's internal ESD clamping diodes don't pass significant current during any event that causes the clamp diodes to pass current.

You probably don't need to switch the ground.  You can switch target power (Vcc) by using a low Vgs threshold* P-MOSFET driven by an Arduino pin, but protecting it is harder.  Use a beefy MOSFET and a polyfuse of no more than 5% of the MOSFET's current rating and it will probably survive being shorted.

You *NEED* the ADuM3160 USB isolator that Nominal Animal suggested so any mistake or idiocy# that takes out the Arduino doesn't damage the PC.

* a MOSFET with a gate threshold voltage in the 1V to 2.5V range is suitable for direct drive from a 5V logic signal.

# e.g. trying to use it on a cluster that's still connected to the car battery!
« Last Edit: March 07, 2020, 06:15:56 pm by Ian.M »
 
The following users thanked this post: Fixed_Until_Broken

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #10 on: March 07, 2020, 05:43:20 pm »
Makes sense on the USB Isolation will be updating the design to include that. What rating should I be looking at for the diodes?

None of this for while it is connected to a car battery its all done on a work bench with a dc power supply.(dc power supply is off while programming but I want to to be able to leave it plugged in while test boot some of the eeproms I am still working out different parts of the bins on them so I make lots of changes) I just want to put some protection into the design in case someone else tries to make this and does something stupid I dont want them to damage their computer, Arduino or instrument cluster.
« Last Edit: March 07, 2020, 05:46:19 pm by Fixed_Until_Broken »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: Noob question isolating homemade programmer
« Reply #11 on: March 07, 2020, 06:42:07 pm »
The clamping diodes are a compromise - too high a current rating means a large junction area and too much capacitance for fast data signals.   Therefore, worst case, if the user connects one of the data lines to +14V from the bench PSU, the clamping diode may not survive, but as long as the energy the polyfuse lets through isn't enough to blow the failed diode open, there should be no damage other than to the diode.  I'd start by looking at BAT54S series Schottky diode pairs, which can withstand 600mA non repetitive peak If for no more than 10ms and see if that's enough for a reliable trip of a 50mA polyfuse.  If not, that should at least give you some idea how beefy a diode you actually need.

The line drivers should be powered from the switched supply at the drain of the P-MOSFET, and that supply should be protected against overvoltage by a crowbar circuit with a 5.5V trip point that turns off the P-MOSFET and grounds the switched supply via a beefy N-MOSFET, leaving the polyfuses in the switched Vcc lines and the data lines to hopefully isolate them before damage occurs to the programmer or the target.

If your programmer had a higher voltage power source than the 5V USB Vbus supply, you'd have better options as the switched Vcc supply could come from a LDO with a current limit, an external Adj pin and an enable pin, eliminating the need for a P-MOSFET and permitting target power to be current limited at source, and allowing a Schottky diode to protect it against being back-fed from a powered target without excessive voltage drop.  You'd still need the crowbar circuit and polyfuses to provide protection against misconnection to a powered target.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9964
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #12 on: March 07, 2020, 07:13:38 pm »
How about jumper headers on the various pins?  If you have to modify the PCB, jumpers take less design effort than MOSFETs and such.  It probably isn't sufficient to just isolate the power and ground, I would expect that the signals need to be isolated as well.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: Noob question isolating homemade programmer
« Reply #13 on: March 07, 2020, 07:33:28 pm »
Yes.  If  one needs the capability to run a powered target without disconnecting the programmer, the signal output lines will need to be isolated when not actively programming or reading the target memory.  As long as the line drivers (buffers) are powered by target Vcc, it should be sufficient to tristate their outputs.  The extra loading of input lines to the Arduino should have negligible effect on the target unless the clamping diodes have excessive junction capacitance.


I presume the O.P. wants to to avoid 'brute force'ing it with a bunch of reed relays or even a manual multipole switch!
 

Offline TomS_

  • Frequent Contributor
  • **
  • Posts: 854
  • Country: gb
Re: Noob question isolating homemade programmer
« Reply #14 on: March 07, 2020, 08:53:20 pm »
If all you're doing is powering an EEPROM device, you could potentially just use tri-state buffers, something like a 74HCT245 which operates from 5V and so will output 5V, but who's inputs will work down to 3V3. The buffer should be able to supply enough power for an EEPROM, and also act to isolate the signals when not in use (I presume that by isolate you really mean to have your programmer go HiZ).

But I suspect any EEPROM that is on a board is going to share a power rail with much more, and that all may exceed the current supply ability of the buffer.

So perhaps as people have suggested, a P type transistor of sorts to supply power, and then you could use a tri-state buffer to isolate all of the signal lines when you don't want to be talking to the EEPROM.
« Last Edit: March 07, 2020, 08:55:42 pm by TomS_ »
 

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #15 on: March 07, 2020, 08:57:11 pm »
LOL you are correct in that assumption Ian.m My first thought about this a couple days ago was to throw some little dip switches on but then thought no that is lame especially when the arduino has plenty of pins to drive something. Plus now I get learn something new! 
 

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #16 on: March 07, 2020, 11:37:39 pm »
I think I got the resistors right. I put a 10 ohm at collector so that way it shouldn't be able pull enough current to damage the transistor. Is the attached picture how you would do it? I don't have the parts yet to test it on the bread board.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17428
  • Country: us
  • DavidH
Re: Noob question isolating homemade programmer
« Reply #17 on: March 08, 2020, 05:51:41 pm »
You probably don't need to switch the ground.  You can switch target power (Vcc) by using a low Vgs threshold* P-MOSFET driven by an Arduino pin, but protecting it is harder.  Use a beefy MOSFET and a polyfuse of no more than 5% of the MOSFET's current rating and it will probably survive being shorted.

That will not prevent a short if the IC clip is rotated 180 degrees allowing the body diode to conduct; isolation on power and signal pins must work with both positive and negative voltages.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: Noob question isolating homemade programmer
« Reply #18 on: March 08, 2020, 06:55:45 pm »
Yes.  That's why I was advocating 50mA polyfuses in all signal lines, with Schottky clamps on the programmer side and another appropriately rated polyfuse in the Vcc line.

You CAN'T prevent idiocy, and when you attempt to prevent the resulting damage, the world invariably comes up with a better idiot, that does something so stupid no-one anticipated it.  The best one can hope for is to prevent damage as often as reasonably practical, and when you can't, limit the cost of the damage.
« Last Edit: March 08, 2020, 06:58:26 pm by Ian.M »
 

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #19 on: March 08, 2020, 11:25:39 pm »
Gotta love amazon free next day I got the transistors in I am going to play with them and do some testing. I still haven't ordered the diodes yet because not really sure what a good value to start at would be.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17428
  • Country: us
  • DavidH
Re: Noob question isolating homemade programmer
« Reply #20 on: March 09, 2020, 02:35:38 am »
Yes.  That's why I was advocating 50mA polyfuses in all signal lines, with Schottky clamps on the programmer side and another appropriately rated polyfuse in the Vcc line.

You CAN'T prevent idiocy, and when you attempt to prevent the resulting damage, the world invariably comes up with a better idiot, that does something so stupid no-one anticipated it.  The best one can hope for is to prevent damage as often as reasonably practical, and when you can't, limit the cost of the damage.

I would not trust polyfuses to protect from catastrophic damage because they are so slow.  On the other hand, I did not recommend anything better because protection circuits quickly get complicated to protect against reverse voltage which is a definite possibility in this case.

Something like a ATE (automatic test equipment) pin driver with programmed current and voltage limits would be suitable for the I/O and power pins, but such circuits are not trivial.  Slow ones look like linear class-AB buffers with current limits and some operational amplifiers are suitable but fast ones could use diode bridges as bidirectional current limiters.  Their design is a fascinating problem.
« Last Edit: March 09, 2020, 02:46:57 am by David Hess »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: Noob question isolating homemade programmer
« Reply #21 on: March 09, 2020, 03:49:51 am »
I would not trust polyfuses to protect from catastrophic damage because they are so slow.  On the other hand, I did not recommend anything better because protection circuits quickly get complicated to protect against reverse voltage which is a definite possibility in this case.
Yes, with polyfuses, there's a high risk of blown buffers and shorted clamping diodes.  but both the programmer and the target should be repairable - i.e. no traces burnt off the board, and with luck, if the clamping diodes did their job long enough, and the idiocy didn't stuff -5V from the reversed Vcc onto a target signal line the target MCU and memory chip have a fair chance to survive.

Quote
Something like a ATE (automatic test equipment) pin driver with programmed current and voltage limits would be suitable for the I/O and power pins, but such circuits are not trivial.  Slow ones look like linear class-AB buffers with current limits and some operational amplifiers are suitable but fast ones could use diode bridges as bidirectional current limiters.  Their design is a fascinating problem.
Its hard to justify spending big $$$ on protecting a $3 USD Arduino clone . . .
 

Offline Fixed_Until_BrokenTopic starter

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: Noob question isolating homemade programmer
« Reply #22 on: March 09, 2020, 03:55:27 am »
Ok well I got the transistors on and updated the sketch and it works. I decided do one on ground also just because after a test of powering the target board with the clip on, the arduino turned on or off the target couldn't read its own eeprom. Chip select/Slave select is the issue if I take the wire off the chip select pin the target can then read its own eeprom. I didn't thing this would be an issue. shouldn't the arduino not be able to pull CS high or low if ground and VCC are not hooked in.

Just to be clear its still an issue even though I did both VCC and ground
« Last Edit: March 09, 2020, 03:59:38 am by Fixed_Until_Broken »
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 7195
  • Country: fi
    • My home page and email address
Re: Noob question isolating homemade programmer
« Reply #23 on: March 09, 2020, 04:00:28 am »
I really like the idea of using an NPDT switch (a rotary switch maybe, or a set of small signal relays?), with the "OFF" position having a big resistor for each target chip pin to local ground, say 1MOhm or so each; and maybe opamps for VCC and GND pins on the target chip, with each pin having a diode and a resistor to VCC and another pair to GND, to detect if the target chip is already powered.

The resistors would dissipate any charges or current already flowing to the chip.  The opamps would be used to detect if the target chip is already powered; the unusual resistors with the diodes would limit the current in that case, and the diodes would clamp the voltages to the rails so nothing should really break.  (I would only do the opamps if the programming clamp is used in circuit; I wouldn't bother if a socket is used, where the solitary chip is dropped into for programming.)

Based on how I have blown up ICs before, I believe the resistors alone would cover the majority of my goofs, and the opamps would catch almost all the rest if there is a possibility of a capacitor or battery powering the chip (without me realising it) when the programmer is connected.  Yes, I would still blow up one every now and then by accident, but I don't see the need for trying to idiot-proof any further than that.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: Noob question isolating homemade programmer
« Reply #24 on: March 09, 2020, 04:09:26 am »
Ok well I got the transistors on and updated the sketch and it works. I decided do one on ground also just because after a test of powering the target board with the clip on, the arduino turned on or off the target couldn't read its own eeprom. Chip select/Slave select is the issue if I take the wire off the chip select pin the target can then read its own eeprom. I didn't thing this would be an issue. shouldn't the arduino not be able to pull CS high or low if ground and VCC are not hooked in.

Just to be clear its still an issue even though I did both VCC and ground
There's all sorts of sneak paths that could provide a ground return between the target and the Arduino.  Adding a USB isolator will eliminate some of the possibilities, but the SPI signal lines can still be a major issue.  See https://www.eevblog.com/2015/12/18/eevblog-831-power-a-micro-with-no-power-pin/ for an idea of what you are up against.

Try leaving ground  and the SPI signals connected, and the Arduino powered but hold the Arduino in reset by grounding its RESET pin.  That should keep its I/O pins tristated so it doesn't affect the target SPI signals.  If that works, modify your sketch to set all the SPI lines as inputs when it disconnects from the target.  The Arduino will need to remain powered.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf