Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Is it possible to prevent accidental flashing over USB on Teensy 3.2?

  1. #1

    Is it possible to prevent accidental flashing over USB on Teensy 3.2?

    Hello,

    Is there a way to ensure a flashed Teensy 3.2 cannot be flashed anymore (by accident for instance) over a USB port when using Teensyduino? For instance if I have several Teensy connected to my computer, some already flashed some not. Of course I could remove the Teensy already flashed but as soon as the device they are meant to control is build and tested I think I could forget these devices have a Teensy inside (for some MIDI devices for instance...).

    Thank you for helping.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,506
    Possible, yes. Easy, no. Risk free... certainly not!

    In fact, Teensyduino has multiple levels of protection to prevent you from forever locking your Teensy.

    But it is possible, if you write code to directly access the flash controller. You need to fully erase the sector starting at 0x400. Then you can write anything you want. If you set the FSEC byte, you can turn on the security features and turn off mass erase. That will forever lock your Teensy to the same code. The bootloader will never again regain access to reprogram the chip.

    Teensyduino and the bootloader default the FSEC bits in such a way that you must both erase and then program to get the mass erase disabled configuration. It can't be done with only 1 step.

    FSEC is documented in the chip reference manual. So is the flash controller. No, PJRC doesn't publish any sample code to help you do this extremely risky thing. If you do write such code, I would ask, even beg of you, please don't publish such dangerous code. A few people who've tried this have indeed managed to brick their boards. I don't recommend it.

  3. #3
    Hello
    Teensy 3.2 can you duplicate without having the source?

  4. #4
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,277
    Quote Originally Posted by vlelectroniclab View Post
    Hello
    Teensy 3.2 can you duplicate without having the source?
    Theoretically yes, with lots of knowledge, experience, and equipment. Practically no, since if you had all that, you wouldn’t ask. And you shouldn’t expect help from these forums in doing this, since no one here can see if pulling the firmware from a programmed Teensy would be a violation of whomever’s intellectual property.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •