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

Thread: Help with Teensy 3.2 DIY Project

  1. #1
    Junior Member
    Join Date
    Sep 2020
    Posts
    5

    Help with Teensy 3.2 DIY Project

    Hi, I am working on a bike computer hobby project. The goal of my project is to use the Teensy 3.2 as the base circuitry and then add on my own peripherals to connect to sensors and display. So far, I have designed the schematic, got the PCB manufactured, self assembled it, and now trying to program it for the first time. Trying to load any program using the Arduino IDE to my board fails with this error message:

    Click image for larger version. 

Name:	Error_Message.png 
Views:	23 
Size:	4.7 KB 
ID:	21655

    I have done all of my development work so far on a store bought Teensy 3.2. I do not believe it is a problem with Arduino IDE because I can program the store bought one. I believe it must be a problem with my board. I followed the Teensy 3.2 schematic example on the PJRC website pretty closely. I removed a few things which I believed were not necessary for my purposes. I marked the stuff not included in my schematic in red. For example I do not plan to use VRef so I removed some of the components for it.

    Click image for larger version. 

Name:	PJRC_Teensy32_Schematic.png 
Views:	22 
Size:	156.9 KB 
ID:	21656

    Here is my schematic. I have a lot of added circuitry involving how power is provided/enabled/recharged however from my testing I believe it to be working. In summary I have circuitry to automatically switch from using battery power to using USB power and begin charging once USB cord is plugged in. I have proven VDD line is 3.3V using battery or USB power. I was also able to prove my VDD line was able to supply 220mA at 3.25V continuously. All that to say, I think ICs using VDD are getting the power they need. I believe the problem is either with my programming circuitry or bad soldering somewhere. I bought the pre-programmed MKL02Z32 from PJRC and am using it on my board. Please let me know if you can see anything wrong with how I am trying to program my board. Also let me know if you have any ideas on how debug my circuit further to determine where the problem is.

    Click image for larger version. 

Name:	My_Schematic.jpg 
Views:	29 
Size:	174.7 KB 
ID:	21657

    Thanks in advance! I am looking forward to the day when I can program my own board

  2. #2
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    650
    I'd post your PCB layout too. Crystal and decoupling capacitors can be important.

    Also the info here:

    https://www.pjrc.com/store/ic_mkl02.html

  3. #3
    Junior Member
    Join Date
    Sep 2020
    Posts
    5

    PCB Layout

    Thank you for the quick response. Here is my PCB layout. I added a more zoomed in picture to help see the MKL02 and MK20 connection and crystal layout. Also the schematic I posted earlier had a few minor changes which I added after the fact which are unrelated, but thought I would post the schematic which exactly matches the layout. Upon reading the crystal guidelines it seems I may have done a few things wrong:

    1. My 16MHz crystal (https://www.digikey.com/product-deta...03-1-ND/675620) has 18pF load capacitance and I did not add any extra 20pF capacitors. What are the part numbers of the 16MHz and 32KHz crystal being used on Teensy 3.2? Does the 32KHz crystal for RTC need 8 to 10pf load capacitance as well? Am I looking for a crystal or an oscillator I may have gotten theses confused?

    2. I have signals routed underneath the crystal.

    3. I don't have a ground plane underneath the crystal. I am not sure I fully understand what I am supposed to do here. I am using a 2 layer board. So from what I understood, say I am putting the crystal on the top layer. I have the crystal pads and crystal signal traces on top layer. I have an island ground plane underneath the crystal on the bottom layer. Does ground plane underneath connect to board GND or is it just floating? Does the ground plane underneath connect to the crystal? Does the crystal connect to board GND?

    4. Does my schematic look correct as far as the connections for USB to MKL02 to MK20 go?

    Layout
    Click image for larger version. 

Name:	PCB_Layout.png 
Views:	17 
Size:	57.3 KB 
ID:	21662

    Layout Zoomed
    Click image for larger version. 

Name:	PCB_Layout_Zoomed.png 
Views:	19 
Size:	85.4 KB 
ID:	21663

    Schematic
    Click image for larger version. 

Name:	Schematic.png 
Views:	19 
Size:	123.0 KB 
ID:	21664

  4. #4
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    650
    I'd use a BOM, crystal layout and decoupling capacitor layout similar to what is here:

    https://gitlab.com/our-sci/reflectance-spec-PCB

    Or possibly here:

    https://github.com/jenschr/Teensy3.2-example

  5. #5
    Junior Member
    Join Date
    Sep 2020
    Posts
    5
    Thank you for pointing me to some useful examples. I now have some ideas about how to solve my crystal problem. As I am redesigning my circuit I would like to confirm a few things.

    1. Am I okay not having the parts for VRef which I marked in red on my original post?

    2. When you say decoupling capacitors, are you referring to the capacitors on either side of the crystal?

    3. Do I need capacitors for the 32KHz crystal as well?

  6. #6
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    650
    You aren't the first custom teensy designer to think that decoupling capacitors can be placed anywhere. Google with "decoupling capacitors pcb placement" should fix this.

  7. #7
    Senior Member
    Join Date
    Jul 2020
    Posts
    406
    Quote Originally Posted by JStew View Post

    2. When you say decoupling capacitors, are you referring to the capacitors on either side of the crystal?
    No, those are crystal loading caps. Decoupling capacitors go from the power pins to ground right next to the chip
    in every logic chip. They are not optional, everyone assumes this is known, so this can catch out newcomers. The
    faster the logic chip, the more important decoupling cap size and placement is.

    3. Do I need capacitors for the 32KHz crystal as well?
    The datasheet should say what crystal and loading are permitted - watch crystals use different on-chip oscillator
    due to the very different operating frequency. The datasheet will also have details of layout requirements, typically
    watch crystals are driven at W levels and are very susceptible to noise on the PCB so a recommended layout may be
    given in the datasheet - follow it!

  8. #8
    Junior Member
    Join Date
    Sep 2020
    Posts
    5
    Thanks for the advice I will look into it.

  9. #9
    Junior Member
    Join Date
    Sep 2020
    Posts
    5
    Thank you jonr and MarkT for your tips. I redesigned my board based on your tips and it is now programming!

    For the benefit of others reading this, I will post what I did to fix it:
    1. Add two 20pF capacitors(C17 and C18) to my schematic to be connected to the 16MHZ 18PF crystal(Y1).
    2. Created isolated ground plane on opposite side of the board underneath the 16MHZ crystal(Y1).
    3. Removed all traces going underneath or on top of crystal.
    4. Repositioned decoupling capacitors(C12, C13, C14).

    Working Layout:
    Click image for larger version. 

Name:	new_layout.jpg 
Views:	6 
Size:	207.3 KB 
ID:	22172
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	new_layout.jpg 
Views:	3 
Size:	207.3 KB 
ID:	22171  

Posting Permissions

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