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

Thread: DIY Teensy woes

  1. #1
    Senior Member
    Join Date
    Dec 2013
    Posts
    131

    DIY Teensy woes

    Hi all,

    I received my second round of PCBs based on the teensy and audio shield schematics put together and am disappointed to say that once again I cannot get them to work. I am burning through the Mini54 chips at the moment!

    My last design appeared to work - the verbose output form the teensy loader said everything it was supposed to, but the MK20 just did nothing. I went back and greatly simplified the circuit and improved the decoupling. This time, I get nothing from either chip. While I'm not an EE, I think I understand the design principals well and am really pulling my hair out trying to sus out why they don't work.

    One slightly important change I made was I am now using this crystal:
    http://uk.farnell.com/jsp/search/pro...sp?SKU=1841946

    Would that be appropriate to use for the MK20? Should I be adding 18pF caps to it?

    I have tested all connections and have made several boards to eliminate the possibility of bad soldering.

    If anyone would be kind enough to look at my designs and offer some ideas, I would be very grateful.

    Here are the schematic and layout:

    https://drive.google.com/file/d/0BwU...ew?usp=sharing

    https://drive.google.com/file/d/0BwU...ew?usp=sharing


    Before you ask - I do already use the teensy and audio shield a LOT and this isn't just to try and make my own board for cheaper - It's my hobby and I just feel compelled to make it work because it would be awesome!

    Many thanks,

    Matt
    Last edited by mattomatto; 11-09-2014 at 04:26 PM.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,168
    Quote Originally Posted by mattomatto View Post
    One slightly important change I made was I am now using this crystal:
    http://uk.farnell.com/jsp/search/pro...sp?SKU=1841946

    Would that be appropriate to use for the MK20? Should I be adding 18pF caps to it?
    You can change the capacitance from software only, by writing a different value to OSC0_CR. Edit the code here:

    https://github.com/PaulStoffregen/co...20dx128.c#L441

    Refer to the MK20 reference manual for documentation on OSC0_CR.


    Before you ask - I do already use the teensy and audio shield a LOT and this isn't just to try and make my own board for cheaper - It's my hobby and I just feel compelled to make it work because it would be awesome!
    Either is perfectly fine. But bringing up brand new hardware can be tricky, even when based on a known-good design. Details matter and electrons can be very unforgiving.

    I can't get more involved, but at least for adjusting the capacitance, I can point you to the place to edit in the code, which ought to be easier to try stuff than having to solder lots of different capacitors.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,168
    Also, it's worth noting that the capacitance to ground needs to be approx double the crystal's rated capacitance. A crystal rated for 18 pF needs two 36 pF capacitors (from the crystal's point of view, the 2 capacitors are in series).

    However, the IC's pins have capacitance to ground of approx 7 pF, so you'd need to put about 29 pF on each pin.

    Teensy 3.1 uses an 8 pF crystal.

  4. #4
    Senior Member
    Join Date
    Dec 2013
    Posts
    131
    Thank you Paul,

    I had totally overlooked that, I will give that a go on my new boards!

    Also good to know you support people like me having a go!

    Cheers

  5. #5
    Senior Member
    Join Date
    Dec 2013
    Posts
    131
    Sadly that didn't make a difference. Strangely the Teensy still operates fine with the line:

    Code:
    OSC0_CR = OSC_SC2P | OSC_SC4P | OSC_SC8P | OSC_SC16P ;
    Unless it's not re-compiling properly.. but it's taking it's time so must be..

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,168
    I took a quick peek at the schematic. It's unreadable.

  7. #7
    Senior Member
    Join Date
    Dec 2013
    Posts
    131
    Apologies, here's a better one:

    https://drive.google.com/file/d/0BwU...g5RTh6LTg/view

    You have to click download to see it in full resolution.

    EDIT: And a better layout: https://drive.google.com/file/d/0BwU...ew?usp=sharing
    Last edited by mattomatto; 11-09-2014 at 09:03 PM.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,168
    Have to double checked all the MK20 to Mini54 connections?

  9. #9
    Senior Member
    Join Date
    Dec 2013
    Posts
    131
    Yep, checked from pin to pin with a multi-meter. all connection are good and I can't find any solder bridges / shorts

  10. #10
    Senior Member johnnyfp's Avatar
    Join Date
    Jan 2014
    Location
    New Zealand
    Posts
    260
    When you press the PROG button does the Reset line change state pin 8 (pin 3 bottom row from left)?
    If it does, do you see the Crystal oscillating, and check that there is data being sent from the Mini54 or at least that there is a clock signal on pin 3 (top row counting from left) of your programmer board.

  11. #11
    Senior Member
    Join Date
    Aug 2014
    Posts
    113
    One thing I noticed is the signal line under the 16MHz crystal. I remember reading somewhere that you shouldn't have a signal line running under it. Not sure if it's related or not.
    Last edited by EK701; 11-26-2014 at 08:09 AM.

  12. #12
    Senior Member
    Join Date
    Feb 2013
    Posts
    179
    I was curious to see if maybe the crystal I'm using might work better for you ( http://uk.farnell.com/epson/x1e00002...-pf/dp/1712841 ) but MAN are they expensive in the UK! On digikey they go for 63 cents. Almost 7 times more expensive in the UK. Sheesh.

    However, I've had good luck with them - though the discussion of the software capacitance load makes me wonder if tweaking that might solve a strange and hard-to-replicate problem my boards will sporadically present.

  13. #13
    Senior Member
    Join Date
    Dec 2013
    Posts
    131
    Thanks for the suggestions all, I will have a look at each one later this week and report back.

  14. #14
    Senior Member
    Join Date
    Dec 2013
    Posts
    131
    I've had a good probe - all power and ground pins are ok.

    Neither of the chips is showing any sign of communication and when probing the Reset line from pin 8 of the Mini54 I get some weird noise on the scope:

    Click image for larger version. 

Name:	IMG_20141112_115237.jpg 
Views:	121 
Size:	89.8 KB 
ID:	2928


    There is no change when I connect pin 20 (P5.2/Program push button) to ground. Any ideas what that might be?

    I'm pretty confident the crystal isn't interfering with this part of the circuit since power trace running under neath it looks OK on the scope:

    Click image for larger version. 

Name:	IMG_20141112_113825.jpg 
Views:	105 
Size:	99.5 KB 
ID:	2927


    Presumably then there is an issue with the basic functionality of the Mini54, which would only be affected by power, ground or P5.2?

    Many thanks!
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	IMG_20141112_113815.jpg 
Views:	89 
Size:	104.7 KB 
ID:	2926  
    Last edited by mattomatto; 11-12-2014 at 10:54 AM.

  15. #15
    Senior Member johnnyfp's Avatar
    Join Date
    Jan 2014
    Location
    New Zealand
    Posts
    260
    How did you solder the min54? Make sure that you don't have any bridges or dry joints.

    Also try and just power the Mini54 Programmer board and see if reset triggers when you press the prog button.

  16. #16
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,168
    Quote Originally Posted by mattomatto View Post
    Click image for larger version. 

Name:	IMG_20141112_115237.jpg 
Views:	121 
Size:	89.8 KB 
ID:	2928
    I can't say why your hardware isn't working, but from this photo, it seems pretty clear you need to adjust your oscilloscope's trigger threshold & holdoff settings.

  17. #17
    Senior Member
    Join Date
    Dec 2013
    Posts
    131
    Quote Originally Posted by PaulStoffregen View Post
    I can't say why your hardware isn't working, but from this photo, it seems pretty clear you need to adjust your oscilloscope's trigger threshold & holdoff settings.
    Yes you're quite right sorry... It's actually a pulse from GND to +3v3 at an interval of ~56 uSecs, which is about 17.8KHz, ~1000 times slower than my crystal should be... Could this still be caused by the crystal do you think?

    @johnnyfp - The mini54 does actually work when not attached to the rest of the board.. So it must be an issue with the main board.

    My next step is going to be to cut the VCC trace running underneath the crystal and wire it straight to the mini54 board.

    Thanks for your patience everyone...

  18. #18
    Senior Member
    Join Date
    Dec 2013
    Posts
    131
    aaaand IT WORKS! Turns out the problems were running VCC under the crystal along with the capacitance load settings for the crystal.

    I rewired it like this:

    Click image for larger version. 

Name:	IMG_20141115_114452.jpg 
Views:	132 
Size:	129.3 KB 
ID:	2947

    And changed the settings as Paul described, and I've got a blinking LED. Think I'll leave it a few days to enjoy the elation before testing the audio part of the circuit...

    Thanks all!

  19. #19
    Junior Member
    Join Date
    Nov 2014
    Posts
    11
    Is there a way to change OSC0_CR for "series capacitance"? I messed up and got a 16MHz crystal with "Series" load capacitance.....

    I looked at the ref manual, but not sure if not activating any of the internal caps would work or if that would create a whole new problem.
    Last edited by rvogel; 11-21-2014 at 12:34 AM.

  20. #20
    Senior Member
    Join Date
    Aug 2014
    Posts
    139
    Quote Originally Posted by rvogel View Post
    Is there a way to change OSC0_CR for "series capacitance"? I messed up and got a 16MHz crystal with "Series" load capacitance.....

    I looked at the ref manual, but not sure if not activating any of the internal caps would work or if that would create a whole new problem.
    I am designing a Teensy 3.1 PCB hybrid and am using a crystal resonator with 15pF internal capacitance,
    CSTCE16M0V53-R0

    If I change the line in the code here to read

    // enable capacitors for crystal
    //OSC0_CR = OSC_SC8P | OSC_SC2P;
    OSC0_CR = OSC_SC8P | OSC_SC2P | OSC_SC16P ;

    Will this work even though the load capacitance is actually 15pF and not 16pF?

    It is a 2 layer PCB w/ ground plane under the resonator and center pin is grounded, others to XTAL/EXTAL

    //from reference manual
    SC16P
    Oscillator 16 pF Capacitor Load Configure
    Configures the oscillator load.
    0 Disable the selection.
    1 Add 16 pF capacitor to the oscillator load.

  21. #21
    Senior Member
    Join Date
    Feb 2013
    Posts
    179
    Correct me if I'm wrong (and I probably am!) - wouldn't using 8, 2, and 16 give you a 26pF capacitance and not 16? According to Paul, the pins themselves have about 7pF of capacitance just by existing, so you'd be at 19pF. I think you could probably drop the 2, and just use (8+16)-7 = 17. Or, (16+4+2)-7 = 15.

    Ahhh, nevermind! My brainmath was all kinds of wrong.

    You need double your capacitor's rating (so 30), then subtract 7 from that. So you want 23pF as your final value. In which case, why not just 8+16 = 24?

    As a note, i've been using a 9pF crystal, with the default 8+2 settings, and it seems to be working fine.
    Last edited by MuShoo; 11-26-2014 at 02:24 AM. Reason: compelte brainfart

  22. #22
    Senior Member
    Join Date
    Aug 2014
    Posts
    139
    Quote Originally Posted by zachtos View Post
    I am designing a Teensy 3.1 PCB hybrid and am using a crystal resonator with 15pF internal capacitance,
    CSTCE16M0V53-R0

    If I change the line in the code here to read

    // enable capacitors for crystal
    //OSC0_CR = OSC_SC8P | OSC_SC2P;
    OSC0_CR = OSC_SC8P | OSC_SC2P | OSC_SC16P ;

    Will this work even though the load capacitance is actually 15pF and not 16pF?

    It is a 2 layer PCB w/ ground plane under the resonator and center pin is grounded, others to XTAL/EXTAL

    //from reference manual
    SC16P
    Oscillator 16 pF Capacitor Load Configure
    Configures the oscillator load.
    0 Disable the selection.
    1 Add 16 pF capacitor to the oscillator load.
    So will this work if I change it to :
    // enable capacitors for crystal
    OSC0_CR = OSC_SC8P | OSC_SC16P ;

    //old code
    //OSC0_CR = OSC_SC8P | OSC_SC2P;


    I think I read that I would have problems if you use a crystal rated for more then 10 pF load capacitance

Posting Permissions

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