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

Thread: Adding a Unique identifying number to a Teensy device

  1. #1
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    302

    Adding a Unique identifying number to a Teensy device

    I'll be shipping a Teensy 3.2-based device soon, and would like each device to have a unique number, to be included in error and usage logs.
    What's the best practice for that, or is there a unique number or string backed into Teensy through the boot loader somehow? I'm using the Teensy boot loader on a custom board. Something in the MK20DX?
    I could configure one in flash, I suppose.

    Thanks!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,027
    For numbers already built in, you can use the 24 bit serial number PJRC writes into the "program once" memory, or you can use the 128 unique number NXP puts into the chip.

    For NXP's unique number, look at pages 265-267 in the MK20DX256 reference manual.

    https://www.pjrc.com/teensy/datasheets.html

    Reading the program once memory for PJRC's unique serial number takes a little more work. This code in the USB descriptor initialization is the place to start.

    https://github.com/PaulStoffregen/co...b_desc.c#L1628

  3. #3
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    302
    Sweet!
    I'll dig in.
    Thanks, Paul!

  4. #4
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    302
    Thanks, Paul!
    I had a quick look. The PJRC Unique Serial Number looks out of my wheelhouse.
    As for the 16-byte NXP number... that looks useful and almost accessible.
    Have you a quick reference to reading an NXP register through C++ code?
    (I imagine there's scattered through the libraries)

    Thanks!

  5. #5
    Member
    Join Date
    Aug 2018
    Location
    Brisbane, Australia
    Posts
    30
    You could try using this library
    https://github.com/sstaub/TeensyID

  6. #6
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    302
    Thanks! That looks just right !

  7. #7
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    332
    Here is another related thread.
    Paul

Posting Permissions

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