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

Thread: Hosed Teensy 2.0 Bootloader (?)

  1. #1
    Junior Member
    Join Date
    Oct 2017
    Posts
    7

    Hosed Teensy 2.0 Bootloader (?)

    After many days of successful uploading, I tried implementing some code with Timer Interrupts. Once uploaded, I can no longer access the Teensy with any other upload.

    I'm pretty sure at this point, the code has "stepped on" something. Is there a preferred link to where I could get the HalfKay HEX files for the Teensy 2.0?

    Alternately, how would the Teensy know it was hit with a Leonardo Bootloader? I realize it wont' Teensy any more but it should still work with Arduino.

  2. #2
    Senior Member manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,265

  3. #3
    Junior Member
    Join Date
    Oct 2017
    Posts
    7
    Quote Originally Posted by manitou View Post

    Did you miss the sentence where I said I had used this NUMEROUS times? The troubleshooting is obviously where I looked first, but no matter WHAT i do, nothing from this Teensy. I also have a new one that works just fine.

    I don't WANT to use the new one until I understand why this one broke! I want to try reflashing the bootloader in the broken board.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    5,181
    Quote Originally Posted by rmetzner49 View Post
    Did you miss the sentence where I said I had used this NUMEROUS times? ...
    Yes, probably as 'NUMEROUS times' is not even now in the OP?

    I've never touched a Teensy 2 - but given the probably different hardware layout and specs - I'd assume a bootloader other than the PJRC one if there could be confused at best.

  5. #5
    Junior Member
    Join Date
    Oct 2017
    Posts
    7
    Quote Originally Posted by defragster View Post
    Yes, probably as 'NUMEROUS times' is not even now in the OP?

    I've never touched a Teensy 2 - but given the probably different hardware layout and specs - I'd assume a bootloader other than the PJRC one if there could be confused at best.
    So now this is a course in semantics? If I didn't say "numerous", I did say "for several days". Really, if this is the only contribution you can make to my question, please don't reply AT ALL. I asked nicely for a place to find the HalfKay Bootloader.

    As for your experience with the 2.0, there is no "probably different" in the design and hardware between the 2.0 and the Leonardo or the Pro Micro. All three have the 32U4 Atmel Chip. I was hoping for a reply from Paul or someone who doesn't give semantics lessons, confirming my beliefs or a link for the Hex files. At no point did I ask for a snarky response.

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    5,181
    ... about facts in evidence and manners not semantics. However on semantics it says "After many days of successful uploading" - not what was done after that failed - thus the reasonable question in post 2.

    There is a big difference between the ARM Teensy 3's with an offchip bootloader that is impervious - that represents the larger user base here these days.

    Hopefully PJRC will see your question - the answer I saw on a web search was the bootloader wasn't published as it represent proprietary code.

  7. #7
    Junior Member
    Join Date
    Oct 2017
    Posts
    7
    Quote Originally Posted by defragster View Post
    ... about facts in evidence and manners not semantics. However on semantics it says "After many days of successful uploading" - not what was done after that failed - thus the reasonable question in post 2.

    There is a big difference between the ARM Teensy 3's with an offchip bootloader that is impervious - that represents the larger user base here these days.

    Hopefully PJRC will see your question - the answer I saw on a web search was the bootloader wasn't published as it represent proprietary code.
    "After many days of successful uploading, I tried implementing some code with Timer Interrupts. Once uploaded, I can no longer access the Teensy with any other upload".

    Seems clear enough to me. As I said, you obviously have no technical merit in your replies, therefore please just stay away.

  8. #8
    Junior Member
    Join Date
    Oct 2017
    Posts
    7
    Notice my request for the link was for HEX files, NOT SOURCE CODE.

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    5,181
    Indeed, in referring to text repeated in post 7 - no notes on what was tried after the failure presented itself, thus post #2.

  10. #10
    Junior Member
    Join Date
    Oct 2017
    Posts
    7
    Like a small child, you always need to get the last word in. I asked you to please go away. This is the last time I will ask nicely. I'm finished responding to you.

  11. #11
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    5,181
    Also just found this I assume to be true - a HEX file can be decompiled to ASSEMBLER or better:

    https://stackoverflow.com/questions/...-c-for-arduino

    ... It coverts the .hex back to assembler. You might need to know the architecture of the original AVR it was intended for. Works well for me for code that I wrote and compiled.

  12. #12
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    5,181
    This normally doesn't happen on Teensy's:

    this might be helpful:

    Quote Originally Posted by PaulStoffregen View Post
    Any chance you could post a photo?
    Quote Originally Posted by Robin View Post
    Some more information on counterfeits can be found here http://www.pjrc.com/teensy/counterfeit.html
    ...
    Quote Originally Posted by GremlinWrangler View Post
    Re checking if this is a counterfeit with matched hardware but some hombrew bootloader, first step is check the photo here
    https://www.pjrc.com/store/teensy.html
    The mystery ones vary but check for gold plated through holes, the button and the silkscreen, especially the ones on angles (where knock offs often have right angles only).
    And possibly post a photo of what you have

  13. #13
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,153
    Obviously, the OP did not understand how things work here:
    1. This is basically a “users help users” forum, although Paul jumps in from time to time.
    2. If someone is new here and needs help, they should respect the forum rules and post as much detailed information as possible to reproduce the problem (code, pictures, schematics, etc.), so that others might reproduce the problem.
    3. Newbies are expected to be humble and polite to motivate the (unpaid) volunteers to invest their free time to help.
    4. Newbies aren’t expected to have an aggressive tone and to miss respect towards other members.

    @rmetzner49, this is a yellow card for you!

  14. #14
    Senior Member
    Join Date
    Jul 2014
    Posts
    1,542
    Quote Originally Posted by Theremingenieur View Post
    @rmetzner49, this is a yellow card for you!
    Well,
    The OP has two simple and clear questions:

    - Is there a preferred link to where I could get the HalfKay HEX files for the Teensy 2.0?
    - Alternately, how would the Teensy know it was hit with a Leonardo Bootloader?

    IMO, any suggestion that do not address these questions, while done with good intention, can have the tendency to frustrate more than it is helping.

    Note also, he did NOT ask: what did I wrong? So I cannot see the need to reproduce his problems (ref: forum rule)

    Having said that, I would agree that the aggressive tone in follow-on rmetzner49 posts is not acceptable.

  15. #15
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    5,181
    Answers for 'two simple and clear questions'::
    - No { unless I'm missing something, otherwise the clones would not be failing - see p#11, #12 }
    - It would not { which I inferred as self answered given "it won't be a Teensy anymore" }

    As Paul often notes - specific questions get specific answers - that don't address the real issue, to get help - see the forum rule:

    p#2 was a reasonable question to elicit more details
    p#3 was non-responsive at best
    p#4 hoping OP re-read of p#1 or p#2 would get on positive track - and did give reference to Q#2
    ...

    +1 to Theremingenieur

  16. #16
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,266
    You can't "hose" the Teensy 2.0 halfkay bootloader by merely uploading. The chip implements a hardware-level lock which absolutely prevents any code from being about to erase or write the bootloader portion of the flash memory. Even the bootloader can't alter itself (yes, PJRC has carefully tested this). Losing the bootloader by executing uploaded code simply isn't possible, no matter what bytes you upload, no matter what code you run.

    However, you can very easily cause the USB port to do wrong things if you edit the USB code, and even crash the USB drivers in some versions of Windows. That's what the recovery process on the troubleshooting page (where you hold the button while plugging in the cable) recommends starting a cold reboot of your computer.

    Quote Originally Posted by rmetzner49 View Post
    I'm pretty sure at this point, the code has "stepped on" something.
    You're mistaken in this assumption. The hardware simply doesn't work that way. The hardware lock prevents any alteration of the bootloader. The only way to "hose" the bootloader involves connecting an AVR ISP programmer, or physical damage to the hardware.

    Of course, if you have a counterfeit Teensy, all bets are off. Most counterfeits probably are indeed quite fragile.

    After many days of successful uploading, I tried implementing some code with Timer Interrupts. Once uploaded, I can no longer access the Teensy with any other upload.
    If you'd like me to confirm, please post the HEX file you uploaded and I'll program it here to a Teensy 2.0.

    Is there a preferred link to where I could get the HalfKay HEX files for the Teensy 2.0?
    No. To directly answer your question, PJRC does not provide the bootloader HEX file. The answer is no.

    I regret that it's taken over a dozen messages to get you this simple answer, but this is a weekend, and also Christmas Eve.

  17. #17
    Junior Member
    Join Date
    Oct 2017
    Posts
    7
    Quote Originally Posted by PaulStoffregen View Post
    You can't "hose" the Teensy 2.0 halfkay bootloader by merely uploading. The chip implements a hardware-level lock which absolutely prevents any code from being about to erase or write the bootloader portion of the flash memory. Even the bootloader can't alter itself (yes, PJRC has carefully tested this). Losing the bootloader by executing uploaded code simply isn't possible, no matter what bytes you upload, no matter what code you run.

    However, you can very easily cause the USB port to do wrong things if you edit the USB code, and even crash the USB drivers in some versions of Windows. That's what the recovery process on the troubleshooting page (where you hold the button while plugging in the cable) recommends starting a cold reboot of your computer.



    You're mistaken in this assumption. The hardware simply doesn't work that way. The hardware lock prevents any alteration of the bootloader. The only way to "hose" the bootloader involves connecting an AVR ISP programmer, or physical damage to the hardware.

    Of course, if you have a counterfeit Teensy, all bets are off. Most counterfeits probably are indeed quite fragile.


    Thank you, Paul for your customary thorough and helpful response. I believe I do NOT have a counterfeit Teensy, since the layout around the crystal and pushbutton match your genuine photos. However with your answer, I now understand what may have happened.

    I *was* indeed using the AVR-ISP programmer and did so out of simplicity, although I now understand this may not have been a good idea. I'm working on a rather large project which uses an ESP32 as the main processor and the decision to use a (second) 32U4 was a trial. After reviewing the ESP32's timers, I thought they were inferior to the 32U4 for my needs. I'm trying to pull off Ultrasonic Flow Measurement where I need a 1Mhz clock to ping the sender, read the receiver, then switch the two around and repeat the readings. I decided even though the ESP32 has that second processor, it still lacks the timer set I need and the A2D isn't that great either. So I have set up Timer0 as the 1Mhz PING clock and Timer 4 as the timing clock. Cool, that all worked. When I uploaded my code with interrupts on Timer4's transitions, (AVR-ISP) is when I hosed the bootloader. I dug this Teensy out of a parts box and I now remember this is not the first time this has happened because the board has a 10K pullup on D5, so it may even have had a Leonardo bootloader in it already.

    I wasn't aware that even the HEX files are guarded, which is why I asked the question. This produced some insulting answers from two other users. The first one asked if I looked at the Troubleshooting Page and then "defragster" comes on and gives me a lesson in semantics. In hindsight, I could have played nicer but it's frustrating when the Forum Users don't even ask "what technical questions does this guy have" instead of taking apart my OP in "Law School" fashion. The only user (besides you) that understood my frustration is "WMXZ".






    If you'd like me to confirm, please post the HEX file you uploaded and I'll program it here to a Teensy 2.0.
    I appreciate the offer but I now understand the problem and how I created it.


    No. To directly answer your question, PJRC does not provide the bootloader HEX file. The answer is no.
    I realize that there are sleazeballs out there that would attempt to dissassemble your HEX file to imitate it. I assure you that was never my intent, so if your answer is a flat "NO", then I accept that and will just dump a Leonardo into it since this might not be the last time it happens.

    I regret that it's taken over a dozen messages to get you this simple answer, but this is a weekend, and also Christmas Eve.
    The only regret I have is that certain members on this forum are NOT as professional as you, and I failed to recognize you have everything from lawyers to drywall hangers on this forum. If I use this forum again, (which I doubt), I will keep that in mind. Thank you and Merry Christmas to you and Robin.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	WP_20170717_16_22_22_Pro.jpg 
Views:	19 
Size:	66.3 KB 
ID:	12368  

Posting Permissions

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