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

Thread: Issue programming a virgin MK20DX256VLH on custom T3.2

Hybrid View

  1. #1
    Senior Member
    Join Date
    Jun 2013
    Posts
    379

    Issue programming a virgin MK20DX256VLH on custom T3.2

    My custom T3.2 device is unable to boot / get programmed using a virgin MK20DX256VLH. If I swap out the MK20 for a preprogramed one, then there are no issues. The device boots perfectly fine, and the program button works as expected.

    Here are some observations I've made when a virgin MK20DX256VLH is installed:
    1. The PROGRAM line show 3.2V and drops 11mV while the program button is pressed.
    2. The RESET line is showing 3.2V and drops to about 1.5 mV while the program button is pressed.
    1. The crystal isn't oscillating.
    2. The current consumption is only 10 mA (probably from the active components on the board)
    3. While the program button is pressed, the current goes up to 13 mA.
    4. When the program button is released, the current briefly goes up to about 16 mA and then falls back down to 10 mA

    Any suggestions as to what the cause of this problem might be?
    Last edited by yeahtuna; 03-05-2021 at 06:21 AM.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,111
    Well, that's quite a mystery. Every Teensy 3.2 is built with a virgin MK20 chip and works fine.

    Is there any chance this might have been just a soldering issue with 1 chip? Do you have more than 1 board doing this with virgin chips?

  3. #3
    Senior Member
    Join Date
    Jun 2013
    Posts
    379
    Quote Originally Posted by PaulStoffregen View Post
    Well, that's quite a mystery. Every Teensy 3.2 is built with a virgin MK20 chip and works fine.

    Is there any chance this might have been just a soldering issue with 1 chip? Do you have more than 1 board doing this with virgin chips?
    I'm very certain it's not a soldering issue. I have multiple boards and several virgin chips.

    I took the bootloader out of the board, and I'm still getting 3.2 volts on the RESET line. The MCU is not happy and I can't figure out why.
    Last edited by yeahtuna; 03-05-2021 at 09:09 AM.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,111
    Quote Originally Posted by yeahtuna View Post
    I took the bootloader out of the board, and I'm still getting 3.2 volts on the RESET line. The MCU is not happy and I can't figure out why.
    That's even more mysterious! A virgin MK20 chip is supposed to be pulsing its reset line low, as it will be repeatedly watchdog rebooting. Normally a DC voltmeter will read about 0.2 to 0.3 volts, because it goes high for only a short time before the watchdog reboots the chip again.

  5. #5
    Senior Member
    Join Date
    Jun 2013
    Posts
    379
    I guess I'll make another prototype with the just the essentials to get that watchdog firing. Thanks Paul.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,111
    Is there any chance these chips might have been pre-programmed with someone else's firmware?

    Even if they're not blank, even if security is locked, the bootloader should still manage to erase and use the chip. The only thing the bootloader can't do (nobody can) is deal with a chip that has the mass erase disabled and security is locked. If the chips were previously programmed with that setting, they're forever locked with whatever was written.

  7. #7
    Senior Member
    Join Date
    Jun 2013
    Posts
    379
    I just put together a minimal build of the prototype and the MK20 is acting as expected. I'll slowly build it up and keep testing.

  8. #8
    Senior Member
    Join Date
    Jun 2013
    Posts
    379
    Hopefully someone can explain this one. It looks like if pin 26 on a virgin MK20DX256VLH is connected to ground (in my case through a 10K resistor), the RESET line gets held at 3.2V and it can't be programmed. WTF.
    Last edited by yeahtuna; 03-05-2021 at 03:05 PM.

  9. #9
    Senior Member
    Join Date
    Jun 2013
    Posts
    379
    And I have a workaround, albeit not pretty. If I also connect pin 26 to VCC through a 3K resistor, it can be programmed again. Will have to design a jig of sorts... WTF.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,111
    Ah, the NMI pin strikes again.

    This is actually mentioned in the Troubleshooting section on the MKL02 page.

    Pin 33 PTA4 (pin 26 of the MK20 chip) must be floating or high during the first programming of the MK20 chip. This pin defaults to NMI (Non-Maskable Interrupt) when the MK20 chip is completely blank. NMI interferes with almost everything! The bootloader will disable this feature, but for the first programming of a blank MK20 chip it is enabled. PTA4 must not be pulled low until after at least 1 successful code upload.

  11. #11
    Senior Member
    Join Date
    Jun 2013
    Posts
    379
    Virgin programming adapter. Sits on top of the MK20.
    Click image for larger version. 

Name:	20210306_121128.jpg 
Views:	8 
Size:	190.5 KB 
ID:	23935

Posting Permissions

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