Author Topic: Disable programming lines  (Read 3587 times)

0 Members and 2 Guests are viewing this topic.

Offline vini_iTopic starter

  • Regular Contributor
  • *
  • Posts: 83
Disable programming lines
« on: December 26, 2017, 08:44:32 pm »
I'm designing a microcontroller based project. (PIC16F) The project will be battery powered and have a micro USB port for charging only. With an eye for production and testing, I had the idea that I could extend the D+, D- and ID pin to icspdat, icspclk, and Vpp, making a custom board to do so interfacing with a PicKit or whatever. This would allow me to program and test the device while it is completely closed.

After the product is tested and ready to ship I would like to disable the programming lines.

Is there a novel way to disable the programming lines?

The best I could come up with is having some type of fuses in the two programming lines and zeners to ground downstream of them. Then using a constant current source to drive enough current into the pins and through the zeners to pop the fuses.
 

Offline bkucenski

  • Contributor
  • Posts: 11
  • Country: us
Re: Disable programming lines
« Reply #1 on: December 27, 2017, 01:07:53 am »
https://books.google.com/books?id=CB9GaAU1dwsC&pg=PA755&lpg=PA755&dq=eeprom+disable+write&source=bl&ots=Hib9A0ty8c&sig=v_qQ89AK8Db-327-dIbOHkhzq5Q&hl=en&sa=X&ved=0ahUKEwj35eGh_6jYAhXljlQKHbEEBPcQ6AEIajAI#v=onepage&q=eeprom%20disable%20write&f=false

That's something that's done in the micro-controller to prevent program data from getting in or out of it.  You'd have to check with the datasheet for your specific controller.

Any sort of shenanigans done outside of the micro-controller could be easily defeated.  The end user could simply replace the fuses or just run a wire around them.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12498
  • Country: us
    • Personal site
Re: Disable programming lines
« Reply #2 on: December 27, 2017, 01:10:14 am »
The question is more about disconnecting USB pins, so they don't interact in a bad way with the real USB hosts, not actually enforcing the access.

I'm not sure if there is an easy way to do this, most likely it will not be worth it in the end.
Alex
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17832
  • Country: fr
Re: Disable programming lines
« Reply #3 on: December 27, 2017, 01:57:18 am »
It would probably be much less hassle in the end not to connect the USB data lines at all and program your PIC with some internal small connector on your board.

As you can see here: http://www.littelfuse.com/products/fuses/surface-mount-fuses/nano-2-fuses.aspx , very small smd fuses like this, even for the lowest current model, would still need a pretty high current to blow up. Your diodes would have to be able to withstand this current and still be small enough (assuming this is a small device)... you may not find any that fit. Maybe with the smallest fuse in the 448 Series (62 mA).
 

Offline bkucenski

  • Contributor
  • Posts: 11
  • Country: us
Re: Disable programming lines
« Reply #4 on: December 27, 2017, 02:09:41 am »
If all you want is to connect and disconnect the data lines for the USB, you may be able to work a 4 small holes into your product casing that you can slip jumper wires into to complete the path between contact pads.
 

Offline Nusa

  • Super Contributor
  • ***
  • Posts: 2452
  • Country: us
Re: Disable programming lines
« Reply #5 on: December 27, 2017, 02:34:42 am »
How about a normally-open magnetic reed switch? They can be had in ultra-minature sizes.

Programming would only be possible if you place a magnet in the proper spot outside the case.
 

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2867
  • Country: us
Re: Disable programming lines
« Reply #6 on: December 27, 2017, 05:03:50 am »
If this is only for development, then use a couple of series resistors, and either remove them or don't fit them on the production articles.  Or bring out a UART and use a bootloader.  Optionally send a command to disable the bootloader after production testing.  High impedance or softly pulled down IOs shouldn't cause any issues on the USB side.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 3302
  • Country: us
Re: Disable programming lines
« Reply #7 on: December 27, 2017, 12:53:18 pm »
Maybe do something in software. Like disable the USB interface after the unit has been powered up 10 times. Of course you would need to protect the program space from being read.

Or just initially enable the test mode until you send a disable command on the USB interface that can not be re-enabled.
 

Offline vini_iTopic starter

  • Regular Contributor
  • *
  • Posts: 83
Re: Disable programming lines
« Reply #8 on: December 27, 2017, 01:01:47 pm »
Disabling the programming lines is not meant to be any kind of tamper resistance. This is just to prevent any accidental or unintended interactions.

I had another idea. A set of diodes from the programming lines to the reset line. The reset lines should never be pulled low. It is either held high or taken to 12v to enable programming. This way the diodes will always be reverse biased. Then, when you're ready to blow the fuses pull the reset line low and supply power to the programming lines. This way the diode only sees forward current and its power dissipation is very low.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12498
  • Country: us
    • Personal site
Re: Disable programming lines
« Reply #9 on: December 27, 2017, 05:23:58 pm »
I had another idea. A set of diodes from the programming lines to the reset line.
Can you draw a schematic?
Alex
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11727
  • Country: my
  • reassessing directives...
Re: Disable programming lines
« Reply #10 on: December 27, 2017, 07:20:41 pm »
Is there a novel way to disable the programming lines?
ooh there are many novel ways a single page wont fit, its just the question of are they economical or not compared to what is already practices (not novel as bkucenski has suggested in reply #4), or the question of are you going to accept it or not? which 99.999% of the suggestions will be pointless anyway. one of the (worst) novel idea is using 40A SSRs 2" wide and length dimension along the lines.

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4108
  • Country: us
Re: Disable programming lines
« Reply #11 on: December 27, 2017, 11:43:46 pm »
Instead of disabling them after you are done, perhaps you could enable those lines when you want to use them. By detecting the presence of high/programming voltage (say >10V) on one of those lines, the other two lines are temporarily closed. A zener and a cap and a couple of solid state relays.

The SSR's are the expensive part. Maybe the clock and/or data line can be switched in/out with just a transistor, unidirectionally, if you do some research on USB, and depending on if your device uses those pins for anything else.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14135
Re: Disable programming lines
« Reply #12 on: December 27, 2017, 11:57:24 pm »
If your PIC16 supports high voltage programming, and you disable LVP in its CONFIG and set the ICSP pins as inputs and don't otherwise use them, they'll be inactive anyway unless VPP is applied. No USB host or device will ever apply more than 5.5V to those pins.  Disabling them totally is pointless as no PIC16 is sufficiently secure for any application that absolutely must be tamper-proof.
« Last Edit: December 27, 2017, 11:59:41 pm by Ian.M »
 

Offline Leo Bodnar

  • Frequent Contributor
  • **
  • Posts: 849
  • Country: gb
Re: Disable programming lines
« Reply #13 on: December 28, 2017, 12:03:59 am »
Why not use one of gazzilions of "secure" bootloaders? 

Sooner or later you will find yourslef trying to hack into your own device to fix a bug, make a custom mod or perform failure analysis and cursing yourself for locking yourself out.

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2867
  • Country: us
Re: Disable programming lines
« Reply #14 on: December 28, 2017, 02:34:13 am »
Disabling the programming lines is not meant to be any kind of tamper resistance. This is just to prevent any accidental or unintended interactions.

High impedance IO lines or weak pulldowns won't cause any improper interactions with USB ports as long as your MCU ignores them.  A USB device signals its attachment (and speed) to a host by pulling either D+ or D- to 3.3V.  So just don't pull either one high and a host port won't even notice it's connected.  You might want to read the voltage on those lines to detect a charging port, but otherwise just have the MCU ignore them entirely.  Using high voltage programming is a good idea, otherwise use a UART and a bootloader that waits for a particular activation sequence or something.
 

Offline bson

  • Supporter
  • ****
  • Posts: 2821
  • Country: us
Re: Disable programming lines
« Reply #15 on: December 28, 2017, 04:47:59 am »
I'd use something other than the USB connector to program it, basically equip your special programming board with pogo pins instead, or use an existing connector like TagConnect's legless TC-2030-NL.  It basically does that plus has three guide pins.  Then leave the USB connector solely to charging.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->