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

Thread: External Crystal on Teensy LC with MCUXpresso IDE

  1. #1
    Junior Member
    Join Date
    Feb 2019
    Posts
    2

    External Crystal on Teensy LC with MCUXpresso IDE

    Hi all,

    I have been working on creating an HelloWorld project with MCUExpresso IDE on the TeensyLC.
    I am able to make the LED blink with the internal 4MHz oscillator but when changing to the external 16MHz crystal I could not make it work.
    From the datasheet of the MKL26 MCU I can see:
    Click image for larger version. 

Name:	Constraints.png 
Views:	15 
Size:	108.4 KB 
ID:	15860

    It looks like for fast crystals the internal caps cannot be used and PCB caps needs to added on the PCB which is not the case as seen in the TeensyLC schematic:
    Click image for larger version. 

Name:	schematic_lc.gif 
Views:	11 
Size:	25.1 KB 
ID:	15861

    This is how I configured to used the external 16MHz crystal:
    Click image for larger version. 

Name:	NotWorking.jpg 
Views:	13 
Size:	70.0 KB 
ID:	15862

    Is it sure no external caps needs to be used for the TeensyLC crystal?
    Anybody able to make the external crystal work?
    Something special to configure?

    I attached the working project with internal oscillator if anybody needs.

    Thanks to all of you in advance!

    Guillaume
    Attached Files Attached Files

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,567
    Yes we use it all the time... just use Arduino ? Or at least take a look at the sourcecode?

  3. #3
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,385
    I think it’s mainly to ease people’s life that Paul created the Teensyduino plugin for the Arduino IDE. The Teensyduino core files handle (among others) the boot process and the startup hardware configuration. Since these are automatically included during compilation, Teensy users never struggle with x-tal oscillator startup problems, they simply select the desired CPU speed (and USB configuration) in the IDE’s menu and that’s it.

    Since there is excellent Teensy support for the widespread Arduino IDE (and for Eclipse, PlatformIO, VisualCode), why would one struggle with a bare metal approach in an unsupported environment like MCUXpresso?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,939
    NXP's documentation is littered with wrong info, essentially copy-and-paste errors from other chips.

    The KL26 chips do indeed have the internal capacitors.

    And just to echo what Frank and Thierry already said, you can find working code in Teensyduino's core library. We know this code works well. It's been used by many thousands of people.

    You really should not expect anyone here to thoroughly review your ground-up bare metal code.

  5. #5
    Junior Member
    Join Date
    Feb 2019
    Posts
    2
    Thanks to all of you for your input.
    Ow I did not expect this about the NXP docs...

    My plan is to use the Teensy LC HW as a starting point to learn ARM and the other NXP MCUs (not only the MKL26Z64) this is why I am pushing to use the MCUExpresso
    I checked the Core Library but was not able to locate where the Clock Init is done in the TeensyLC (I think it was in the Teensy3 folder).
    Can you point me to a more specific location?
    Also, how did you generate that clock/caps

    Thanks in advance!

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,391
    With a quick global (search of) TeensyDuino installed source files in ...\hardware\teensy\avr\cores\teensy3\kinetis.h this comes up:
    Code:
    #elif (F_CPU == 48000000)
    // ...
    #elif (F_CPU == 24000000)
    //...
    Perhaps that will lead to desired answers in ...\hardware\teensy\avr\cores\teensy3\mk20dx128.c:
    Code:
    #elif F_CPU == 48000000
    // ...
    #elif F_CPU == 24000000
    // …
    Compared to the SDK - everything here is single minded and functional and refined to get the Teensy up and running for a defined environment.

    If you want an idea of what it takes to get one of these things running read Paul's scattered Teensy4 NXP 1052 - and current Beta - posts that go back some 14+ months when it was sitting on his desk - he got Beta boards out some 5-6 weeks ago - and those boards have a mix of caps on the crystals to test the best doc's he could get under NDA and after. Development is ongoing with 9 releases of software updates and hardware revs yet to come.
    Last edited by defragster; 02-11-2019 at 07:43 AM.

Posting Permissions

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