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

Thread: Custom Teensy 3.1 Board - Will not load a program

  1. #1
    Junior Member
    Join Date
    Feb 2015
    Posts
    7

    Custom Teensy 3.1 Board - Will not load a program

    I have a custom board using a teensy 3.1 as the micro. I have read the previous posts (from the Mini54 page) on the forum about custom boards and those issues are not the same as mine. I have also added the schematic.
    *Please note that the USB D+ and D- lines in the schematic are reversed, however this has been corrected on the board.

    Issue / Symptoms:
    When I plug the board into the USB port I do not get a response from the system. When I press the load button the computer gives the sound as if a USB device has been plugged in and the Teensy.exe software recognizes that I have connected a board and shows that the *.cpp file has loaded. The board however does not show up as a serial port and the program does not get loaded on the micro (It is a simple "blink" on pin 13 program and the output does not turn on).

    Troubleshooting done so far:
    1.) Added a capacitor to the 3.3VDC bus to stabilize the voltage level (this was a suggestion from a previous post).
    2.) Tested the Reset pins on the Mini54 and the MK20
    a.) When the USB is first plugged in Reset pin is high
    b.) When the load button is pressed the Reset pin pulls the pin low
    c.) When the load button is released the reset pin goes high again and stays that way
    3.) Clock Signal
    a.) When the USB power is applied there is no clock signal (which is to be expected)
    b.) When I press and release the program button a clock signal appears for a few moments
    c.) After the teensy.exe says the program has loaded the clock signal goes away
    4.) I have tried the program i am working with to load on a stock teensy and it works just fine.

    Any advice would be greatly appreciated.
    Attached Files Attached Files

  2. #2
    Senior Member pictographer's Avatar
    Join Date
    May 2013
    Location
    San Jose, CA
    Posts
    548
    Can you divide your circuit between the teensy-like portion and the other stuff with the opamps? If so, you could narrow the location of the bug down by divide-and-conquere. Does your teensy-like portion of the circuit work without the other stuff attached to it? Does the other stuff work when driven by a stock Teensy?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    13,800
    Quote Originally Posted by ambZE View Post
    Issue / Symptoms:
    When I plug the board into the USB port I do not get a response from the system. When I press the load button the computer gives the sound as if a USB device has been plugged in and the Teensy.exe software recognizes that I have connected a board and shows that the *.cpp file has loaded.
    At least this part is perfectly normal. A totally blank MK20 won't do anything, and then when you press the button, the Mini54 takes control and it appears as a HID device with ID 16C0:0478. That's good.

    I don't know why the MK20 isn't running your code.

    Perhaps a next step might involve some hacking in mk20dx128.c, to see if you can get any signs of life from the MK20 chip. For example, at the beginning of the reset code is a hook that disables the watchdog. Maybe add a "while (1) ;" right after that, so it'll sit in an infinite loop doing nothing. Then try with and without the watchdog. When the watchdog is disabled, the while (1) loop should run forever and the chip will do nothing. When you remove the watchdog disable code, the chip should repeatedly reboot. You can observe the rebooting on the reset line, since the MK20 pulls the reset line low as it reboots. This is easiest to see with an oscilloscope or logic analyzer, since it happens over and over pretty rapidly.

    Bringing up brand new hardware can be tricky. There's really not much more I can do to help. This gets pretty far outside the realm of support PJRC can reasonably provide.

    But if you do figure out what went wrong, please post a followup with details. You can see the Mini54 page already has links to a couple good followups others have posted. A good followup, together with these messages about how the problem looked before it was understood, can really help others in the future.

  4. #4
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    Paul and Pictographer,

    Thank you for your quick replies.

    -----------------------------------------------------------------------------------------------------------------------------------------------------

    Pictographer, we initially prototyped this with a factory 3.1, everything ran great. We stress tested it and it ran great. Unfortunately this is all on a surface mount PCB and I cannot remove the other portions without destroying it. The portion of the circuit that does not pertain to the teensy is not currently powered during this initial bootup and test.

    ------------------------------------------------------------------------------------------------------------------------------

    Paul, I understand this this is outside of the scope of the standard PJRC service / support, and I appreciate your time to looking at it.

    As far as the "HID device with ID 16C0:0478." goes, I am not seeing this device when I connect our board, if you look at the screen cap below this is our device manager with the custom board it does not show the HID device you have described:
    Click image for larger version. 

Name:	custom teensy attached.jpg 
Views:	229 
Size:	111.0 KB 
ID:	3449

    When a factory teensy is attached I get the following device tree, which does show the teensy serial port under the COM ports:
    Click image for larger version. 

Name:	factory Teensy attached.jpg 
Views:	192 
Size:	111.3 KB 
ID:	3450

    Any idea here?

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    13,800
    Teensy Loader only responds to HID 16C0:0478. If you're seeing Teensy Loader recognize it, then it must be appearing with that ID.

    If Teensy Loader is in auto mode, which is the default when Arduino give it a new file, it'll immediately reboot after programming, so Teensy only appears to your PC with that ID for a brief time during the upload process.

    When a factory teensy is attached I get the following device tree, which does show the teensy serial port under the COM ports:
    This page explains the native USB and COM port issues. Scroll down to "No Serial Port While Programming".

    http://www.pjrc.com/teensy/troubleshoot.html

    The key point is Teensy only becomes a COM port because the code you programmed onto the MK20 implements USB serial.

  6. #6
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    Thanks Paul, I will look into this some more and see what I can find.

  7. #7
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    Does anyone have a schematic using the Mini54LAN as a TQFP package that works? I would love to be able to reference another schematic to ours to make sure I didn't mess a connection up.

  8. #8
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    We found our error: We did not have 3.3VDC to the VBatt connection. With the 3.3VDC added to this pin we are now running a "blink" program successfully.

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    13,800
    Good to know what actually happens with VBAT is unconnected.

    Can you confirm the Teensy Loader did find your hardware and appeared to program your code, but then it simply didn't run when VBAT was unconnected? Knowing what symptoms really appear can help anyone else who hits this same issue.

  10. #10
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    Hi Paul,

    Yes, that is exactly what happened. It actually did program the micro, as soon as I applied 3.3 vdc to vbat the program started running that was already installed.

    So it appears that not having that pin connected just does not allow the program to run.

    Thanks!

    Adam

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    13,800
    Thanks for the followup. I've added a link to the Mini54 page.

    Hopefully this will save anyone else from hitting this pitfall, or at least help them find it more easily if they do.

  12. #12
    Senior Member
    Join Date
    Dec 2013
    Location
    Brasilia, Brazil
    Posts
    160
    I thought that this might be related to the core startup code and, actually, I found something about this in the K20 Reference manual:

    Chapter 40.3.1:
    Any attempt to access an RTC register, except the access control registers, when VBAT is powered down, when the RTC is electrically isolated, or when VBAT POR is asserted, will result in a bus error.
    So, if VBAT is unconnected, you should be able to make it work by commenting out the RTC_xxxx related code in the core library (mk20dx128.c).

  13. #13
    Senior Member
    Join Date
    Dec 2014
    Posts
    267
    Excellent work.

    We will be attempting to roll our own Teensy based boards in the future and posts like this will prove valuable I'm sure.

    Thanks.

  14. #14
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    Quote Originally Posted by jbliesener View Post
    I thought that this might be related to the core startup code and, actually, I found something about this in the K20 Reference manual:



    So, if VBAT is unconnected, you should be able to make it work by commenting out the RTC_xxxx related code in the core library (mk20dx128.c).
    Awesome find. Thank you.

  15. #15
    Member
    Join Date
    Feb 2015
    Location
    Hamburg, Germany
    Posts
    25
    I have made my own experiances with a custom Teensy board. I messed up the first revision. This forum has been very helpful and I thought to give something back. I have written a rather lengthy blog post that summerizes everything I have found in these forums, part numbers I have been using successfully, PCB layouts, etc. If you are interested in building your own Teensy board I think my blog post will help you with that.

    http://www.appfruits.com/2015/03/bui...custom-teensy/

    Have fun and good Luck,
    Phillip

  16. #16
    I unfortunately did not find this thread before I too built boards without a VBAT connection.

    My results are essentially identical: lots of USB beeps and no running code until I comment out lines 634-->640 and lines 875-->905 in mk20dx128.c @ Arduino\hardware\teensy\avr\cores\teensy3

  17. #17
    Junior Member
    Join Date
    Mar 2016
    Posts
    9
    Is there a way to do this for the Teensy 3.6?

  18. #18
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    13,800
    The RTC hardware is exactly the same on Teensy 3.6, so you'd make exactly the same edit to mk20dx128.c. Just delete all the RTC initialization stuff.

    Or you could fix your board to connect 3.3V power to VBAT.

Posting Permissions

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